Show More
@@ -9,7 +9,8 b'' | |||
|
9 | 9 | import os |
|
10 | 10 | from mercurial import ui, hg, hook, error, encoding, templater |
|
11 | 11 | from common import get_mtime, ErrorResponse, permhooks, caching |
|
12 |
from common import HTTP_OK, HTTP_ |
|
|
12 | from common import HTTP_OK, HTTP_NOT_MODIFIED, HTTP_BAD_REQUEST | |
|
13 | from common import HTTP_NOT_FOUND, HTTP_SERVER_ERROR | |
|
13 | 14 | from request import wsgirequest |
|
14 | 15 | import webcommands, protocol, webutil |
|
15 | 16 | |
@@ -202,6 +203,9 b' class hgweb(object):' | |||
|
202 | 203 | return tmpl('error', error=str(inst)) |
|
203 | 204 | except ErrorResponse, inst: |
|
204 | 205 | req.respond(inst, ctype) |
|
206 | if inst.code == HTTP_NOT_MODIFIED: | |
|
207 | # Not allowed to return a body on a 304 | |
|
208 | return [''] | |
|
205 | 209 | return tmpl('error', error=inst.message) |
|
206 | 210 | |
|
207 | 211 | def templater(self, req): |
@@ -8,7 +8,7 b'' | |||
|
8 | 8 | |
|
9 | 9 | import socket, cgi, errno |
|
10 | 10 | from mercurial import util |
|
11 | from common import ErrorResponse, statusmessage | |
|
11 | from common import ErrorResponse, statusmessage, HTTP_NOT_MODIFIED | |
|
12 | 12 | |
|
13 | 13 | shortcuts = { |
|
14 | 14 | 'cl': [('cmd', ['changelog']), ('rev', None)], |
@@ -83,6 +83,13 b' class wsgirequest(object):' | |||
|
83 | 83 | |
|
84 | 84 | if isinstance(status, ErrorResponse): |
|
85 | 85 | self.header(status.headers) |
|
86 | if status.code == HTTP_NOT_MODIFIED: | |
|
87 | # RFC 2616 Section 10.3.5: 304 Not Modified has cases where | |
|
88 | # it MUST NOT include any headers other than these and no | |
|
89 | # body | |
|
90 | self.headers = [(k, v) for (k, v) in self.headers if | |
|
91 | k in ('Date', 'ETag', 'Expires', | |
|
92 | 'Cache-Control', 'Vary')] | |
|
86 | 93 | status = statusmessage(status.code, status.message) |
|
87 | 94 | elif status == 200: |
|
88 | 95 | status = '200 Script output follows' |
General Comments 0
You need to be logged in to leave comments.
Login now