diff --git a/libmproxy/proxy.py b/libmproxy/proxy.py index 916d18eb5..362d622dd 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"], diff --git a/test/test_flow.py b/test/test_flow.py index b7a368d27..6ee4235eb 100644 --- a/test/test_flow.py +++ b/test/test_flow.py @@ -385,6 +385,7 @@ class uSerialize(libpry.AutoTree): def test_roundtrip(self): sio = StringIO() f = tutils.tflow() + f.request.content = "".join(chr(i) for i in range(255)) w = flow.FlowWriter(sio) w.add(f) @@ -392,7 +393,10 @@ class uSerialize(libpry.AutoTree): r = flow.FlowReader(sio) l = list(r.stream()) assert len(l) == 1 - assert l[0] == f + + f2 = l[0] + assert f2 == f + assert f2.request.assemble() == f.request.assemble() def test_load_flows(self): r = self._treader()