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

The README should caution users against careless instantiation of the client #1

Closed
orivej opened this issue Dec 14, 2015 · 3 comments
Closed

Comments

@orivej
Copy link

orivej commented Dec 14, 2015

As explained in consulapi#1499 and go-dockerclient#434, it is not safe at all to replace http.DefaultClient with &http.Client{} or cleanhttp.DefaultClient(), and the README should address this fairly obscure and dangerous issue. I think it should suggest library authors to either instantiate a global DefaultClient, or to set DisableKeepAlives to true.

@jefferai
Copy link
Member

Using a global default client negates the point of this library, which is to ensure that you are using a clean client that will not be modified willy-nilly by other parts of an application. What you're suggesting is simply a different use-case than this library is designed for.

@orivej
Copy link
Author

orivej commented Dec 17, 2015

cleanhttp.DefaultClient() can not replace http.DefaultClient due to unbound growth of the number of established connections of many cleanhttp.DefaultClient()s in the connection pools of their http transports, and per-library global default client as in hashicorp/consul#1517 currently is the best use of this library.

@jefferai
Copy link
Member

Let's keep the discussion going at fsouza/go-dockerclient#434

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants