]> Cypherpunks repositories - gostls13.git/commit
[release-branch.go1.22] 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:31 +0000 (22:21 +0000)
commit32229514396234a25d910ab26a4e5194671a2c9f
treecc2a6e206b28405b5d2ddc1bed3da18bff1af238
parentceaf26ecce663e75c4f4b476dc3c64fa58a2f0dd
[release-branch.go1.22] 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 #68200

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/+/595235
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Joedian Reid <joedian@google.com>
src/net/http/server.go
src/net/http/transport.go
src/net/http/transport_test.go