kxroberto added the comment: However, setting a default "0" when no content, that is still too much in general.
In case of a '304 Not Modified' for example (which is probably the most frequent HTTP status used on the web overall!) a Content-Length header obviously is disallowed at all according to https://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.3.5 "this prevents inconsistencies between cached entity-bodies and updated headers" Apache, NGINX and other servers observed indeed do not set Content-Length in 304. And there were bugfix issues regarding that. Some browsers obviously pick up a Content-Length "0", update the cached resource and thus zero the cached data. Literally obeying "If a cache uses a received 304 response to update a cache entry, the cache MUST update the entry to reflect any new field values given in the response." (Though that seems rather silly, as that would mean "Modified". And Content-Length should reasonably perhaps be better always associated with the current transmission for needs of keep-alive connections and buffer management at a lower level, and not with cache & status issues.) Possibly the same problem for 204. ---------- nosy: +kxroberto _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue3839> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com