aboutsummaryrefslogtreecommitdiffstats
path: root/libpathod/pathod.py
diff options
context:
space:
mode:
authorAldo Cortesi <aldo@nullcube.com>2012-10-25 10:59:18 +1300
committerAldo Cortesi <aldo@nullcube.com>2012-10-25 10:59:18 +1300
commit6174e46023e798517ac206b7681dd9c7d36b1283 (patch)
tree77909d09a82834be448903d7d0ef97de5439f0a4 /libpathod/pathod.py
parent173b5c596e72700544f0252040adf3cbe8ebcb50 (diff)
downloadmitmproxy-6174e46023e798517ac206b7681dd9c7d36b1283.tar.gz
mitmproxy-6174e46023e798517ac206b7681dd9c7d36b1283.tar.bz2
mitmproxy-6174e46023e798517ac206b7681dd9c7d36b1283.zip
Unit test suite love: 100% coverage
Also start figuring out how to sanitize binary data in the JSON API.
Diffstat (limited to 'libpathod/pathod.py')
-rw-r--r--libpathod/pathod.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/libpathod/pathod.py b/libpathod/pathod.py
index 9d343a51..d4535d03 100644
--- a/libpathod/pathod.py
+++ b/libpathod/pathod.py
@@ -1,4 +1,4 @@
-import urllib, threading, re, logging, socket, sys
+import urllib, threading, re, logging, socket, sys, base64
from netlib import tcp, http, odict, wsgi
import netlib.utils
import version, app, language
@@ -149,10 +149,10 @@ class PathodHandler(tcp.BaseHandler):
again, log = self.handle_request()
if log:
if self.server.logreq:
- log["request_bytes"] = self.rfile.get_log()
+ log["request_bytes"] = self.rfile.get_log().encode("string_escape")
self._log_bytes("Request", log["request_bytes"], self.server.hexdump)
if self.server.logresp:
- log["response_bytes"] = self.wfile.get_log()
+ log["response_bytes"] = self.wfile.get_log().encode("string_escape")
self._log_bytes("Response", log["response_bytes"], self.server.hexdump)
self.server.add_log(log)
if not again: