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

bradfitz opened this issue Jun 13, 2018 · 2 comments


None yet
2 participants
Copy link

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


This comment has been minimized.

Copy link

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?


This comment has been minimized.

Copy link
Member Author

commented Nov 1, 2018

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

@bradfitz bradfitz closed this Nov 1, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.