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 regression #3644

Closed
bradfitz opened this issue May 19, 2012 · 2 comments
Closed

net/http: http Client regression #3644

bradfitz opened this issue May 19, 2012 · 2 comments

Comments

@bradfitz
Copy link
Contributor

Change 820ffde8c396 for issue #1967 broke the http client:

func TestIssueNNNN(t *testing.T) {
        ts := httptest.NewServer(HandlerFunc(func(w ResponseWriter, r *Request) {
                w.Header().Set("Connection", "close")
                for i := 0; i < 1024; i++ {
                        w.Write([]byte("foo "))
                }
        }))
        defer ts.Close()
        tr := &Transport{}
        c := &Client{Transport: tr}
        res, err := c.Get(ts.URL)
        if err != nil {
                t.Fatal(err)
        }
        defer res.Body.Close()
        bs, err := ioutil.ReadAll(res.Body)
        if err != nil {
                t.Fatal(err)    // <--- Fails, "use of closed network connection"
        }
        if len(bs) != 1024 * len("foo ") {
                t.Errorf("unexpected response length")
        }
}

(report from cookieo9@gmail.com)
@bradfitz
Copy link
Contributor Author

Comment 1:

This issue was closed by revision 30c0d23.

Status changed to Fixed.

@bradfitz
Copy link
Contributor Author

Comment 2:

This issue was closed by revision 30c0d23.

@bradfitz bradfitz self-assigned this May 21, 2012
bradfitz added a commit that referenced this issue May 11, 2015
…lure for now

««« backport c3cbd6798cc7
net/http: fix regression and mute known test failure for now

Two tests added in 820ffde8c are expected to fail until the fix
for Issue 3540 goes back in (pending Windows net fixes), so
make those tests just Logf for now, with a TODO to re-enable.

Add a new client test.

Rearrange the transport code to be more readable, and fix the
bug from 820ffde8c where the persistConn was being closed before
the body was fully ready.

Fixes #3644
Updates #1967 (not yet fixed, but should be after Issue 3540)

R=golang-dev, adg
CC=golang-dev
https://golang.org/cl/6211069

»»»
@golang golang locked and limited conversation to collaborators Jun 24, 2016
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

2 participants