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: ResponseWriter panics in WriteHeaders that were formerly ignored #23010
Comments
It's also not obvious why mapping to a 500 or some other internal error wouldn't be better than panic. |
See some discussion about this on #22880. The point is to be consistent between HTTP/1 and HTTP/2. The hack we did for HTTP/1 was never right anyway, had no HTTP/2 analogue, and only hid real problems from users. (e.g. #22880 (comment)) People won't notice a 500. I'd like to keep the panic, at least for the betas and see if it trips up anybody whose code wasn't broken. |
I'd be fine changing this to code 500 too as long as it's accompanied by stderr log spam so people can fix their code. But I'd rather do that after a beta or two if it's actually necessary. |
Change https://golang.org/cl/86255 mentions this issue: |
Change https://golang.org/cl/86275 mentions this issue: |
Tests will be in net/http in a separate CL. Updates golang/go#23010 Change-Id: I91a6875b9a59b33a3c669e73dd6632ac523eb9f6 Reviewed-on: https://go-review.googlesource.com/86255 Reviewed-by: Ian Lance Taylor <iant@golang.org> Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
Tests will be in net/http in a separate CL. Updates golang/go#23010 Change-Id: I91a6875b9a59b33a3c669e73dd6632ac523eb9f6 Reviewed-on: https://go-review.googlesource.com/86255 Reviewed-by: Ian Lance Taylor <iant@golang.org> Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
See comments on CL 80077.
I am worried about (accidental) sequences like:
or
Those WriteHeader calls were formerly reported in a logf as out of sequence but otherwise ignored. They should probably continue to be logf+no-op instead of causing a panic.
The text was updated successfully, but these errors were encountered: