aboutsummaryrefslogtreecommitdiffstats
path: root/libpathod/protocols/http.py
diff options
context:
space:
mode:
authorMaximilian Hils <git@maximilianhils.com>2015-09-16 18:44:34 +0200
committerMaximilian Hils <git@maximilianhils.com>2015-09-16 18:44:34 +0200
commit9f26d68f47bc7729b0727ed67253503e047ea0f9 (patch)
tree50178b4346384ec12e2ae3fd41b508a06d68f1c8 /libpathod/protocols/http.py
parentb889e9e1a2576b0f0aadb4180dd6f4c75db204d6 (diff)
downloadmitmproxy-9f26d68f47bc7729b0727ed67253503e047ea0f9.tar.gz
mitmproxy-9f26d68f47bc7729b0727ed67253503e047ea0f9.tar.bz2
mitmproxy-9f26d68f47bc7729b0727ed67253503e047ea0f9.zip
adjust to netlib changes
Diffstat (limited to 'libpathod/protocols/http.py')
-rw-r--r--libpathod/protocols/http.py18
1 files changed, 10 insertions, 8 deletions
diff --git a/libpathod/protocols/http.py b/libpathod/protocols/http.py
index 0539b68d..ac6cb374 100644
--- a/libpathod/protocols/http.py
+++ b/libpathod/protocols/http.py
@@ -1,14 +1,12 @@
-from netlib import tcp, http, wsgi
-from netlib.http import http1
-from .. import version, app, language, utils, log
+from netlib import tcp, wsgi
+from netlib.exceptions import HttpReadDisconnect
+from netlib.http import http1, Request
+from .. import version, language
-class HTTPProtocol:
+class HTTPProtocol(object):
def __init__(self, pathod_handler):
self.pathod_handler = pathod_handler
- self.wire_protocol = http1.HTTP1Protocol(
- self.pathod_handler
- )
def make_error_response(self, reason, body):
return language.http.make_error_response(reason, body)
@@ -70,4 +68,8 @@ class HTTPProtocol:
return self.pathod_handler.handle_http_request, None
def read_request(self, lg=None):
- return self.wire_protocol.read_request(allow_empty=True)
+ try:
+ return http1.read_request(self.pathod_handler.rfile)
+ except HttpReadDisconnect:
+ # TODO: This is
+ return Request("", b"", b"", b"", b"", b"", b"", None, b"")