Re: [go-nuts] early close of http.Client's Response.Body

2019-11-25 Thread Andy Balholm
Read-to-EOF is one of several conditions for connection reuse: - Was the response body fully read (to EOF)? - Does the server support HTTP keep-alives? - Is DisableKeepAlives set to false (the default) on the http.Transport that the client uses? A connection will only be reused if all of these a

Re: [go-nuts] early close of http.Client's Response.Body

2019-11-25 Thread Liam Breck
On Mon, Nov 25, 2019, 10:32 AM Andy Balholm wrote: > > > > On Nov 25, 2019, at 9:54 AM, Liam wrote: > > > > - does the read-to-EOF stipulation also apply to Client.Get/Post() ? > > Yes. Those methods are fairly simple wrappers around Do. > > > - why does Response.Body.Close() before io.EOF not r

Re: [go-nuts] early close of http.Client's Response.Body

2019-11-25 Thread Andy Balholm
> On Nov 25, 2019, at 9:54 AM, Liam wrote: > > - does the read-to-EOF stipulation also apply to Client.Get/Post() ? Yes. Those methods are fairly simple wrappers around Do. > - why does Response.Body.Close() before io.EOF not release unread buffers or > otherwise prepare it for persistence?

[go-nuts] early close of http.Client's Response.Body

2019-11-25 Thread Liam
Scenario: Sending a client request and only reading the whole Response.Body for certain .StatusCode values, and/or reading only the first N bytes. Docs for Client.Do() "If the Body is not both read to EOF and closed, the Client's underlying RoundTripper (typically Transport) may not be able to r