Merge ~cjwatson/lazr.restful:304-response-headers into lazr.restful:main
Proposed by
Colin Watson
Status: | Merged | ||||
---|---|---|---|---|---|
Merged at revision: | 10efe471f131ad91fac1f2993dcca93fe2679115 | ||||
Proposed branch: | ~cjwatson/lazr.restful:304-response-headers | ||||
Merge into: | lazr.restful:main | ||||
Diff against target: |
251 lines (+69/-17) 10 files modified
NEWS.rst (+2/-0) src/lazr/restful/_resource.py (+22/-4) src/lazr/restful/basic-site.zcml (+1/-0) src/lazr/restful/example/base/filemanager.py (+2/-1) src/lazr/restful/example/base/tests/entry.txt (+15/-3) src/lazr/restful/example/base/tests/field.txt (+5/-1) src/lazr/restful/example/base/tests/hostedfile.txt (+4/-1) src/lazr/restful/example/base/tests/root.txt (+8/-3) src/lazr/restful/publisher.py (+5/-1) src/lazr/restful/testing/webservice.py (+5/-3) |
||||
Related bugs: |
|
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Guruprasad | Approve | ||
Review via email: mp+453766@code.launchpad.net |
Commit message
Don't send superfluous HTTP headers with 304 responses
Description of the change
RFC 2616 section 10.3.5 and RFC 7232 section 4.1 are both clear that 304 responses SHOULD NOT (or in some cases MUST NOT) include headers other than a short list relevant to caching. In particular, sending `Content-Length: 0` is actively harmful because it can end up instructing caches to replace that header in their cached 200 response, resulting in incorrect empty cached responses.
I wasn't able to get rid of the `X-Powered-By:` header added by `zope.publisher`, but that's a fixed string and doesn't really matter.
To post a comment you must log in.
LGTM 👍