aboutsummaryrefslogtreecommitdiffstats
path: root/netlib
diff options
context:
space:
mode:
authorMaximilian Hils <git@maximilianhils.com>2015-08-15 20:30:22 +0200
committerThomas Kriechbaumer <thomas@kriechbaumer.name>2015-08-18 21:07:38 +0200
commitc92dc1b8682ed15b68890f18c65b3f31122e9fa4 (patch)
treedb9946b237e44ad2cd570bde73ac9764b9fa9cfb /netlib
parent3d306671251723a781b6e69c826bb94117f86188 (diff)
downloadmitmproxy-c92dc1b8682ed15b68890f18c65b3f31122e9fa4.tar.gz
mitmproxy-c92dc1b8682ed15b68890f18c65b3f31122e9fa4.tar.bz2
mitmproxy-c92dc1b8682ed15b68890f18c65b3f31122e9fa4.zip
re-add form_out
Diffstat (limited to 'netlib')
-rw-r--r--netlib/http/semantics.py12
-rw-r--r--netlib/tcp.py2
2 files changed, 10 insertions, 4 deletions
diff --git a/netlib/http/semantics.py b/netlib/http/semantics.py
index 76213cd1..5b7fb80f 100644
--- a/netlib/http/semantics.py
+++ b/netlib/http/semantics.py
@@ -59,6 +59,7 @@ class Request(object):
body=None,
timestamp_start=None,
timestamp_end=None,
+ form_out=None
):
if not headers:
headers = odict.ODictCaseless()
@@ -75,6 +76,7 @@ class Request(object):
self.body = body
self.timestamp_start = timestamp_start
self.timestamp_end = timestamp_end
+ self.form_out = form_out or form_in
def __eq__(self, other):
try:
@@ -91,15 +93,17 @@ class Request(object):
self.legacy_first_line()[:-9]
)
- def legacy_first_line(self):
- if self.form_in == "relative":
+ def legacy_first_line(self, form=None):
+ if form is None:
+ form = self.form_out
+ if form == "relative":
return '%s %s HTTP/%s.%s' % (
self.method,
self.path,
self.httpversion[0],
self.httpversion[1],
)
- elif self.form_in == "authority":
+ elif form == "authority":
return '%s %s:%s HTTP/%s.%s' % (
self.method,
self.host,
@@ -107,7 +111,7 @@ class Request(object):
self.httpversion[0],
self.httpversion[1],
)
- elif self.form_in == "absolute":
+ elif form == "absolute":
return '%s %s://%s:%s%s HTTP/%s.%s' % (
self.method,
self.scheme,
diff --git a/netlib/tcp.py b/netlib/tcp.py
index b3171a1c..22cd0965 100644
--- a/netlib/tcp.py
+++ b/netlib/tcp.py
@@ -310,6 +310,8 @@ class Address(object):
return str(self.address)
def __eq__(self, other):
+ if not other:
+ return False
other = Address.wrap(other)
return (self.address, self.family) == (other.address, other.family)