[issue1778] KeyError 'SCRIPT_NAME' in hgwebdir_mod.py

Daniel Neugebauer mercurial-bugs at selenic.com
Sun Aug 2 09:08:35 CDT 2009

New submission from Daniel Neugebauer <energiequant at energiequant.de>:

The check for existance of key 'SCRIPT_NAME' in req.env in line 226 was 
wrong and threw an exception when being hosted with mod_wsgi. I changed the 
the line to match the check for 'PATH_INFO' 2 lines above.

diff -r 2de7d96593db mercurial/hgweb/hgwebdir_mod.py
--- a/mercurial/hgweb/hgwebdir_mod.py   Mon Jul 27 02:27:24 2009 +0200
+++ b/mercurial/hgweb/hgwebdir_mod.py   Sun Aug 02 16:03:41 2009 +0200
@@ -223,7 +223,7 @@
                 parts = [name]
                 if 'PATH_INFO' in req.env:
                     parts.insert(0, req.env['PATH_INFO'].rstrip('/'))
-                if req.env['SCRIPT_NAME']:
+                if 'SCRIPT_NAME' in req.env:
                     parts.insert(0, req.env['SCRIPT_NAME'])
                 m = re.match('((?:https?://)?)(.*)', '/'.join(parts))
                 # squish repeated slashes out of the path component

messages: 10261
nosy: dneuge
priority: bug
status: unread
title: KeyError 'SCRIPT_NAME' in hgwebdir_mod.py

Mercurial issue tracker <mercurial-bugs at selenic.com>

More information about the Mercurial-devel mailing list