-
Notifications
You must be signed in to change notification settings - Fork 18k
net/http: document that conn.Hijack might have left-over read/write timeouts on net.Conn #8296
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
Labels
Milestone
Comments
I disagree; this behavior is causing bugs in existing code due to it being unexpected, and even if documented, would still be unexpected and would cause bugs to be written. Both notable websocket libraries do not handle this case and thus have bugs in them: - https://github.com/gorilla/websocket/blob/master/server.go#L100 - https://code.google.com/p/go/source/browse/websocket/server.go?repo=net#14 It's hard to search for other uses of the API; GitHub doesn't list any results for "hijacker" in Go files. I checked the release history: - Go 1.0 has my bug. It also appears to have another fairly obvious bug related to timeouts; it sets deadlines on Accept, and never sets them again. - Go 1.1 has my bug. It also *changes this behavior* from Go 1.0 and sets deadlines on Accept *and* on the start of a new request; this fixes a bug with long-lived http connections and affects hijackers. - Go 1.2 has my bug. Nothing changed with regard to deadlines. - Go 1.3 has my bug. Nothing changed with regard to deadlines. There's already precedent for changing this behavior to less buggy and more expected behavior (go1.1 changed it.) Why not this time as well? Is the implementation more important than the documentation? This is undocumented at the moment (in both ways, it neither defines the bug to exist or not to exist.) Changing the docs to match the implementation is an acceptable way to do things (see Perl5), but personally I'd rather see Go accumulate as little API cruft as possible. People will still likely write bugs expecting it to be more sane if this remains, even if documented. That said, I don't know of a way to "go fix" this in user code, so it would need a line of errata in the release notes. |
I got hit by this bug as well. Have to see how I can implement a working request timeout by myself. |
I agree with Brad - let's document this. |
CL https://golang.org/cl/11411 mentions this issue. |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
The text was updated successfully, but these errors were encountered: