comparison tests/get-with-headers.py @ 18380:a4d7fd7ad1f7

serve: don't send any content headers with 304 responses Fixes HTTP protocol violation introduced in cf5c76017e11. 'hg serve' would show a stacktrace when loading pages that not had been modified. There was test coverage for this, but the wrong response headers wasn't shown and thus not detected.
author Mads Kiilerich <madski@unity3d.com>
date Tue, 15 Jan 2013 20:54:57 +0100
parents 953faba28e91
children a38039ef7312
comparison
equal deleted inserted replaced
18379:e0c4f4ba624c 18380:a4d7fd7ad1f7
29 29
30 conn = httplib.HTTPConnection(host) 30 conn = httplib.HTTPConnection(host)
31 conn.request("GET", '/' + path, None, headers) 31 conn.request("GET", '/' + path, None, headers)
32 response = conn.getresponse() 32 response = conn.getresponse()
33 print response.status, reasons.get(response.reason, response.reason) 33 print response.status, reasons.get(response.reason, response.reason)
34 if show[:1] == ['-']:
35 show = [h for h, v in response.getheaders() if h.lower() not in show]
34 for h in [h.lower() for h in show]: 36 for h in [h.lower() for h in show]:
35 if response.getheader(h, None) is not None: 37 if response.getheader(h, None) is not None:
36 print "%s: %s" % (h, response.getheader(h)) 38 print "%s: %s" % (h, response.getheader(h))
37 39
38 print 40 print