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

Recommend creating http.Transport with default settings #20

Merged
merged 2 commits into from
Oct 21, 2019

Conversation

tmm1
Copy link
Contributor

@tmm1 tmm1 commented Oct 21, 2019

This is now the recommended way to create a transport in golang 1.13, to ensure that default settings (such as to close idle connections) are inherited.

This is now the recommended way to create a transport in golang 1.13, to ensure that default settings (such as to close idle connections) are inherited.
@mattrobenolt
Copy link
Member

ooo, is this new in 1.13, or just recommended since 1.13?

@tmm1
Copy link
Contributor Author

tmm1 commented Oct 21, 2019

New in go 1.13, golang/go#26013 (comment)

@mattrobenolt
Copy link
Member

Then can we maybe just document both since 1.13 is still relatively new?

@tmm1
Copy link
Contributor Author

tmm1 commented Oct 21, 2019

I suppose that's fair, although the old way is quite bad as it initializes many fields as zero and can lead to resource exhaustion because idle connections are set to unlimited with no timeout.

@mattrobenolt
Copy link
Member

I agree. But if you’re using 1.12, you don’t really have a choice. In theory, we could provide our own method of like, “NewHttpTransport()” that did the right thing in < 1.12 and 1.13.

@tmm1
Copy link
Contributor Author

tmm1 commented Oct 21, 2019

Okay I documented both ways.

@mattrobenolt
Copy link
Member

Thank you! And I’ve learned something here today.

@mattrobenolt mattrobenolt merged commit 0944d24 into certifi:master Oct 21, 2019
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

Successfully merging this pull request may close these issues.

None yet

2 participants