From 0c6f846861f537e5ebf61a1c3ac536ca04fa5892 Mon Sep 17 00:00:00 2001 From: Aldo Cortesi Date: Wed, 16 Feb 2011 14:33:04 +1300 Subject: First draft of the new serialization mechanism. --- libmproxy/proxy.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'libmproxy/proxy.py') 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): -- cgit v1.2.3