diff options
Diffstat (limited to 'libpathod/protocols/http.py')
-rw-r--r-- | libpathod/protocols/http.py | 18 |
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"") |