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

DefaultClient should not be used in API #1308

Closed
jefferai opened this issue Oct 15, 2015 · 0 comments
Closed

DefaultClient should not be used in API #1308

jefferai opened this issue Oct 15, 2015 · 0 comments
Assignees

Comments

@jefferai
Copy link
Member

Go's http.DefaultClient turns out to be rather dangerous, because it is a global variable and very easy for multiple parts of a program to modify its TLS and other configuration and stomp all over everything else using it. Using it was the cause of race conditions in Vault and consul-template.

I believe that clashes between Consul using http.DefaultClient in its API and the GitHub/OAuth2 libraries using http.DefaultClient in their APIs are the source of hashicorp/vault#700

http.DefaultClient is simply &http.Client{}. The Consul API should switch to using its own client, not only to ensure other pieces of a program don't step on its own configuration, but also because if CONSUL_HTTP_SSL_VERIFY is set, the Consul API itself will define its own http.Transport and step on anything else that has been set.

@slackpad slackpad self-assigned this Oct 15, 2015
jefferai added a commit that referenced this issue Oct 15, 2015
Two of the changes are in tests; the one of consequence is in the API.
As explained in #1308 this can cause conflicts with downstream programs.

Fixes #1308.
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