yada icon indicating copy to clipboard operation
yada copied to clipboard

`content-length` is incorrectly set to 0 when responding with HTTP 304 to GET requests

Open p-himik opened this issue 3 years ago • 0 comments

The culprit: https://github.com/juxt/yada/blob/cc6cb7ff0d00775e2fb066a0c87e86a1c4d2aa66/src/yada/interceptors.clj#L391-L393

Why it's incorrect: https://datatracker.ietf.org/doc/html/rfc7230#section-3.3.2

A server MAY send a Content-Length header field in a 304 (Not Modified) response to a conditional GET request (Section 4.1 of [RFC7232]); a server MUST NOT send Content-Length in such a response unless its field-value equals the decimal number of octets that would have been sent in the payload body of a 200 (OK) response to the same request.

p-himik avatar Jan 24 '22 18:01 p-himik