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

Comments

Projects
None yet
3 participants
@hexdigest
Copy link

commented Nov 20, 2018

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 this to the Go1.12 milestone Nov 20, 2018

@bradfitz bradfitz self-assigned this Nov 20, 2018

@gopherbot

This comment has been minimized.

Copy link

commented Nov 21, 2018

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

@gopherbot

This comment has been minimized.

Copy link

commented Nov 21, 2018

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

@gopherbot

This comment has been minimized.

Copy link

commented Nov 21, 2018

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

@gopherbot

This comment has been minimized.

Copy link

commented Nov 21, 2018

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

@gopherbot gopherbot closed this in 9aadbf5 Nov 28, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.