-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
hyper does not comply with Expect: 100-continue
statement
#369
Comments
Hmm. Hyper is using a BufReader, which by default uses 64kbs. Is it significantly bigger than that? |
It is much smaller: 1024 bytes (as indicated by the title of the Issue 😉 ). And the issue starts getting visible at precisely this value. |
Could you try using |
It makes strictly no difference. |
@octplane Could you try to profile the code? |
Also, would be neat to see actual time values. 1000 bytes can be the size of packet in some cases, so it could just be doing an additional sys call to read the end. |
@reem , @seanmonstar I have no idea on how to profile rust code... I'm on OSX, FWIW... |
Ok, after some investigation (read the wget logs), I found out that hyper does not conform to some expected parf of the HTTP specification:
Because the payload is bigger than 1024 bytes,
Hyper happily receives the payload and call the handler. |
Expect: 100-continue
statement
Thanks for finding out the real issue! To fix this, I'd imagine adding a |
@seanmonstar I'm not convinced that hyper should actually handle this vs. downstream users/libraries adding features like this. |
|
I'm convinced. |
Adds a new method to `Handler`, with a default implementation of always responding with a `100 Continue` when sent an expectation. Closes #369
I'm using hyper to receive githook commit messages and when the payload is longer than 1024 bytes,
request.read_to_string()
is much much slower than it probably should be (something like a factor 100 on localhost)...I have created a very simple test case in https://github.com/octplane/githook-client-rust/tree/slow_read_hyper . It's a simple POST upload that triggers the behavior.
I suspect this might be due to the network packets but I'm not sure and I'm certain somebody here will have a much better idea on how to identify the issue :)
Thanks for your time !
The text was updated successfully, but these errors were encountered: