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: client.Do should mask EOF as ErrUnexpectedEOF #18055

dsnet opened this Issue Nov 26, 2016 · 3 comments


None yet
5 participants
Copy link

dsnet commented Nov 26, 2016

func Test(t *testing.T) {
	server := httptest.NewServer(
			func(w http.ResponseWriter, r *http.Request) {
				rwc, _, _ := w.(http.Hijacker).Hijack()
				defer rwc.Close()
	defer server.Close()

	_, err := http.Get(server.URL)
	if err != nil {
		t.Fatalf("GET returned error: %v", err)

The preceding test prints GET returned error: EOF, which is strange since io.EOF is often an "error" signaling normal termination of some stream. Instead, Do should mask the error as io.ErrUnexpectedEOF, which is more indicative of an abrupt termination.

@dsnet dsnet added this to the Go1.9Maybe milestone Nov 26, 2016

@dsnet dsnet added the NeedsFix label Nov 26, 2016


This comment has been minimized.

Copy link

bradfitz commented Nov 26, 2016

We tried to fix this once and had to revert it. There's a testing locking in this behavior. :-/

But maybe we can revisit.


This comment has been minimized.

Copy link

ibrasho commented Jan 22, 2017

@bradfitz Can you link the old fix for reference?


This comment has been minimized.

Copy link

bradfitz commented Jan 22, 2017

@ibrasho, you can probably find it in git history as quickly as I could. (which might not be super quick)

@bradfitz bradfitz modified the milestones: Go1.10, Go1.9Maybe Jun 30, 2017

@rsc rsc modified the milestones: Go1.10, Go1.11 Nov 22, 2017

@gopherbot gopherbot modified the milestones: Go1.11, Unplanned May 23, 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.