comparison mercurial/hgweb/wsgicgi.py @ 4869:be591b740e0f

Handle CGI SSL detection via HTTPS environment better. Some servers send on/off, 0/1, yes/no, and may be upper or lower case. This fix will handle all of those permutations. It was inspired by the detection done in in some other wsgi python web applications I looked at.
author Wesley J. Landaker <wjl@icecavern.net>
date Thu, 12 Jul 2007 13:55:20 -0600
parents 7605da1c3b5c
children
comparison
equal deleted inserted replaced
4868:192cd95c2ba8 4869:be591b740e0f
21 environ['wsgi.version'] = (1, 0) 21 environ['wsgi.version'] = (1, 0)
22 environ['wsgi.multithread'] = False 22 environ['wsgi.multithread'] = False
23 environ['wsgi.multiprocess'] = True 23 environ['wsgi.multiprocess'] = True
24 environ['wsgi.run_once'] = True 24 environ['wsgi.run_once'] = True
25 25
26 if environ.get('HTTPS','off') in ('on','1'): 26 if environ.get('HTTPS','off').lower() in ('on','1','yes'):
27 environ['wsgi.url_scheme'] = 'https' 27 environ['wsgi.url_scheme'] = 'https'
28 else: 28 else:
29 environ['wsgi.url_scheme'] = 'http' 29 environ['wsgi.url_scheme'] = 'http'
30 30
31 headers_set = [] 31 headers_set = []