Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/hgweb/server.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 | cf5c76017e11 |
children | 52ed85d9ac26 |
comparison
equal
deleted
inserted
replaced
18379:e0c4f4ba624c | 18380:a4d7fd7ad1f7 |
---|---|
151 self._chunked = False | 151 self._chunked = False |
152 for h in self.saved_headers: | 152 for h in self.saved_headers: |
153 self.send_header(*h) | 153 self.send_header(*h) |
154 if h[0].lower() == 'content-length': | 154 if h[0].lower() == 'content-length': |
155 self.length = int(h[1]) | 155 self.length = int(h[1]) |
156 if self.length is None: | 156 if (self.length is None and |
157 saved_status[0] != common.HTTP_NOT_MODIFIED): | |
157 self._chunked = (not self.close_connection and | 158 self._chunked = (not self.close_connection and |
158 self.request_version == "HTTP/1.1") | 159 self.request_version == "HTTP/1.1") |
159 if self._chunked: | 160 if self._chunked: |
160 self.send_header('Transfer-Encoding', 'chunked') | 161 self.send_header('Transfer-Encoding', 'chunked') |
161 else: | 162 else: |