mercurial/hgweb/request.py
changeset 12739 8dcd3203a261
parent 10263 25e572394f5c
child 13598 e5d3c7083d91
--- a/mercurial/hgweb/request.py	Sat Oct 16 22:40:46 2010 +0200
+++ b/mercurial/hgweb/request.py	Sat Oct 16 17:29:04 2010 -0500
@@ -8,7 +8,7 @@
 
 import socket, cgi, errno
 from mercurial import util
-from common import ErrorResponse, statusmessage
+from common import ErrorResponse, statusmessage, HTTP_NOT_MODIFIED
 
 shortcuts = {
     'cl': [('cmd', ['changelog']), ('rev', None)],
@@ -83,6 +83,13 @@
 
             if isinstance(status, ErrorResponse):
                 self.header(status.headers)
+                if status.code == HTTP_NOT_MODIFIED:
+                    # RFC 2616 Section 10.3.5: 304 Not Modified has cases where
+                    # it MUST NOT include any headers other than these and no
+                    # body
+                    self.headers = [(k, v) for (k, v) in self.headers if
+                                    k in ('Date', 'ETag', 'Expires',
+                                          'Cache-Control', 'Vary')]
                 status = statusmessage(status.code, status.message)
             elif status == 200:
                 status = '200 Script output follows'