gavioto / playn

Automatically exported from code.google.com/p/playn
0 stars 0 forks source link

Fix readFully in JavaNet, when the response is longer than 4096 (BUF_SIZE) #120

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Purpose of code changes on this branch:
(I'll copy-paste my commit message here:)

http://code.google.com/r/yohcop-playn/source/detail?r=e58d3bda9feef6461f7b886344
f61916dba63421&name=fix-javanet

Fix readFully in JavaNet, when the response is longer than 4096 (BUF_SIZE).

If the response is longer than 4096 characters, but not a multiple of 4096 
(e.g. 5000 characters), the first 4096 chars are added correctly to the result 
string, followed by the next 4 of the response - as expected - but also 
followed by 4092 characters of the previous buffer.

Example with BUF_SIZE=5 and http response = "abcdefg"

first loop, buffer = "abcde", result is now "abcde".
second loop, buffer = "fgcde", (first 2 characters overriden in the buffer 
array, but not the last 3.) Result is then "abcdefgcde".

There may be a \0 in here as well.

After the review, I'll merge this branch into:
/trunk

Original issue reported on code.google.com by yoh...@gmail.com on 15 Jan 2012 at 11:06

GoogleCodeExporter commented 9 years ago
Looks good, thanks for the fix. Committed to trunk.

Original comment by jgw@google.com on 13 Feb 2012 at 10:23

GoogleCodeExporter commented 9 years ago
Issue 121 has been merged into this issue.

Original comment by jgw@google.com on 14 Feb 2012 at 1:44