-
Notifications
You must be signed in to change notification settings - Fork 101
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
Respond with 412 Precondition Failed when required request headers are missing/invalid #79
Comments
Providing f22a926 as an example. |
I would be cool with this change, you @Acconut? If we merge, I think we'll have to bump the minor as part of this PR. So this will become tus |
Great! Will add that in a separate commit. |
I apologize for not responding there yet. I agree that the protocol is not always specific about how to handle each error case but I am afraid of giving to much possibilities to a single status code, in this case the 412. As alternatives I propose, the good old |
Sticking to
If we're going head to head between The 412 (Precondition Failed) status code indicates that one or more The 428 status code indicates that the origin server requires the |
@bhstahl, it is not good idea to mix the cases of missed and invalid headers in response with status code By HTTP spec, when some required precondition header is missed, the response should be When precondition header is not matched the server side state, the response should be
So, 412 is not suitable for case of missing header. In case of some header has invalid syntax — What the headers are precondition is up to the certain protocol extension. In basic HTTP the precondition headers are In sum:
PS side note regarding the protocol versioning (inspired by: 412 "is used when the client is not supported by the server"):
|
Good points @ruv, thanks for opining. I agree that it makes sense to create a distinction between missing/invalid. @Acconut @kvz would you guys be ok with: Invalid header responds
Missing required header responds
If so, I can update #80. |
@bhstahl, the following reasoning can be also considered. If some request can be responded with Applying this criterion to |
Currently, a
412 Precondition Failed
is used when the client is not supported by the server.But, this could also be used if the request headers don't satisfy the protocol, such as if the
Upload-Offset
header is missing inPATCH
requestsor the
Upload-Length
,Upload-Defer-Length
headers withPOST
requests.Thoughts?
The text was updated successfully, but these errors were encountered: