-
-
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
feat(server): Handle 100-continue #1232
Conversation
The 100 Continue is always sent immediately because tokio-proto tries to load the first bit of the body, but that's better than nothing! |
890cead
to
759e868
Compare
I don't agree with that rationale. Even blindly returning |
b434e15
to
a5b1646
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's apparently "fine" to respond with 100 Continue
, and then right after, 400 Bad Request
. So I'm fine with this behavior. Of course, when tokio-rs/tokio-proto#153 has a solution, we'd want to adapt.
In this case, what's the best way to test this? The Client
doesn't know how to wait for a continue either. Would the best thing be to just add a test in tests/server.rs
with just a TcpStream
and timeouts?
@@ -119,6 +123,17 @@ pub fn should_keep_alive(version: HttpVersion, headers: &Headers) -> bool { | |||
ret | |||
} | |||
|
|||
/// Checks if a connection is expecting a `100 Continue` before sending its body. | |||
#[inline] | |||
pub fn expecting_continue(version: HttpVersion, headers: &Headers) -> bool { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we get a test case at the bottom, like there is for should_keep_alive
?
Yeah, I was trying to figure out the right way to test this. Client support is something I'd love to have, but it's a bit more complex than the server side - you have to wait on the continue with a timeout in case the server doesn't know how to handle |
Updated with tests |
Thanks! |
Awesome now we have some support in tree. :) @seanmonstar last week you said on irc that there might be something hyper can do about the buffering. Can we get an outline of your thoughts on that maybe in the discussion on #838 ? |
My thoughts are really short, probably flawed, and untested. Essentially, record some This might not work at all. It's possible that the buffer in Tokio will know better, and if the user polls after the buffer has, and the |
Thanks! |
cc #838