Mercurial > hg
comparison mercurial/hgweb/wsgicgi.py @ 13570:617a87cb7eb2
hgweb: add support for 100-continue as recommended by PEP 333.
author | Augie Fackler <durin42@gmail.com> |
---|---|
date | Sat, 06 Feb 2010 04:27:28 -0600 |
parents | a1cb8ca051c0 |
children | 659f34b833b9 |
comparison
equal
deleted
inserted
replaced
13569:3ab3b892d223 | 13570:617a87cb7eb2 |
---|---|
8 # This was originally copied from the public domain code at | 8 # This was originally copied from the public domain code at |
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 import os, sys | 11 import os, sys |
12 from mercurial import util | 12 from mercurial import util |
13 from mercurial.hgweb import common | |
13 | 14 |
14 def launch(application): | 15 def launch(application): |
15 util.set_binary(sys.stdin) | 16 util.set_binary(sys.stdin) |
16 util.set_binary(sys.stdout) | 17 util.set_binary(sys.stdout) |
17 | 18 |
21 # IIS includes script_name in path_info | 22 # IIS includes script_name in path_info |
22 scriptname = environ['SCRIPT_NAME'] | 23 scriptname = environ['SCRIPT_NAME'] |
23 if environ['PATH_INFO'].startswith(scriptname): | 24 if environ['PATH_INFO'].startswith(scriptname): |
24 environ['PATH_INFO'] = environ['PATH_INFO'][len(scriptname):] | 25 environ['PATH_INFO'] = environ['PATH_INFO'][len(scriptname):] |
25 | 26 |
26 environ['wsgi.input'] = sys.stdin | 27 stdin = sys.stdin |
28 if environ.get('HTTP_EXPECT', '').lower() == '100-continue': | |
29 stdin = common.continuereader(stdin, sys.stdout.write) | |
30 | |
31 environ['wsgi.input'] = stdin | |
27 environ['wsgi.errors'] = sys.stderr | 32 environ['wsgi.errors'] = sys.stderr |
28 environ['wsgi.version'] = (1, 0) | 33 environ['wsgi.version'] = (1, 0) |
29 environ['wsgi.multithread'] = False | 34 environ['wsgi.multithread'] = False |
30 environ['wsgi.multiprocess'] = True | 35 environ['wsgi.multiprocess'] = True |
31 environ['wsgi.run_once'] = True | 36 environ['wsgi.run_once'] = True |