diff options
author | Aldo Cortesi <aldo@nullcube.com> | 2012-06-19 14:23:22 +1200 |
---|---|---|
committer | Aldo Cortesi <aldo@nullcube.com> | 2012-06-19 14:23:22 +1200 |
commit | ce1ef554561d55a414961993dcaf8f11000d1f22 (patch) | |
tree | 150d207891eb3ad877a12fea170618af545bb70c /netlib | |
parent | c7e9051cbbee1e76abb24518268d30a24df3a16a (diff) | |
download | mitmproxy-ce1ef554561d55a414961993dcaf8f11000d1f22.tar.gz mitmproxy-ce1ef554561d55a414961993dcaf8f11000d1f22.tar.bz2 mitmproxy-ce1ef554561d55a414961993dcaf8f11000d1f22.zip |
Adapt WSGI, convert test suite to nose.
Diffstat (limited to 'netlib')
-rw-r--r-- | netlib/wsgi.py | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/netlib/wsgi.py b/netlib/wsgi.py index 0608245c..3c3a8384 100644 --- a/netlib/wsgi.py +++ b/netlib/wsgi.py @@ -1,6 +1,19 @@ import cStringIO, urllib, time, sys, traceback import odict + +class ClientConn: + def __init__(self, address): + self.address = address + + +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 + + def date_time_string(): """Return the current date and time formatted for a message header.""" WEEKS = ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'] @@ -85,7 +98,7 @@ class WSGIAdaptor: soc.write("HTTP/1.1 %s\r\n"%state["status"]) h = state["headers"] if 'server' not in h: - h["Server"] = [version.NAMEVERSION] + h["Server"] = [self.sversion] if 'date' not in h: h["Date"] = [date_time_string()] soc.write(str(h)) |