Skip to content

net/http: client fails to detect Connection: close header in an edge case #8840

Closed
@gopherbot

Description

@gopherbot

by jim.robinson:

What does 'go version' print?

go version go1.3.2 darwin/amd64

What steps reproduce the problem?
If possible, include a link to a program on play.golang.org.

1. Run http://play.golang.org/p/7m6DwmGGQ9

What happened?

The last request sent by the client fails to establish
a new connection on request# 4.

What should have happened instead?

The client should reconnect to the server instead
of using the closed connection.

Please provide any additional information below.

I ran into this case for real, where a server was sending
back:

HTTP/1.1 200 OK
<other headers>
Connection: keep-alive
<other headers>
Connection: close

and my go based client failed to detect that the server
had closed the connection, causing the next HTTP request
to fail.

My reading of the RFC indicates a server may send multiple
Connect headers, and that if any one of them is a "close"
token, the client should shut down its end of the socket.

It's stupid beyond belief that the server is sending these,
but I think it's technically accepted by the RFC.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions