Page MenuHomePhabricator

🥦️ Cross check "What we want" table against RFC 9110
Closed, ResolvedPublic

Event Timeline

Ok, as a start I cross-checked our table against the RFC only for the sections of the table where the "what we want" isn't "what we have". In 3 cases the RFC pretty clearly supports the table, but to me it sounds like we got the If-Modified-Since case for edit requests wrong.

✅️ Handle If-Match for GET requests (T318716):

A client MAY send an If-Match header field in a GET request to indicate that it would prefer a 412 (Precondition Failed) response if the selected representation does not match.

https://httpwg.org/specs/rfc9110.html#field.if-match

✅️ Respond 412 for edit requests given If-None-Match: * (T318795):

To evaluate a received If-None-Match header field: [...] If the field value is "*", the condition is false if the origin server has a current representation for the target resource.
the origin server MUST respond with either a) the 304 (Not Modified) status code if the request method is GET or HEAD or b) the 412 (Precondition Failed) status code for all other request methods.

https://httpwg.org/specs/rfc9110.html#field.if-none-match

❌️ Handle If-Modified-Since for edit requests (T318792):

A recipient MUST ignore the If-Modified-Since header field [...] if the request method is neither GET nor HEAD.

https://httpwg.org/specs/rfc9110.html#field.if-modified-since

✅️ Handle If-Unmodified-Since header for get requests (T318796):

A client MAY send an If-Unmodified-Since header field in a GET request to indicate that it would prefer a 412 (Precondition Failed) response if the selected representation has been modified.

https://httpwg.org/specs/rfc9110.html#field.if-unmodified-since

Change 839604 had a related patch set uploaded (by Jakob; author: Jakob):

[mediawiki/core@master] ConditionalHeaderUtil: Handle `If-None-Match: *`

https://gerrit.wikimedia.org/r/839604