mirror of https://github.com/zulip/zulip.git
rest_dispatch: Remove invalid Content-Length: 0 from 204 responses.
There’s an apparent contradiction between RFC 7230 §3.3.2 Content-Length: “A server MUST NOT send a Content-Length header field in any response with a status code of 1xx (Informational) or 204 (No Content).” and RFC 7231 §4.3.7 OPTIONS: “A server MUST generate a Content-Length field with a value of "0" if no payload body is to be sent in the response.” The only resolution within the existing language would be to disallow all 204 responses to OPTIONS requests. However, I don’t think that was the intention, so I submitted this erratum report: https://www.rfc-editor.org/errata/eid5806 and updated the code accordingly. Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
This commit is contained in:
parent
2e57f3ffae
commit
73330f3136
|
@ -71,7 +71,6 @@ def rest_dispatch(request: HttpRequest, **kwargs: Any) -> HttpResponse:
|
|||
if request.method == 'OPTIONS':
|
||||
response = HttpResponse(status=204) # No content
|
||||
response['Allow'] = ', '.join(sorted(supported_methods.keys()))
|
||||
response['Content-Length'] = "0"
|
||||
return response
|
||||
|
||||
# Override requested method if magic method=??? parameter exists
|
||||
|
|
Loading…
Reference in New Issue