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: http.Client fail with EOF on sequential request to chunked content #9122

Closed
gopherbot opened this issue Nov 18, 2014 · 3 comments
Closed
Milestone

Comments

@gopherbot
Copy link

by Benny.TPNG:

What does 'go version' print?
go1.3.3 windows/amd64
go1.3.3 linux/amd64

What steps reproduce the problem?
1. go run main.go

What happened?
The 2nd request will fail with EOF.

What should have happened instead?
Both requests should succeed without error.

Please provide any additional information below.
The server is an IIS reverse proxy to a go http server.

Response header sample:
HTTP/1.1 200 OK
Date: Tue, 18 Nov 2014 11:12:09 GMT
Server: Microsoft-IIS/6.0
X-Powered-By: ASP.NET
Content-Type: application/json;charset=utf-8
Date: Tue, 18 Nov 2014 11:12:08 GMT
Transfer-Encoding: chunked
Via: 1.1 203.80.2.39 (IIRF v2.1)

Attachments:

  1. main.go (399 bytes)
@ianlancetaylor
Copy link
Contributor

Comment 1:

Labels changed: added repo-main, release-go1.5.

@gopherbot
Copy link
Author

Comment 2 by Benny.TPNG:

After further investigation, it seems the problem exists for non chunked content as well.
The problem only occurs when the go server is behind the IIS reverse proxy.
Updated repro is attached.
Sample Header (IIS reverse proxy):
HTTP/1.1 200 OK
Date: Wed, 19 Nov 2014 03:02:24 GMT
Server: Microsoft-IIS/6.0
X-Powered-By: ASP.NET
Content-Type: application/json; charset=utf-8
Date: Wed, 19 Nov 2014 03:02:24 GMT
Content-Length: 85
Via: 1.1 203.80.2.39 (IIRF v2.1)
Sample Header (local):
HTTP/1.1 200 OK
Content-Length: 90
Content-Type: application/json; charset=utf-8
Date: Wed, 19 Nov 2014 03:03:35 GMT

Attachments:

  1. main.go (453 bytes)

@bradfitz
Copy link
Contributor

Comment 3:

The server is misbehaving.
It's replying HTTP/1.1 200 OK (which implies it supports keep-alive connections in the
absence of any indicator to the contrary), and it doesn't have a "Connection: close"
header, but then it just closes the connection immediately.
The Go code meanwhile assumes it's conforming and tries to send another request on that
connection but then it receives the EOF from the peer closing the first request.
Workaround: disable KeepAlives on the http.Transport you're using.
This is a dup of issue #4677

Status changed to Duplicate.

Merged into issue #4677.

This issue was closed.
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