]> Cypherpunks.ru repositories - gostls13.git/commit
net/http: allow upgrading non keepalive connections
authorAnmol Sethi <hi@nhooyr.io>
Sat, 24 Oct 2020 00:40:41 +0000 (00:40 +0000)
committerBrad Fitzpatrick <bradfitz@golang.org>
Tue, 1 Dec 2020 19:47:12 +0000 (19:47 +0000)
commit50b16f9de590822a04ec8d6cbac476366c1bde32
treefb46c24ff85b7588e475de44092b1284f58c46fa
parent212d385a2f723a8dd5e7d2e83efb478ddd139349
net/http: allow upgrading non keepalive connections

If one was using http.Transport with DisableKeepAlives and trying
to upgrade a connection against net/http's Server, the Server
would not allow a "Connection: Upgrade" header to be written
and instead override it to "Connection: Close" which would
break the handshake.

This change ensures net/http's Server does not override the
connection header for successful protocol switch responses.

Fixes #36381.

Change-Id: I882aad8539e6c87ff5f37c20e20b3a7fa1a30357
GitHub-Last-Rev: dc0de83201dc26236527b68bd49dffc53dd0389b
GitHub-Pull-Request: golang/go#36382
Reviewed-on: https://go-review.googlesource.com/c/go/+/213277
Trust: Emmanuel Odeke <emmanuel@orijtech.com>
Trust: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
src/net/http/response.go
src/net/http/serve_test.go
src/net/http/server.go