New submission from Florent Xicluna: While testing wsgiref w.r.t RFC2616, I noticed that it sets the Content-Length to 0 when the application returns 304 Not Modified.
This is a violation of RFC 2616 section 10.3.5. And the net effect is a weird bug with some browsers (tested with Chrome 27) where the resource is truncated on 304 Not Modified. (the resource was a CSS file in that case) This is loosely related to http://bugs.python.org/issue3839. # How to reproduce: def test_304(): import time from email.utils import formatdate from wsgiref.simple_server import make_server def demo_app(environ, start_response): if 'HTTP_IF_MODIFIED_SINCE' in environ: start_response("304 Not Modified", []) return [] headers = [('Content-Type', 'text/html; charset=utf-8'), ('Last-Modified', formatdate(time.time(), usegmt=True))] start_response("200 OK", headers) return ["Hello World!"] httpd = make_server('127.0.0.1', 8000, demo_app) sa = httpd.socket.getsockname() print("Serving HTTP on %s port %s ..." % sa) httpd.serve_forever() if __name__ == '__main__': test_304() ---------- components: Library (Lib) messages: 190352 nosy: flox, pitrou, pje priority: normal severity: normal status: open title: wsgiref sets Content-Length: 0 on 304 Not Modified type: behavior versions: Python 2.7, Python 3.2, Python 3.3, Python 3.4 _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue18099> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com