# HG changeset patch # User Dirkjan Ochtman # Date 2008-04-03 11:21:42 # Node ID a63aed912e54434a1cc88ebda4b713910f3568a4 # Parent da752414978770dd8aaa8f4303eac98563e4555d # Parent 8189e03adb442645f3d5f301fc3d698d918ad86d Merge from crew-stable. diff --git a/mercurial/hgweb/hgweb_mod.py b/mercurial/hgweb/hgweb_mod.py --- a/mercurial/hgweb/hgweb_mod.py +++ b/mercurial/hgweb/hgweb_mod.py @@ -123,8 +123,8 @@ class hgweb(object): if 'REPO_NAME' in req.env: req.url += req.env['REPO_NAME'] + '/' - if req.env.get('PATH_INFO'): - parts = req.env.get('PATH_INFO').strip('/').split('/') + if 'PATH_INFO' in req.env: + parts = req.env['PATH_INFO'].strip('/').split('/') repo_parts = req.env.get('REPO_NAME', '').split('/') if parts[:len(repo_parts)] == repo_parts: parts = parts[len(repo_parts):] diff --git a/mercurial/hgweb/hgwebdir_mod.py b/mercurial/hgweb/hgwebdir_mod.py --- a/mercurial/hgweb/hgwebdir_mod.py +++ b/mercurial/hgweb/hgwebdir_mod.py @@ -181,7 +181,9 @@ class hgwebdir(object): if u.configbool("web", "hidden", untrusted=True): continue - parts = [req.env['PATH_INFO'].rstrip('/'), name] + parts = [name] + if 'PATH_INFO' in req.env: + parts.insert(0, req.env['PATH_INFO'].rstrip('/')) if req.env['SCRIPT_NAME']: parts.insert(0, req.env['SCRIPT_NAME']) url = ('/'.join(parts).replace("//", "/")) + '/' diff --git a/tests/test-hgweb-no-path-info b/tests/test-hgweb-no-path-info new file mode 100755 --- /dev/null +++ b/tests/test-hgweb-no-path-info @@ -0,0 +1,59 @@ +#!/bin/sh +# This tests if hgweb and hgwebdir still work if the REQUEST_URI variable is +# no longer passed with the request. Instead, SCRIPT_NAME and PATH_INFO +# should be used from d74fc8dec2b4 onward to route the request. + +mkdir repo +cd repo +hg init +echo foo > bar +hg add bar +hg commit -m "test" -d "0 0" -u "Testing" +hg tip + +cat > request.py < + + + http://127.0.0.1/ + + + repo Changelog + 1970-01-01T00:00:00+00:00 + + + test + http://www.selenic.com/mercurial/#changeset-4cbec7e6f8c42eb52b6b52670e1f7560ae9a101e + + + Testing + Testing + + 1970-01-01T00:00:00+00:00 + 1970-01-01T00:00:00+00:00 + +
+
test
+
+
+
+ +
+ +---- ERRORS + +---- HEADERS +200 Script output follows +---- DATA +[('Content-Type', 'text/plain; charset=ascii')] + +repo/ + + +---- ERRORS +