diff options
author | Aldo Cortesi <aldo@nullcube.com> | 2012-06-24 21:10:10 +1200 |
---|---|---|
committer | Aldo Cortesi <aldo@nullcube.com> | 2012-06-24 21:10:10 +1200 |
commit | 90c6fb394de8b56c55aee3db7c7ea6ff72903456 (patch) | |
tree | 5985fc18ad5b384c6bc55af831c037fdc18ec187 /libpathod | |
parent | 8bec99f858deb8aaf35b6502355e3e00a98ffed7 (diff) | |
download | mitmproxy-90c6fb394de8b56c55aee3db7c7ea6ff72903456.tar.gz mitmproxy-90c6fb394de8b56c55aee3db7c7ea6ff72903456.tar.bz2 mitmproxy-90c6fb394de8b56c55aee3db7c7ea6ff72903456.zip |
Sketch out pathoc commandline interaction.
Diffstat (limited to 'libpathod')
-rw-r--r-- | libpathod/pathoc.py | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/libpathod/pathoc.py b/libpathod/pathoc.py new file mode 100644 index 00000000..5ad1bd26 --- /dev/null +++ b/libpathod/pathoc.py @@ -0,0 +1,22 @@ +from netlib import tcp, http +import rparse + + +class PathocError(Exception): pass + + +class Pathoc(tcp.TCPClient): + def __init__(self, ssl, host, port, clientcert): + try: + tcp.TCPClient.__init__(self, ssl, host, port, clientcert) + except tcp.NetLibError, v: + raise PathocError(v) + + def request(self, spec): + r = rparse.parse_request({}, spec) + r.serve(self.wfile) + self.wfile.flush() + + line = self.rfile.readline() + print line + |