-
Notifications
You must be signed in to change notification settings - Fork 4.4k
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
transport/http2: use HTTP 400 for bad requests instead of 500 #5804
transport/http2: use HTTP 400 for bad requests instead of 500 #5804
Conversation
|
A few notes while CI runs its course:
[1] From https://httpwg.org/specs/rfc9110.html#field.upgrade:
|
Looks like "Testing / tests (tests, 1.19, 386)" will pass once #5812 lands and I rebase. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Somehow I forgot to send the review comment I wrote, sorry!
server.go
Outdated
var status = http.StatusBadRequest | ||
if err == transport.ErrInvalidWriter { | ||
status = http.StatusInternalServerError | ||
} | ||
http.Error(w, err.Error(), status) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we move this status code writing fully into the transport layer, to avoid the need to span the logic between the two?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No worries! Great idea — fixed in r2 (6a6c330).
4fb92d6
to
6a6c330
Compare
This PR is labeled as requiring an update from the reporter, and no update has been received after 6 days. If no update is provided in the next 7 days, this issue will be automatically closed. |
Erm, that’s odd - I pushed another commit six days ago. @dfawley if you get a few minutes, could you take another look (or maybe mark this not-stale)? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Erm, that’s odd - I pushed another commit six days ago.
Sorry, I just missed your updates. LGTM now, thank you for the change!
6a6c330
to
bd7c5a9
Compare
Looks like the tests are failing because they were checking for exact string match. Could you please fix them. |
Welllll heck, I’m sorry about that! Influenza brain told me to push without running the tests. I’ll fix that up today. Thanks for your help and patience, everyone! |
Non-servicable HTTP requests from clients previously resulted in an HTTP 500 response, but no error exists within the server; the client simply sent a malformed request. Detect bad requests and return HTTP 400 Bad Request instead of HTTP 500 Internal Server Error. fixes grpc#5802
bd7c5a9
to
d789adc
Compare
Tests fixed, sorry again! |
Thank you for your contribution. |
Non-servicable HTTP requests from clients previously resulted in an HTTP 500 response, but no error exists within the server; the client simply sent a malformed request. Detect bad requests and return HTTP 400 Bad Request instead of HTTP 500 Internal Server Error.
fixes #5802
RELEASE NOTES: