aboutsummaryrefslogtreecommitdiffstats
path: root/libmproxy/flow.py
diff options
context:
space:
mode:
authorAldo Cortesi <aldo@nullcube.com>2012-02-10 15:04:20 +1300
committerAldo Cortesi <aldo@nullcube.com>2012-02-10 15:04:20 +1300
commitb14c29b25c4c5754edf568bcbb6bbf5b70b6c310 (patch)
tree21cf7e00219ee4a1a79c368a3abcd64caa947d0a /libmproxy/flow.py
parent5326b7610a365d57ff06c0e72c739d2853b695f9 (diff)
downloadmitmproxy-b14c29b25c4c5754edf568bcbb6bbf5b70b6c310.tar.gz
mitmproxy-b14c29b25c4c5754edf568bcbb6bbf5b70b6c310.tar.bz2
mitmproxy-b14c29b25c4c5754edf568bcbb6bbf5b70b6c310.zip
Expand test coverage.
Diffstat (limited to 'libmproxy/flow.py')
-rw-r--r--libmproxy/flow.py18
1 files changed, 6 insertions, 12 deletions
diff --git a/libmproxy/flow.py b/libmproxy/flow.py
index beaa85ef..57a9310a 100644
--- a/libmproxy/flow.py
+++ b/libmproxy/flow.py
@@ -10,12 +10,6 @@ import controller, version
HDR_FORM_URLENCODED = "application/x-www-form-urlencoded"
-class RunException(Exception):
- def __init__(self, msg, returncode, errout):
- Exception.__init__(self, msg)
- self.returncode = returncode
- self.errout = errout
-
class ScriptContext:
def __init__(self, master):
@@ -398,10 +392,10 @@ class Request(HTTPMsg):
if not 'host' in headers:
headers["host"] = [self._hostport()]
content = self.content
- if content is not None:
- headers["content-length"] = [str(len(content))]
- else:
+ if content is None:
content = ""
+ else:
+ headers["content-length"] = [str(len(content))]
if self.close:
headers["connection"] = ["close"]
if not _proxy:
@@ -555,10 +549,10 @@ class Response(HTTPMsg):
['proxy-connection', 'connection', 'keep-alive', 'transfer-encoding']
)
content = self.content
- if content is not None:
- headers["content-length"] = [str(len(content))]
- else:
+ if content is None:
content = ""
+ else:
+ headers["content-length"] = [str(len(content))]
if self.request.client_conn.close:
headers["connection"] = ["close"]
proto = "HTTP/1.1 %s %s"%(self.code, str(self.msg))