Skip to content

fix(server): prevent sending 100-continue if user drops request body - #3137

Merged
seanmonstar merged 1 commit into
masterfrom
dropped-body-shouldnt-send-100-continue
Feb 2, 2023
Merged

seanmonstar merged 1 commit into
masterfrom
dropped-body-shouldnt-send-100-continue

Conversation

@seanmonstar

Copy link
Copy Markdown
Member

No description provided.

@seanmonstar
seanmonstar requested a review from sfackler February 1, 2023 17:03
Comment thread src/proto/h1/conn.rs Resolved
@seanmonstar
seanmonstar merged commit 499fe1f into master Feb 2, 2023
@seanmonstar
seanmonstar deleted the dropped-body-shouldnt-send-100-continue branch February 2, 2023 14:12
0xE282B0 pushed a commit to 0xE282B0/hyper that referenced this pull request Jan 16, 2024
grosskur added a commit to grosskur/hyper that referenced this pull request Oct 1, 2026
If a client request has an `Expect: 100-continue` header, the server is supposed
to answer with either a `100 Continue` to indicate it is ready to receive the
rest of the request content, or a final status like `417 Expectation Failed` to
indicate it cannot meet the expectation. See RFC 9110 §10.1.1 for details.

The HTTP/1 server handles this correctly. It sends `100 Continue` the first time
it polls the body of a request that has `Expect: 100-continue`, provided no
response has started (see hyperium#2119 and hyperium#3137).

However, the HTTP/2 server currently ignores `Expect`. So a client that waits
for the `100 Continue` before sending its body stalls until its own timeout. Fix
this by implementing the same behavior as the HTTP/1 server: send `100 Continue`
the first time the body of the request is polled.
grosskur added a commit to grosskur/hyper that referenced this pull request Oct 1, 2026
If a client request has an `Expect: 100-continue` header, the server is supposed
to answer with either a `100 Continue` to indicate it is ready to receive the
rest of the request content, or a final status like `417 Expectation Failed` to
indicate it cannot meet the expectation. See RFC 9110 §10.1.1 for details.

The HTTP/1 server handles this correctly. It sends `100 Continue` the first time
it polls the body of a request that has `Expect: 100-continue`, provided no
response has started (see hyperium#2119 and hyperium#3137).

However, the HTTP/2 server currently ignores `Expect`. So a client that waits
for the `100 Continue` before sending its body stalls until its own timeout. Fix
this by implementing the same behavior as the HTTP/1 server: send `100 Continue`
the first time the body of the request is polled.

Fixes hyperium#2743
grosskur added a commit to grosskur/hyper that referenced this pull request Oct 1, 2026
If a client request has an `Expect: 100-continue` header, the server is supposed
to answer with either a `100 Continue` to indicate it is ready to receive the
rest of the request content, or a final status like `417 Expectation Failed` to
indicate it cannot meet the expectation. See RFC 9110 §10.1.1 for details.

The HTTP/1 server handles this correctly. It sends `100 Continue` the first time
it polls the body of a request that has `Expect: 100-continue`, provided no
response has started (see hyperium#2119 and hyperium#3137).

However, the HTTP/2 server currently ignores `Expect`. So a client that waits
for the `100 Continue` before sending its body stalls until its own timeout. Fix
this by implementing the same behavior as the HTTP/1 server: send `100 Continue`
the first time the body of the request is polled.

Fixes hyperium#2743
grosskur added a commit to grosskur/hyper that referenced this pull request Oct 1, 2026
If a client request has an `Expect: 100-continue` header, the server is supposed
to answer with either a `100 Continue` to indicate it is ready to receive the
rest of the request content, or a final status like `417 Expectation Failed` to
indicate it cannot meet the expectation. See RFC 9110 §10.1.1 for details.

The HTTP/1 server handles this correctly. It sends `100 Continue` the first time
it polls the body of a request that has `Expect: 100-continue`, provided no
response has started (see hyperium#2119 and hyperium#3137).

However, the HTTP/2 server currently ignores `Expect`. So a client that waits
for the `100 Continue` before sending its body stalls until its own timeout. Fix
this by implementing the same behavior as the HTTP/1 server: send `100 Continue`
the first time the body of the request is polled.

Fixes hyperium#2743
grosskur added a commit to grosskur/hyper that referenced this pull request Oct 1, 2026
If a client request has an `Expect: 100-continue` header, the server is supposed
to answer with either a `100 Continue` to indicate it is ready to receive the
rest of the request content, or a final status like `417 Expectation Failed` to
indicate it cannot meet the expectation. See RFC 9110 §10.1.1 for details.

The HTTP/1 server handles this correctly. It sends `100 Continue` the first time
it polls the body of a request that has `Expect: 100-continue`, provided no
response has started (see hyperium#2119 and hyperium#3137).

However, the HTTP/2 server currently ignores `Expect`. So a client that waits
for the `100 Continue` before sending its body stalls until its own timeout. Fix
this by sending `100 Continue` the first time the service polls the body of the
request and has to wait for it, provided no response has started. Unlike the
HTTP/1 server, the `100 Continue` is omitted if the content has already arrived
by then, which RFC 9110 allows.

As with HTTP/1, a service that responds before polling the body of the request
(for example, one that echoes it back as the response body) never triggers a
`100 Continue`, since an interim response cannot follow the final one.

Fixes hyperium#2743

Co-Authored-By: Claude Opus 5.5 <[email protected]>
grosskur added a commit to grosskur/hyper that referenced this pull request Oct 1, 2026
If a request has `Expect: 100-continue`, the server should either send
`100 Continue` to say it is ready for the request body, or send a
final status such as `417 Expectation Failed`. See RFC 9110 §10.1.1.

The HTTP/1 server handles this correctly: it sends `100 Continue` the
first time the service polls the request body. However, the HTTP/2
server ignores `Expect`, so a client that waits for `100 Continue`
before sending its body stalls until its own timeout.

Fix this by making the HTTP/2 server send `100 Continue` after the
service first polls the request body. Note that if the body has
already started arriving by then, this means the client did not wait,
so we skip the `100 Continue` (which RFC 9110 allows).

As with HTTP/1, nothing is sent if the request has no body, or if the
service responds before polling the body, since an interim response
cannot follow the final one.

Fixes hyperium#2743
Refs: hyperium#2119, hyperium#3137
grosskur added a commit to grosskur/hyper that referenced this pull request Oct 1, 2026
Per RFC 9110, 10.1.1: If a request has `Expect: 100-continue`, the
server should either send `100 Continue` to say it is ready for the
request body, or send a final status such as `417 Expectation Failed`.

The HTTP/1 server handles this correctly: it sends `100 Continue` the
first time the service polls the request body. However, the HTTP/2
server ignores `Expect`, so a client that waits for `100 Continue`
before sending its body stalls until its own timeout.

Fix this by making the HTTP/2 server send `100 Continue` after the
service first polls the request body. Note that if the body has
already started arriving by then, this means the client did not wait,
so we skip the `100 Continue` (which RFC 9110 allows). As with HTTP/1,
nothing is sent if the request has no body, or if the service responds
before polling the body, since an interim response cannot follow the
final response.

Fixes hyperium#2743
Refs: hyperium#2119, hyperium#3137
grosskur added a commit to grosskur/hyper that referenced this pull request Oct 1, 2026
Per RFC 9110, 10.1.1: If a request has `Expect: 100-continue`, the
server should either send `100 Continue` to say it is ready for the
request body, or send a final status such as `417 Expectation Failed`.

The HTTP/1 server handles this correctly: it sends `100 Continue` the
first time the service polls the request body. However, the HTTP/2
server ignores `Expect`, so a client that waits for `100 Continue`
before sending its body stalls until its own timeout.

Fix this by making the HTTP/2 server send `100 Continue` after the
service first polls the request body. Note that if the body has
already started arriving by then, this means the client did not wait,
so we skip the `100 Continue` (which RFC 9110 allows). As with HTTP/1,
nothing is sent if the request has no body, or if the service responds
before polling the body, since an interim response cannot follow the
final response.

Fixes hyperium#2743
Refs: hyperium#2119, hyperium#3137
grosskur added a commit to grosskur/hyper that referenced this pull request Oct 1, 2026
Per RFC 9110, 10.1.1: If a request has `Expect: 100-continue`, the
server should either send `100 Continue` to say it is ready for the
request body, or send a final status such as `417 Expectation Failed`.

The HTTP/1 server handles this correctly: it sends `100 Continue` the
first time the service polls the request body. However, the HTTP/2
server ignores `Expect`, so a client that waits for `100 Continue`
before sending its body stalls until its own timeout.

Fix this by making the HTTP/2 server send `100 Continue` after the
service first polls the request body. Note that if the body has
already started arriving by then, this means the client did not wait,
so we skip the `100 Continue` (which RFC 9110 allows). As with HTTP/1,
nothing is sent if the request has no body, or if the service responds
before polling the body, since an interim response cannot follow the
final response.

Fixes hyperium#2743
Refs: hyperium#2119, hyperium#3137
grosskur added a commit to grosskur/hyper that referenced this pull request Oct 2, 2026
Per RFC 9110, 10.1.1: If a request has `Expect: 100-continue`, the
server should either send `100 Continue` to say it is ready for the
request body, or send a final status such as `417 Expectation Failed`.

The HTTP/1 server handles this correctly: it sends `100 Continue` the
first time the service polls the request body. However, the HTTP/2
server ignores `Expect`, so a client that waits for `100 Continue`
before sending its body stalls until its own timeout.

Fix this by making the HTTP/2 server send `100 Continue` after the
service first polls the request body. Note that if the body has
already started arriving by then, this means the client did not wait,
so we skip the `100 Continue` (which RFC 9110 allows). As with HTTP/1,
nothing is sent if the request has no body, or if the service responds
before polling the body, since an interim response cannot follow the
final response.

Fixes hyperium#2743
Refs: hyperium#2119, hyperium#3137
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants