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: call TCPConn.SetKeepAlive on Transport #25883

Closed
bradfitz opened this issue Jun 13, 2018 · 2 comments
Closed

net/http: call TCPConn.SetKeepAlive on Transport #25883

bradfitz opened this issue Jun 13, 2018 · 2 comments
Assignees
Milestone

Comments

@bradfitz
Copy link
Contributor

@bradfitz bradfitz commented Jun 13, 2018

We enable TCP keep-alives by default for the http Server, but not the HTTP Client.

Seems like we should also enable it by default for the HTTP/1 and HTTP/2 clients.

(or perhaps just HTTP/1, and HTTP/2 can use PING frames with a timeout)

/cc @tombergan

@bradfitz bradfitz added the NeedsFix label Jun 13, 2018
@bradfitz bradfitz added this to the Unplanned milestone Jun 13, 2018
@jasdel

This comment has been minimized.

Copy link
Contributor

@jasdel jasdel commented Sep 17, 2018

Would enabling TCP keep-alive by default on the HTTP Client be equivalent to using a http.Transport's dialer with net.Dialer.KeepAlive > 0 behavior of using SetKeepAlive and SetKeepAlivePeriod to set the keep-alive? Or would only SetKeepAlive be used by the updated HTTP Client's default behavior?

With this default behavior change, would omitting net.Dialer.KeepAlive or setting its value to 0, disable TCP keep-alive like the behavior the current net.Dialer?

@bradfitz

This comment has been minimized.

Copy link
Contributor Author

@bradfitz bradfitz commented Nov 1, 2018

Nevermind, I actually already did this in 2014 in 49beb23 for #3362

@bradfitz bradfitz closed this Nov 1, 2018
@golang golang locked and limited conversation to collaborators Nov 1, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants
You can’t perform that action at this time.