Fix some minor errors found during actual implementation of
example code.
This commit is contained in:
parent
a214fcda03
commit
b38414cc2a
|
@ -198,8 +198,7 @@ server.
|
||||||
|
|
||||||
def run_with_cgi(application):
|
def run_with_cgi(application):
|
||||||
|
|
||||||
environ = {}
|
environ = dict(os.environ.items())
|
||||||
environ.update(os.environ)
|
|
||||||
environ['wsgi.input'] = sys.stdin
|
environ['wsgi.input'] = sys.stdin
|
||||||
environ['wsgi.errors'] = sys.stderr
|
environ['wsgi.errors'] = sys.stderr
|
||||||
environ['wsgi.version'] = (1,0)
|
environ['wsgi.version'] = (1,0)
|
||||||
|
@ -207,9 +206,6 @@ server.
|
||||||
environ['wsgi.multiprocess'] = True
|
environ['wsgi.multiprocess'] = True
|
||||||
environ['wsgi.last_call'] = True
|
environ['wsgi.last_call'] = True
|
||||||
|
|
||||||
# XXX really should set defaults for WSGI-required variables;
|
|
||||||
# see "environ Variables" section below
|
|
||||||
|
|
||||||
if environ.get('HTTPS','off') in ('on','1'):
|
if environ.get('HTTPS','off') in ('on','1'):
|
||||||
environ['wsgi.url_scheme'] = 'https'
|
environ['wsgi.url_scheme'] = 'https'
|
||||||
else:
|
else:
|
||||||
|
@ -251,6 +247,8 @@ server.
|
||||||
try:
|
try:
|
||||||
for data in result:
|
for data in result:
|
||||||
write(data)
|
write(data)
|
||||||
|
if not headers_sent:
|
||||||
|
write('') # force headers to be sent
|
||||||
finally:
|
finally:
|
||||||
if hasattr(result,'close'):
|
if hasattr(result,'close'):
|
||||||
result.close()
|
result.close()
|
||||||
|
|
Loading…
Reference in New Issue