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: Response doesn't contain Connection header when Keep-Alive #15784

Closed
AlmogBaku opened this issue May 21, 2016 · 1 comment
Closed

Comments

@AlmogBaku
Copy link

AlmogBaku commented May 21, 2016

When sending a request with Keep-Alive, go respond with an HTTP response that is not contains the Connection header, although the connection maintained.


  1. What version of Go are you using (go version)?
go version go1.6 darwin/amd64
  1. What operating system and processor architecture are you using (go env)?
GOARCH="amd64"
GOBIN=""
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOOS="darwin"
GOPATH="<my_path>"
GORACE=""
GOROOT="/usr/local/go"
GOTOOLDIR="/usr/local/go/pkg/tool/darwin_amd64"
GO15VENDOREXPERIMENT="1"
CC="clang"
GOGCCFLAGS="-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fno-common"
CXX="clang++"
CGO_ENABLED="1"
  1. What did you do?
  • Start a basic HTTP server
  • Open a telnet connection to it, and send a Keep-Alive request
  • Send immediately another request to see if the connection maintained
$ telnet localhost 8000
Trying ::1...
Connected to localhost.
Escape character is '^]'.
GET / HTTP/1.1
Host: localhost
Connection: Keep-Alive

HTTP/1.1 200 OK
Date: Sat, 21 May 2016 11:59:42 GMT
Content-Length: 12
Content-Type: text/plain; charset=utf-8

Hello world!GET / HTTP/1.1
Host: localhost
Connection: Keep-Alive

HTTP/1.1 200 OK
Date: Sat, 21 May 2016 11:59:47 GMT
Content-Length: 12
Content-Type: text/plain; charset=utf-8

Hello world!
  1. What did you expect to see?
    Connection header should be maintained when the keep-alive maintained. as specified [in the RFC](https://www.w3.org/Protocols/HTTP/1.1/draft-ietf-http-v11-spec-01#Persistent Connections):

    The Connection header field with a keep-alive keyword must be sent on all requests and responses that wish to continue the persistence.

  2. What did you see instead?
    Connection header were dropped.

@adg
Copy link
Contributor

adg commented May 23, 2016

The RFC you linked to is an old draft, and the sentence you mentioned is not present in the final RFC. That RFC has since been superseded by 7230 and 7231, neither of which require the server to reply with a Connection: keep-alive header.

@adg adg closed this as completed May 23, 2016
@golang golang locked and limited conversation to collaborators May 23, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants