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

Content length of client response is assumed to fit within integer but may not #340

Open
RutledgePaulV opened this issue Jun 12, 2017 · 1 comment

Comments

@RutledgePaulV
Copy link

RutledgePaulV commented Jun 12, 2017

Hello!

I discovered that the content length parsing in the decoder assumes that the value can be read into an integer. It's actually quite easy to pass the bounds of an integer when dealing with bytes since Integer.MAX_VALUE translates to ~2.15gb. I reached this limit in one my own apps when attempting a large download. From some of the other issues ( #90 | #202 ) it looks like large downloads have a number of problems (buffering completely, etc).

Sun Jun 11 20:18:35 CDT 2017 [client-loop] ERROR - should not happen
java.lang.NumberFormatException: For input string: "4262924399"
	at java.lang.NumberFormatException.forInputString(NumberFormatException.java:65)
	at java.lang.Integer.parseInt(Integer.java:583)
	at java.lang.Integer.parseInt(Integer.java:615)
	at org.httpkit.client.Decoder.readHeaders(Decoder.java:167)

For reference:
JDK 1.8.0_102
lein 2.7.1
[http-kit "2.2.0"]

@RutledgePaulV RutledgePaulV changed the title Content length is assumed to fit within integer but may not Content length of client response is assumed to fit within integer but may not Jun 12, 2017
@ptaoussanis
Copy link
Member

Hi Paul,

Indeed, might not be worth trying to fix this in isolation given the other known issues with http-kit and large files.

Unless you (or someone else) felt strongly motivated enough to really look at tackling proper large-file support for http-kit, I think this is unlikely to be addressed.

Sorry about that!

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

2 participants