Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/hgweb/hgweb_mod.py @ 3267:b4f16bf59a5d
hgweb: Added safety net for PATH_INFO starting with double slash.
This happens e.g. when using the following apache config:
RewriteRule (.*) /hgwebdir/$1 [PT]
instead of the less readable (but more correct):
RewriteRule (.*) /hgwebdir$1 [PT]
author | Thomas Arendsen Hein <thomas@intevation.de> |
---|---|
date | Thu, 05 Oct 2006 11:57:38 +0200 |
parents | 3207e30bf468 |
children | a7370503d800 |
comparison
equal
deleted
inserted
replaced
3266:03880d4e2550 | 3267:b4f16bf59a5d |
---|---|
658 elif req.env.get('SCRIPT_NAME'): | 658 elif req.env.get('SCRIPT_NAME'): |
659 base = req.env['SCRIPT_NAME'] | 659 base = req.env['SCRIPT_NAME'] |
660 | 660 |
661 pi = req.env.get('PATH_INFO') | 661 pi = req.env.get('PATH_INFO') |
662 if pi: | 662 if pi: |
663 while pi.startswith('//'): | |
664 pi = pi[1:] | |
663 if pi.startswith(base): | 665 if pi.startswith(base): |
664 if len(pi) > len(base): | 666 if len(pi) > len(base): |
665 base += '/' | 667 base += '/' |
666 query = pi[len(base):] | 668 query = pi[len(base):] |
667 else: | 669 else: |