]> Cypherpunks repositories - gostls13.git/commit
[release-branch.go1.21] net/http: send body or close connection on expect-100-continu...
authorDamien Neil <dneil@google.com>
Thu, 6 Jun 2024 19:50:46 +0000 (12:50 -0700)
committerJoedian Reid <joedian@google.com>
Wed, 26 Jun 2024 22:21:48 +0000 (22:21 +0000)
commitc9be6ae748b7679b644a38182d456cb5a6ac06ee
treed8969e7ce695a351076dd5d2570c83907143b429
parentac14d4d9cea31109b475bdba3cc8afd823a07c21
[release-branch.go1.21] net/http: send body or close connection on expect-100-continue requests

When sending a request with an "Expect: 100-continue" header,
we must send the request body before sending any further requests
on the connection.

When receiving a non-1xx response to an "Expect: 100-continue" request,
send the request body if the connection isn't being closed after
processing the response. In other words, if either the request
or response contains a "Connection: close" header, then skip sending
the request body (because the connection will not be used for
further requests), but otherwise send it.

Correct a comment on the server-side Expect: 100-continue handling
that implied sending the request body is optional. It isn't.

For #67555
Fixes #68199

Change-Id: Ia2f12091bee697771087f32ac347509ec5922d54
Reviewed-on: https://go-review.googlesource.com/c/go/+/591255
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Jonathan Amsterdam <jba@google.com>
(cherry picked from commit cf501e05e138e6911f759a5db786e90b295499b9)
Reviewed-on: https://go-review.googlesource.com/c/go/+/595096
Reviewed-by: Joedian Reid <joedian@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
src/net/http/server.go
src/net/http/transport.go
src/net/http/transport_test.go