comparison mercurial/hgweb/hgweb_mod.py @ 12739:8dcd3203a261

hgweb: don't send a body or illegal headers during 304 response Without this fix, mod_wsgi and spawning get in a wedged state after sending a 304 response. Not sending a body fixed that problem. The header change was discovered by using wsgiref.validate.validator to check for other errors.
author Augie Fackler <durin42@gmail.com>
date Sat, 16 Oct 2010 17:29:04 -0500
parents ef969e58a394
children 61a898576888
comparison
equal deleted inserted replaced
12738:e9733f96b38b 12739:8dcd3203a261
7 # GNU General Public License version 2 or any later version. 7 # GNU General Public License version 2 or any later version.
8 8
9 import os 9 import os
10 from mercurial import ui, hg, hook, error, encoding, templater 10 from mercurial import ui, hg, hook, error, encoding, templater
11 from common import get_mtime, ErrorResponse, permhooks, caching 11 from common import get_mtime, ErrorResponse, permhooks, caching
12 from common import HTTP_OK, HTTP_BAD_REQUEST, HTTP_NOT_FOUND, HTTP_SERVER_ERROR 12 from common import HTTP_OK, HTTP_NOT_MODIFIED, HTTP_BAD_REQUEST
13 from common import HTTP_NOT_FOUND, HTTP_SERVER_ERROR
13 from request import wsgirequest 14 from request import wsgirequest
14 import webcommands, protocol, webutil 15 import webcommands, protocol, webutil
15 16
16 perms = { 17 perms = {
17 'changegroup': 'pull', 18 'changegroup': 'pull',
200 except (error.RepoError, error.RevlogError), inst: 201 except (error.RepoError, error.RevlogError), inst:
201 req.respond(HTTP_SERVER_ERROR, ctype) 202 req.respond(HTTP_SERVER_ERROR, ctype)
202 return tmpl('error', error=str(inst)) 203 return tmpl('error', error=str(inst))
203 except ErrorResponse, inst: 204 except ErrorResponse, inst:
204 req.respond(inst, ctype) 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 return tmpl('error', error=inst.message) 209 return tmpl('error', error=inst.message)
206 210
207 def templater(self, req): 211 def templater(self, req):
208 212
209 # determine scheme, port and server name 213 # determine scheme, port and server name