aboutsummaryrefslogtreecommitdiffstats
path: root/libmproxy/proxy.py
diff options
context:
space:
mode:
authorAldo Cortesi <aldo@nullcube.com>2012-06-10 13:27:43 +1200
committerAldo Cortesi <aldo@nullcube.com>2012-06-10 13:27:43 +1200
commit6ba5f0f35bcd37dbd15e0f7f78da183a802f6193 (patch)
tree03df678908ed62493520a7bf7b0800bd19574bf2 /libmproxy/proxy.py
parent52779d9db98dff042a0b2b5dca97440b520367df (diff)
downloadmitmproxy-6ba5f0f35bcd37dbd15e0f7f78da183a802f6193.tar.gz
mitmproxy-6ba5f0f35bcd37dbd15e0f7f78da183a802f6193.tar.bz2
mitmproxy-6ba5f0f35bcd37dbd15e0f7f78da183a802f6193.zip
Add HTTP version to response objects.
Another change in the serialization format.
Diffstat (limited to 'libmproxy/proxy.py')
-rw-r--r--libmproxy/proxy.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/libmproxy/proxy.py b/libmproxy/proxy.py
index 3be20761..7698a61f 100644
--- a/libmproxy/proxy.py
+++ b/libmproxy/proxy.py
@@ -309,6 +309,9 @@ class ServerConnection:
if not len(parts) == 3:
raise ProxyError(502, "Invalid server response: %s."%line)
proto, code, msg = parts
+ httpversion = parse_http_protocol(proto)
+ if httpversion is None:
+ raise ProxyError(502, "Invalid HTTP version: %s."%httpversion)
try:
code = int(code)
except ValueError:
@@ -320,7 +323,7 @@ class ServerConnection:
content = ""
else:
content = read_http_body(self.rfile, self, headers, True, self.config.body_size_limit)
- return flow.Response(request, code, msg, headers, content, self.cert)
+ return flow.Response(request, httpversion, code, msg, headers, content, self.cert)
def terminate(self):
try: