diff options
author | Aldo Cortesi <aldo@nullcube.com> | 2012-06-19 13:23:07 +1200 |
---|---|---|
committer | Aldo Cortesi <aldo@nullcube.com> | 2012-06-19 13:23:07 +1200 |
commit | a700721891e028aacc867001a715a8f7d9cbf223 (patch) | |
tree | 1ed752611078a36f202f2c1defdd96ccf302a335 /libpathod/pathod.py | |
parent | bd99a13f3965bfdd09a58020424c3b36d97f6877 (diff) | |
download | mitmproxy-a700721891e028aacc867001a715a8f7d9cbf223.tar.gz mitmproxy-a700721891e028aacc867001a715a8f7d9cbf223.tar.bz2 mitmproxy-a700721891e028aacc867001a715a8f7d9cbf223.zip |
Porting to netlib proceeds apace.
Diffstat (limited to 'libpathod/pathod.py')
-rw-r--r-- | libpathod/pathod.py | 23 |
1 files changed, 17 insertions, 6 deletions
diff --git a/libpathod/pathod.py b/libpathod/pathod.py index f712582e..c700b550 100644 --- a/libpathod/pathod.py +++ b/libpathod/pathod.py @@ -1,14 +1,25 @@ -import netlib +from netlib import tcp, protocol, odict -class PathodHandler(netlib.BaseHandler): +class PathodHandler(tcp.BaseHandler): def handle(self): - print "Here" + line = self.rfile.readline() + if line == "\r\n" or line == "\n": # Possible leftover from previous message + line = self.rfile.readline() + if line == "": + return None + method, path, httpversion = protocol.parse_init_http(line) + headers = odict.ODictCaseless(protocol.read_headers(self.rfile)) + content = protocol.read_http_body_request( + self.rfile, self.wfile, headers, httpversion, None + ) + print method, path, httpversion + #return flow.Request(client_conn, httpversion, host, port, "http", method, path, headers, content) -class PathodServer(netlib.TCPServer): + +class Pathod(tcp.TCPServer): def __init__(self, addr): - netlib.TCPServer.__init__(self, addr) + tcp.TCPServer.__init__(self, addr) def handle_connection(self, request, client_address): PathodHandler(request, client_address, self) - |