diff options
author | Aldo Cortesi <aldo@nullcube.com> | 2016-06-01 11:12:10 +1200 |
---|---|---|
committer | Aldo Cortesi <aldo@nullcube.com> | 2016-06-01 11:12:10 +1200 |
commit | 44fdcb4b8291a5be6738f32d6fde307af3f2034e (patch) | |
tree | 64a4a2cfa6295d0a367d5484a0d86bc5e22ab779 /netlib/http/http2/connections.py | |
parent | be644453649f0b0cf84822ad9de566b7dc744873 (diff) | |
download | mitmproxy-44fdcb4b8291a5be6738f32d6fde307af3f2034e.tar.gz mitmproxy-44fdcb4b8291a5be6738f32d6fde307af3f2034e.tar.bz2 mitmproxy-44fdcb4b8291a5be6738f32d6fde307af3f2034e.zip |
Reorganise netlib imports according to Google Style Guide
Diffstat (limited to 'netlib/http/http2/connections.py')
-rw-r--r-- | netlib/http/http2/connections.py | 23 |
1 files changed, 13 insertions, 10 deletions
diff --git a/netlib/http/http2/connections.py b/netlib/http/http2/connections.py index 16bdf618..8667d370 100644 --- a/netlib/http/http2/connections.py +++ b/netlib/http/http2/connections.py @@ -5,9 +5,12 @@ import time import hyperframe.frame from hpack.hpack import Encoder, Decoder -from ... import utils -from .. import Headers, Response, Request, url -from . import framereader +from netlib import utils +from netlib.http import url +import netlib.http.headers +import netlib.http.response +import netlib.http.request +from netlib.http.http2 import framereader class TCPHandler(object): @@ -128,7 +131,7 @@ class HTTP2Protocol(object): port = 80 if scheme == 'http' else 443 port = int(port) - request = Request( + request = netlib.http.request.Request( first_line_format, method.encode('ascii'), scheme.encode('ascii'), @@ -176,7 +179,7 @@ class HTTP2Protocol(object): else: timestamp_end = None - response = Response( + response = netlib.http.response.Response( b"HTTP/2.0", int(headers.get(':status', 502)), b'', @@ -190,15 +193,15 @@ class HTTP2Protocol(object): return response def assemble(self, message): - if isinstance(message, Request): + if isinstance(message, netlib.http.request.Request): return self.assemble_request(message) - elif isinstance(message, Response): + elif isinstance(message, netlib.http.response.Response): return self.assemble_response(message) else: raise ValueError("HTTP message not supported.") def assemble_request(self, request): - assert isinstance(request, Request) + assert isinstance(request, netlib.http.request.Request) authority = self.tcp_handler.sni if self.tcp_handler.sni else self.tcp_handler.address.host if self.tcp_handler.address.port != 443: @@ -222,7 +225,7 @@ class HTTP2Protocol(object): self._create_body(request.body, stream_id))) def assemble_response(self, response): - assert isinstance(response, Response) + assert isinstance(response, netlib.http.response.Response) headers = response.headers.copy() @@ -422,7 +425,7 @@ class HTTP2Protocol(object): else: self._handle_unexpected_frame(frm) - headers = Headers( + headers = netlib.http.headers.Headers( (k.encode('ascii'), v.encode('ascii')) for k, v in self.decoder.decode(header_blocks) ) |