diff options
author | Aldo Cortesi <aldo@nullcube.com> | 2014-02-07 10:50:23 +1300 |
---|---|---|
committer | Aldo Cortesi <aldo@nullcube.com> | 2014-02-07 10:50:23 +1300 |
commit | 3d52d16e8d7b298363ef6d6f7279d75fb4b1a430 (patch) | |
tree | 5b793cc821b531a3fcedf511b9315346f6c7e014 /netlib/wsgi.py | |
parent | 404d4bbc69d9f2eb12664415ebca44a95ce96e56 (diff) | |
parent | 7fc544bc7ff8fd610ba9db92c0d3b59a0b040b5b (diff) | |
download | mitmproxy-3d52d16e8d7b298363ef6d6f7279d75fb4b1a430.tar.gz mitmproxy-3d52d16e8d7b298363ef6d6f7279d75fb4b1a430.tar.bz2 mitmproxy-3d52d16e8d7b298363ef6d6f7279d75fb4b1a430.zip |
Merge branch 'tcp_proxy'
Diffstat (limited to 'netlib/wsgi.py')
-rw-r--r-- | netlib/wsgi.py | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/netlib/wsgi.py b/netlib/wsgi.py index 647cb899..b576bdff 100644 --- a/netlib/wsgi.py +++ b/netlib/wsgi.py @@ -1,17 +1,22 @@ import cStringIO, urllib, time, traceback -import odict +import odict, tcp class ClientConn: def __init__(self, address): - self.address = address + self.address = tcp.Address.wrap(address) + + +class Flow: + def __init__(self, client_conn): + self.client_conn = client_conn class Request: def __init__(self, client_conn, scheme, method, path, headers, content): self.scheme, self.method, self.path = scheme, method, path self.headers, self.content = headers, content - self.client_conn = client_conn + self.flow = Flow(client_conn) def date_time_string(): @@ -60,8 +65,8 @@ class WSGIAdaptor: 'SERVER_PROTOCOL': "HTTP/1.1", } environ.update(extra) - if request.client_conn.address: - environ["REMOTE_ADDR"], environ["REMOTE_PORT"] = request.client_conn.address + if request.flow.client_conn.address: + environ["REMOTE_ADDR"], environ["REMOTE_PORT"] = request.flow.client_conn.address() for key, value in request.headers.items(): key = 'HTTP_' + key.upper().replace('-', '_') |