FAQ
Correct me if I'm wrong here, but I think there maybe an issue towards how
ctxhttp.Do would try to cleanup the residuals over the TCP connection when
the governing context is done. To begin, here is an excerpt of the comment
from the net/http/response.go:

// Body represents the response body.
//
// The http Client and Transport guarantee that Body is always
// non-nil, even on responses without a body or responses with
// a zero-length body. It is the caller's responsibility to
// close Body. The default HTTP client's Transport does not
// attempt to reuse HTTP/1.0 or HTTP/1.1 TCP connections
// ("keep-alive") unless the Body is read to completion and is
// closed.
//
// The Body is automatically dechunked if the server replied
// with a "chunked" Transfer-Encoding.

So, according to that, it seems like the goroutine at
x/net/context/ctxhttp/ctxhttp.go:60 will not properly cleanup the response
body. An additional statement of something like, io.Copy(ioutil.Discard,
resp.Body), should be added before it closes the body. Is this the right
idea? Or am I missing something, like resp.Body.Close() would actually read
everyone on that TCP connection?

--
You received this message because you are subscribed to the Google Groups "golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Search Discussions

Discussion Posts

Follow ups

Related Discussions

Discussion Navigation
viewthread | post
posts ‹ prev | 1 of 9 | next ›
Discussion Overview
groupgolang-nuts @
categoriesgo
postedMar 29, '16 at 10:32p
activeApr 7, '16 at 1:45p
posts9
users5
websitegolang.org

People

Translate

site design / logo © 2021 Grokbase