]> Cypherpunks repositories - gostls13.git/commit
net/http: send body or close connection on expect-100-continue requests
authorDamien Neil <dneil@google.com>
Thu, 6 Jun 2024 19:50:46 +0000 (12:50 -0700)
committerDamien Neil <dneil@google.com>
Thu, 6 Jun 2024 21:59:21 +0000 (21:59 +0000)
commitcf501e05e138e6911f759a5db786e90b295499b9
tree22f759b495c4b41c85a531d88669e3b0d6ea127d
parent2f6ba0c294e8ab202666e34d833286eecaa26d2b
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

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>
src/net/http/server.go
src/net/http/transport.go
src/net/http/transport_test.go