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
Labels
FrozenDueToAge NeedsFix The path to resolution is known, but the work has not been done.
Milestone

Comments

@bradfitz
Copy link
Contributor

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 The path to resolution is known, but the work has not been done. label Jun 13, 2018
@bradfitz bradfitz added this to the Unplanned milestone Jun 13, 2018
@jasdel
Copy link
Contributor

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
Copy link
Contributor Author

bradfitz commented Nov 1, 2018

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

@bradfitz bradfitz closed this as completed 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.
Labels
FrozenDueToAge NeedsFix The path to resolution is known, but the work has not been done.
Projects
None yet
Development

No branches or pull requests

3 participants