aboutsummaryrefslogtreecommitdiffstats
path: root/netlib/wsgi.py
diff options
context:
space:
mode:
authorMaximilian Hils <git@maximilianhils.com>2014-01-09 01:57:50 +0100
committerMaximilian Hils <git@maximilianhils.com>2014-01-09 01:57:50 +0100
commitb0b93d1c3e489cfeaf89bf5741e923c4388ab45a (patch)
tree69c17045c7f5f2fffa3b31c645e16eeaf5501bea /netlib/wsgi.py
parent951f2d517fa2e464d654a54bebacbd983f944c62 (diff)
parentac1a700fa16e2ae2146425844823bff70cc86f4b (diff)
downloadmitmproxy-b0b93d1c3e489cfeaf89bf5741e923c4388ab45a.tar.gz
mitmproxy-b0b93d1c3e489cfeaf89bf5741e923c4388ab45a.tar.bz2
mitmproxy-b0b93d1c3e489cfeaf89bf5741e923c4388ab45a.zip
Merge remote-tracking branch 'origin/master' into tcp_proxy
Diffstat (limited to 'netlib/wsgi.py')
-rw-r--r--netlib/wsgi.py7
1 files changed, 4 insertions, 3 deletions
diff --git a/netlib/wsgi.py b/netlib/wsgi.py
index dffc2ace..647cb899 100644
--- a/netlib/wsgi.py
+++ b/netlib/wsgi.py
@@ -33,7 +33,7 @@ class WSGIAdaptor:
def __init__(self, app, domain, port, sversion):
self.app, self.domain, self.port, self.sversion = app, domain, port, sversion
- def make_environ(self, request, errsoc):
+ def make_environ(self, request, errsoc, **extra):
if '?' in request.path:
path_info, query = request.path.split('?', 1)
else:
@@ -59,6 +59,7 @@ class WSGIAdaptor:
# FIXME: We need to pick up the protocol read from the request.
'SERVER_PROTOCOL': "HTTP/1.1",
}
+ environ.update(extra)
if request.client_conn.address:
environ["REMOTE_ADDR"], environ["REMOTE_PORT"] = request.client_conn.address
@@ -86,7 +87,7 @@ class WSGIAdaptor:
soc.write("\r\n")
soc.write(c)
- def serve(self, request, soc):
+ def serve(self, request, soc, **env):
state = dict(
response_started = False,
headers_sent = False,
@@ -123,7 +124,7 @@ class WSGIAdaptor:
errs = cStringIO.StringIO()
try:
- dataiter = self.app(self.make_environ(request, errs), start_response)
+ dataiter = self.app(self.make_environ(request, errs, **env), start_response)
for i in dataiter:
write(i)
if not state["headers_sent"]: