##// END OF EJS Templates
branching: merge with stable
marmoute -
r51836:32c13716 merge default
parent child Browse files
Show More
@@ -0,0 +1,18 b''
1 $ hg init test
2 $ cat >hgweb.cgi <<HGWEB
3 > #!$PYTHON
4 > from mercurial import demandimport; demandimport.enable()
5 > from mercurial.hgweb import hgweb
6 > from mercurial.hgweb import wsgicgi
7 > application = hgweb(b"test", b"Empty test repository")
8 > wsgicgi.launch(application)
9 > HGWEB
10 $ chmod 755 hgweb.cgi
11
12 Check that non-ASCII bytes roundtrip correctly.
13
14 $ . "$TESTDIR/cgienv"
15 $ PATH_INFO="/rev/$(python -c 'import sys; sys.stdout.buffer.write(b"\xe2\x80\x94")')"; export PATH_INFO
16 $ QUERY_STRING="style=raw"; export QUERY_STRING
17 $ "$PYTHON" ./hgweb.cgi | grep error
18 error: unknown revision '\xe2\x80\x94' (esc)
@@ -9,9 +9,7 b''
9 # http://www.python.org/dev/peps/pep-0333/#the-server-gateway-side
9 # http://www.python.org/dev/peps/pep-0333/#the-server-gateway-side
10
10
11
11
12 import os
12 from .. import encoding, pycompat
13
14 from .. import pycompat
15
13
16 from ..utils import procutil
14 from ..utils import procutil
17
15
@@ -22,7 +20,10 b' def launch(application):'
22 procutil.setbinary(procutil.stdin)
20 procutil.setbinary(procutil.stdin)
23 procutil.setbinary(procutil.stdout)
21 procutil.setbinary(procutil.stdout)
24
22
25 environ = dict(os.environ.items()) # re-exports
23 environ = {
24 k.decode('iso8859-1'): v.decode('iso8859-1')
25 for k, v in encoding.environ.items()
26 } # re-exports
26 environ.setdefault('PATH_INFO', '')
27 environ.setdefault('PATH_INFO', '')
27 if environ.get('SERVER_SOFTWARE', '').startswith('Microsoft-IIS'):
28 if environ.get('SERVER_SOFTWARE', '').startswith('Microsoft-IIS'):
28 # IIS includes script_name in PATH_INFO
29 # IIS includes script_name in PATH_INFO
General Comments 0
You need to be logged in to leave comments. Login now