Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HTTPClient doesn't return full payload when chunked encoding is used #1975

Closed
igrr opened this issue Apr 26, 2016 · 0 comments
Closed

HTTPClient doesn't return full payload when chunked encoding is used #1975

igrr opened this issue Apr 26, 2016 · 0 comments

Comments

@igrr
Copy link
Member

igrr commented Apr 26, 2016

Do a GET request which should return
0000000 53 48 45 4c 4c 20 3a 3d 20 2f 62 69 6e 2f 62 61\n0000010 73 68 0a 56 20 3f 3d 20 30 0a 54 45 53 54 5f 4c\n0000020 49 53 54 20 3f 3d 20 24 28 77 69 6c 64 63 61 72\n0000030 64 20 74 65 73 74 5f 2a 2f 2a 2e 69 6e 6f 29 0a\n0000040 45 53 50 38 32 36 36 5f 43 4f 52 45 5f 50 41 54\n0000050 48 20 3f 3d 20 2e 2e 2f 2e 2e 0a 42 55 49 4c 44\n0000060 5f 44 49 52 20 3f 3d 20 24 28 50 57 44 29 2f 2e\n0000070 62 75 69 6c 64 0a 48 41 52 44 57 41 52 45 5f 44\n0000080 49 52 20 3f 3d 20 24 28 50 57 44 29 2f 2e 68 61\n0000090 72 64 77 61 72 65 0a 45 53 50 54 4f 4f 4c 20 3f\n00000a0 3d 20 24 28 45 53 50 38 32 36 36 5f 43 4f 52 45\n123

httpClient.getString() returns a string which is a few bytes shorter:
0000000 53 48 45 4c 4c 20 3a 3d 20 2f 62 69 6e 2f 62 61\n0000010 73 68 0a 56 20 3f 3d 20 30 0a 54 45 53 54 5f 4c\n0000020 49 53 54 20 3f 3d 20 24 28 77 69 6c 64 63 61 72\n0000030 64 20 74 65 73 74 5f 2a 2f 2a 2e 69 6e 6f 29 0a\n0000040 45 53 50 38 32 36 36 5f 43 4f 52 45 5f 50 41 54\n0000050 48 20 3f 3d 20 2e 2e 2f 2e 2e 0a 42 55 49 4c 44\n0000060 5f 44 49 52 20 3f 3d 20 24 28 50 57 44 29 2f 2e\n0000070 62 75 69 6c 64 0a 48 41 52 44 57 41 52 45 5f 44\n0000080 49 52 20 3f 3d 20 24 28 50 57 44 29 2f 2e 68 61\n0000090 72 64 77 61 72 65 0a 45 53 50 54 4f 4f 4c 20 3f\n00000a0 3d 20 24 28 45 53 50 38 32 36 36 5f 43 4f 52 45\n

(\ns are for readability. On the wire, actual newlines are sent.)

Relevant part of debug output:

[HTTP-Client][handleHeaderResponse] code: 200
[HTTP-Client][handleHeaderResponse] Transfer-Encoding: chunked
[HTTP-Client] read chunk len: 616
[HTTP-Client][writeToStreamDataBlock] connection closed or file end (written: 616).
[HTTP-Client] read chunk len: 0
[HTTP-Client][end] still data in buffer (13), clean up.
[HTTP-Client][end] tcp stop

Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant