)
-
class BaseHandler:
"""Manage the invocation of a WSGI application"""
headers = None
bytes_sent = 0
-
-
-
-
-
-
-
def run(self, application):
"""Invoke the application"""
# Note to self: don't move the close()! Asynchronous servers shouldn't
raise NotImplementedError
-
-
-
-
-
-
-
-
-
class SimpleHandler(BaseHandler):
"""Handler that's just initialized with streams, environment, etc.
origin_server = False
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
class CGIHandler(BaseCGIHandler):
"""CGI-based invocation via sys.stdin/stdout/stderr and os.environ
self, sys.stdin, sys.stdout, sys.stderr, dict(os.environ.items()),
multithread=False, multiprocess=True
)
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-#
return param
-
-
-
-
-
-
-
-
-
-
-
-
class Headers:
"""Manage a collection of HTTP response headers"""
"""
return self.get(name)
-
-
-
-
def has_key(self, name):
"""Return true if the message contains the header."""
return self.get(name) is not None
"""
return [k for k, v in self._headers]
-
-
-
def values(self):
"""Return a list of all header values.
else:
return result
-
def add_header(self, _name, _value, **_params):
"""Extended header setting.
else:
parts.append(_formatparam(k.replace('_', '-'), v))
self._headers.append((_name, "; ".join(parts)))
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-#
-
-
class WSGIServer(HTTPServer):
"""BaseHTTPServer that implements the Python WSGI protocol"""
-
-
-
-
-
-
-
-
-
-
-
-
class WSGIRequestHandler(BaseHTTPRequestHandler):
server_version = "WSGIServer/" + __version__
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
def demo_app(environ,start_response):
from StringIO import StringIO
stdout = StringIO()
import webbrowser
webbrowser.open('http://localhost:8000/xyz?abc')
httpd.handle_request() # serve one request, then exit
-
-
-
-
-
-
-
-
-
-
-
-
-#
return data
raise StopIteration
-
-
-
-
-
-
-
def guess_scheme(environ):
"""Return a guess for whether 'wsgi.url_scheme' should be 'http' or 'https'
"""
-
_hoppish = {
'connection':1, 'keep-alive':1, 'proxy-authenticate':1,
'proxy-authorization':1, 'te':1, 'trailers':1, 'transfer-encoding':1,
def is_hop_by_hop(header_name):
"""Return true if 'header_name' is an HTTP/1.1 "Hop-by-Hop" header"""
return _hoppish(header_name.lower())
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-#
- Issue #7588: ``unittest.TextTestResult.getDescription`` now includes the test
name in failure reports even if the test has a docstring.
+- Issue #5801: removed spurious empty lines in wsgiref.
+
Extension Modules
-----------------