Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

net/http: Transport sends two "Connection: close" headers #28886

Closed
hexdigest opened this issue Nov 20, 2018 · 4 comments
Closed

net/http: Transport sends two "Connection: close" headers #28886

hexdigest opened this issue Nov 20, 2018 · 4 comments
Labels
FrozenDueToAge NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone

Comments

@hexdigest
Copy link

What version of Go are you using (go version)?

$ go version
go version go1.11.2 linux/amd64

Does this issue reproduce with the latest release?

Yes

What operating system and processor architecture are you using (go env)?

go env Output
$ go env
GOARCH="amd64"
GOBIN=""
GOCACHE="/home/max/.cache/go-build"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/home/max/.gvm/pkgsets/go1.11.2/global"
GOPROXY=""
GORACE=""
GOROOT="/home/max/.gvm/gos/go1.11.2"
GOTMPDIR=""
GOTOOLDIR="/home/max/.gvm/gos/go1.11.2/pkg/tool/linux_amd64"
GCCGO="gccgo"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD="/home/max/jgb/src/github.com/hexdigest/connectionclose/go.mod"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build676875890=/tmp/go-build -gno-record-gcc-switches"

What did you do?

If you set DisableKeepAlives http.Transport property to true AND
set http.Request Close property to true

This results in sending two Connection-Close headers by the http.Client.

The source code to reproduce this bug is here:
https://github.com/hexdigest/connectionclose

What did you expect to see?

I expect to see only one Connection: close header on the server side.

What did you see instead?

I see two Connection: close headers on the server side.

@bradfitz bradfitz changed the title HTTP client sends two "Connection: close" headers net/http: Transport sends two "Connection: close" headers Nov 20, 2018
@bradfitz bradfitz added the NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. label Nov 20, 2018
@bradfitz bradfitz added this to the Go1.12 milestone Nov 20, 2018
@bradfitz bradfitz self-assigned this Nov 20, 2018
@gopherbot
Copy link

Change https://golang.org/cl/150719 mentions this issue: net/http: fix transport sends two "Connection: close" headers

@gopherbot
Copy link

Change https://golang.org/cl/150721 mentions this issue: net/http: fix transport sends two "Connection: close" headers

@gopherbot
Copy link

Change https://golang.org/cl/150720 mentions this issue: net/http: fix transport sends two "Connection: close" headers

@gopherbot
Copy link

Change https://golang.org/cl/150722 mentions this issue: net/http: fix transport sends two "Connection: close" headers

@golang golang locked and limited conversation to collaborators Nov 28, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Projects
None yet
Development

No branches or pull requests

3 participants