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: docs imply DefaultTransport doesn't use keep-alive connections, but it does #4281

Closed
gopherbot opened this issue Oct 24, 2012 · 3 comments
Milestone

Comments

@gopherbot
Copy link

by jacobsa@google.com:

I started a golang-nuts thread for this (http://goo.gl/D7Gvt) but never got a
response for my final question.

Calling `http.Get` or `http.Do` without changing any of the default settings
uses keep-alive connections; you can verify this by running the program Russ
posted in the thread I linked above. However, the docs say this:

> DefaultTransport is the default implementation of Transport and is 
> used by DefaultClient. It establishes a new network connection for 
> each call to Do [...]. 

This seems incorrect, unless I'm misreading it. Re-using a cached keep-alive
connection means that a new network connection is *not* established for each
call to `Do`, right?

The docs for the `Transport` type agree with the actual behavior, implying
that its zero value will use keep-alive connections (due to a zero value for
`MaxIdleConnsPerHost` implying `DefaultMaxIdleConnsPerHost`, which is two).
@bradfitz
Copy link
Contributor

Comment 1:

Thanks. We'll fix the docs.

Labels changed: removed priority-triage.

Owner changed to @bradfitz.

Status changed to Accepted.

@bradfitz
Copy link
Contributor

bradfitz commented Dec 3, 2012

Comment 2:

https://golang.org/cl/6872053

Status changed to Started.

@bradfitz
Copy link
Contributor

bradfitz commented Dec 5, 2012

Comment 3:

This issue was closed by revision a7c57b0.

Status changed to Fixed.

@rsc rsc added this to the Go1.1 milestone Apr 14, 2015
@rsc rsc removed the go1.1 label Apr 14, 2015
@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

3 participants