-
Notifications
You must be signed in to change notification settings - Fork 17.7k
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: make default configs have better timeouts #24138
Comments
Perhaps 1.11 should have high, non-infinity default timeouts, letting people adapt with less of a shock before setting lower, more sensible defaults in 1.12. |
I don't think the way we transition matters, IMHO it's a Go 1 compatibility promise violation: there's a specific real documented use case (streaming) that would stop working from one version to the other. If we want to consider this a security exception, I'm not sure where I stand, but I think that's the frame in which we should evaluate it. |
Perhaps the less intrusive change wrt backwards compatibility would be to only set non-zero timeouts on package-level |
/cc @bradfitz |
At least we should mention the risk in the docs. See #22085 |
In #22982, an instance of this meta bug, I said in #22982 (comment) :
|
Recording here an idea that someone at GopherCon suggested. (I don't remember who, apologies.) Even if we can't change the Not sure how to map this to the server side, though. |
Honestly, I think the DefaultClient is pretty much broken. If you try to traffic switch by changing DNS you can wait forever (or does it recently changed?). I am also fine with DefaultClientWithTimeout, but something should be changed in go1. |
@szuecs If I understand correctly, the issue is that DefaultClient does not respond to changes in the DNS? I can see that being intended behavior due to connection reuse, or maybe due to hostname lookup caching, but in any case that's unrelated to request/response timeouts. Can you open a separate issue and expand on what you expected to happen vs. what actually happened? Thank you! |
@FiloSottile a separate issue is already available #23427 |
Would setting a default This is now flagged as gosec rule G114, which applies to all documented uses of these functions: The recommendation is to at least set a |
See #23459.
Client, Server, and Transport may all have timeout fields in which zero = infinity. Instead it should be a reasonable default.
The text was updated successfully, but these errors were encountered: