-
-
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
fix(http1): only send 100 Continue
if request body is polled
#2119
Conversation
@@ -460,19 +469,28 @@ impl From<Cow<'static, str>> for Body { | |||
impl Sender { | |||
/// Check to see if this `Sender` can send more data. | |||
pub fn poll_ready(&mut self, cx: &mut task::Context<'_>) -> Poll<crate::Result<()>> { | |||
match self.abort_tx.poll_canceled(cx) { |
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.
Seems this was important for detecting when the receiver is dropped while the connection is waiting on the socket.
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.
Nice!
Does this need to be handled for http2 as well? |
Could be an enhancement, but the HTTP2 side doesn't currently have any handling of |
Do you mean the HTTP2 standard doesn't define 100-continue semantics, or that h2 doesn't deal with it right now? RST_STREAM doesn't quite cover the same use cases, since the client doesn't have a robust way to know if it should send the body or not other than I guess waiting for a little bit to see if it gets a RST. It seems like some implementations do support it, FWIW. Don't feel super strongly about it though: https://github.com/dotnet/corefx/issues/31312 |
This one. I haven't done much looking into what HTTP2 says about |
c0c9fb9
to
e06f582
Compare
Before, if a client request included an `Expect: 100-continue` header, the `100 Continue` response was sent immediately. However, this is problematic if the service is going to reply with some 4xx status code and reject the body. This change delays the automatic sending of the `100 Continue` status until the service has call `poll_data` on the request body once.
e06f582
to
f7c262b
Compare
Do you have a plan to make the same thing possible with HTTP/2? According to HTTP specifications, an h2 server, like h1, MUST return a 100 continue response to |
Before, if a client request included an
Expect: 100-continue
header,the
100 Continue
response was sent immediately. However, this isproblematic if the service is going to reply with some 4xx status code
and reject the body.
This change delays the automatic sending of the
100 Continue
statusuntil the service has call
poll_data
on the request body once.Closes #838