aboutsummaryrefslogtreecommitdiffstats
path: root/libmproxy
diff options
context:
space:
mode:
authorAldo Cortesi <aldo@nullcube.com>2011-07-01 13:07:09 +1200
committerAldo Cortesi <aldo@nullcube.com>2011-07-01 14:20:42 +1200
commit8e176c2086bee1c83165b1000dd980fa62e3b51e (patch)
tree56dbb8b4234fe550ea2b2545ba3108ad4d8bbb6a /libmproxy
parent2a90ea69fd9d4d2427a13d3d1cd21ec1b6dc628f (diff)
downloadmitmproxy-8e176c2086bee1c83165b1000dd980fa62e3b51e.tar.gz
mitmproxy-8e176c2086bee1c83165b1000dd980fa62e3b51e.tar.bz2
mitmproxy-8e176c2086bee1c83165b1000dd980fa62e3b51e.zip
Cast some data read from dump files to str, to prevent unicode promotion.
This fixes a bug that caused a traceback when de-serialized requests were replayed. Also adds unit tests for the problem.
Diffstat (limited to 'libmproxy')
-rw-r--r--libmproxy/proxy.py10
1 files changed, 5 insertions, 5 deletions
diff --git a/libmproxy/proxy.py b/libmproxy/proxy.py
index 916d18eb..362d622d 100644
--- a/libmproxy/proxy.py
+++ b/libmproxy/proxy.py
@@ -198,11 +198,11 @@ class Request(controller.Msg):
def from_state(klass, state):
return klass(
ClientConnect.from_state(state["client_conn"]),
- state["host"],
+ str(state["host"]),
state["port"],
- state["scheme"],
- state["method"],
- state["path"],
+ str(state["scheme"]),
+ str(state["method"]),
+ str(state["path"]),
utils.Headers.from_state(state["headers"]),
base64.decodestring(state["content"]),
state["timestamp"]
@@ -353,7 +353,7 @@ class Response(controller.Msg):
return klass(
request,
state["code"],
- state["msg"],
+ str(state["msg"]),
utils.Headers.from_state(state["headers"]),
base64.decodestring(state["content"]),
state["timestamp"],