changeset 3274:e0cd1b98bf8d

hgweb: be more conservative about expanding SCRIPT_NAME
author Brendan Cully <brendan@kublai.com>
date Thu, 05 Oct 2006 15:36:53 -0700
parents 46188b9528ca
children 7ae37d99d47e
files mercurial/hgweb/hgweb_mod.py
diffstat 1 files changed, 5 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/hgweb/hgweb_mod.py	Thu Oct 05 15:04:15 2006 -0700
+++ b/mercurial/hgweb/hgweb_mod.py	Thu Oct 05 15:36:53 2006 -0700
@@ -653,13 +653,16 @@
                 def firstitem(query):
                     return query.split('&', 1)[0].split(';', 1)[0]
 
-                root = req.env.get('SCRIPT_NAME', '')
+                root = req.env.get('REQUEST_URI', '').split('?', 1)[0]
+                pi = req.env.get('PATH_INFO', '')
+                if pi:
+                    root = root[:-len(pi)]
+                
                 if req.env.has_key('REPO_NAME'):
                     base = '/' + req.env['REPO_NAME']
                 else:
                     base = root
 
-                pi = req.env.get('PATH_INFO')
                 if pi:
                     while pi.startswith('//'):
                         pi = pi[1:]