diff options
author | Aldo Cortesi <aldo@nullcube.com> | 2013-02-27 09:07:16 +1300 |
---|---|---|
committer | Aldo Cortesi <aldo@nullcube.com> | 2013-02-27 09:07:16 +1300 |
commit | 9167b9b8b6f9235f4d4c5c3cf838dd7927a10116 (patch) | |
tree | 9553958df0e30147285fe1ca82a059d09035ee7f /libpathod | |
parent | 25656f488929a7c74d65a1f86cdc3bccbf8ca2c4 (diff) | |
download | mitmproxy-9167b9b8b6f9235f4d4c5c3cf838dd7927a10116.tar.gz mitmproxy-9167b9b8b6f9235f4d4c5c3cf838dd7927a10116.tar.bz2 mitmproxy-9167b9b8b6f9235f4d4c5c3cf838dd7927a10116.zip |
Make pathoc request return more human-friendly.
Diffstat (limited to 'libpathod')
-rw-r--r-- | libpathod/pathoc.py | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/libpathod/pathoc.py b/libpathod/pathoc.py index 0a3e8d06..650aa42a 100644 --- a/libpathod/pathoc.py +++ b/libpathod/pathoc.py @@ -6,6 +6,12 @@ import language, utils class PathocError(Exception): pass +class Response: + def __init__(self, httpversion, status_code, msg, headers, content): + self.httpversion, self.status_code, self.msg = httpversion, status_code, msg + self.headers, self.content = headers, content + + class Pathoc(tcp.TCPClient): def __init__(self, host, port, ssl=None, sni=None, clientcert=None): tcp.TCPClient.__init__(self, host, port) @@ -49,7 +55,7 @@ class Pathoc(tcp.TCPClient): r = language.parse_request(self.settings, spec) ret = language.serve(r, self.wfile, self.settings, self.host) self.wfile.flush() - return http.read_response(self.rfile, r.method, None) + return Response(*http.read_response(self.rfile, r.method, None)) def _show_summary(self, fp, httpversion, code, msg, headers, content): print >> fp, "<< %s %s: %s bytes"%(code, utils.xrepr(msg), len(content)) |