diff options
author | Aldo Cortesi <aldo@nullcube.com> | 2011-02-16 14:33:04 +1300 |
---|---|---|
committer | Aldo Cortesi <aldo@nullcube.com> | 2011-02-16 14:33:04 +1300 |
commit | 0c6f846861f537e5ebf61a1c3ac536ca04fa5892 (patch) | |
tree | 5fbf3d92b4134ec32b3f0ea73e7d71333fa80e3d /libmproxy/proxy.py | |
parent | 5692c7359c7c468e1ee35f9bdd3b7b92fd67592c (diff) | |
download | mitmproxy-0c6f846861f537e5ebf61a1c3ac536ca04fa5892.tar.gz mitmproxy-0c6f846861f537e5ebf61a1c3ac536ca04fa5892.tar.bz2 mitmproxy-0c6f846861f537e5ebf61a1c3ac536ca04fa5892.zip |
First draft of the new serialization mechanism.
Diffstat (limited to 'libmproxy/proxy.py')
-rw-r--r-- | libmproxy/proxy.py | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/libmproxy/proxy.py b/libmproxy/proxy.py index 0941155f..ba47ce7b 100644 --- a/libmproxy/proxy.py +++ b/libmproxy/proxy.py @@ -5,7 +5,7 @@ Development started from Neil Schemenauer's munchy.py """ -import sys, os, time, string, socket, urlparse, re, select, copy +import sys, os, time, string, socket, urlparse, re, select, copy, base64 import SocketServer, ssl import utils, controller @@ -147,7 +147,7 @@ class Request(controller.Msg): method = self.method, path = self.path, headers = self.headers.get_state(), - content = self.content, + content = base64.encodestring(self.content), timestamp = self.timestamp, ) @@ -161,7 +161,7 @@ class Request(controller.Msg): state["method"], state["path"], utils.Headers.from_state(state["headers"]), - state["content"], + base64.decodestring(state["content"]), state["timestamp"] ) @@ -242,7 +242,7 @@ class Response(controller.Msg): msg = self.msg, headers = self.headers.get_state(), timestamp = self.timestamp, - content = self.content + content = base64.encodestring(self.content) ) @classmethod @@ -252,7 +252,7 @@ class Response(controller.Msg): state["code"], state["msg"], utils.Headers.from_state(state["headers"]), - state["content"], + base64.decodestring(state["content"]), state["timestamp"], ) @@ -307,7 +307,7 @@ class ClientConnection(controller.Msg): controller.Msg.__init__(self) def get_state(self): - return self.address + return list(self.address) @classmethod def from_state(klass, state): |