Fix misc. coding errors found while testing the reference library.

This commit is contained in:
Phillip J. Eby 2004-10-06 06:23:54 +00:00
parent c96856e95c
commit c029c079a2
1 changed files with 7 additions and 6 deletions

View File

@ -221,7 +221,7 @@ server.
environ['wsgi.version'] = (1,0)
environ['wsgi.multithread'] = False
environ['wsgi.multiprocess'] = True
environ['wsgi.last_call'] = True
environ['wsgi.run_once'] = True
if environ.get('HTTPS','off') in ('on','1'):
environ['wsgi.url_scheme'] = 'https'
@ -254,8 +254,8 @@ server.
raise exc_info[0], exc_info[1], exc_info[2]
finally:
exc_info = None # avoid dangling circular ref
elif headers_sent:
raise AssertionError("Headers already sent!")
elif headers_set:
raise AssertionError("Headers already set!")
headers_set[:] = [status,response_headers]
return write
@ -1239,6 +1239,7 @@ URL Reconstruction
If an application wishes to reconstruct a request's complete URL, it
may do so using the following algorithm, contributed by Ian Bicking::
from urllib import quote
url = environ['wsgi.url_scheme']+'://'
if environ.get('HTTP_HOST'):
@ -1247,14 +1248,14 @@ may do so using the following algorithm, contributed by Ian Bicking::
url += environ['SERVER_NAME']
if environ['wsgi.url_scheme'] == 'https':
if environ['SERVER_PORT'] != '443'
if environ['SERVER_PORT'] != '443':
url += ':' + environ['SERVER_PORT']
else:
if environ['SERVER_PORT'] != '80':
url += ':' + environ['SERVER_PORT']
url += environ.get('SCRIPT_NAME','')
url += environ.get('PATH_INFO','')
url += quote(environ.get('SCRIPT_NAME',''))
url += quote(environ.get('PATH_INFO',''))
if environ.get('QUERY_STRING'):
url += '?' + environ['QUERY_STRING']