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/websockets | |
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/websockets')
-rw-r--r-- | netlib/websockets/frame.py | 6 | ||||
-rw-r--r-- | netlib/websockets/protocol.py | 9 |
2 files changed, 8 insertions, 7 deletions
diff --git a/netlib/websockets/frame.py b/netlib/websockets/frame.py index cf8917c1..deb0ce33 100644 --- a/netlib/websockets/frame.py +++ b/netlib/websockets/frame.py @@ -6,10 +6,10 @@ import warnings import six -from .protocol import Masker from netlib import tcp from netlib import utils from netlib import human +from netlib.websockets import protocol MAX_16_BIT_INT = (1 << 16) @@ -267,7 +267,7 @@ class Frame(object): """ b = bytes(self.header) if self.header.masking_key: - b += Masker(self.header.masking_key)(self.payload) + b += protocol.Masker(self.header.masking_key)(self.payload) else: b += self.payload return b @@ -296,7 +296,7 @@ class Frame(object): payload = fp.safe_read(header.payload_length) if header.mask == 1 and header.masking_key: - payload = Masker(header.masking_key)(payload) + payload = protocol.Masker(header.masking_key)(payload) return cls( payload, diff --git a/netlib/websockets/protocol.py b/netlib/websockets/protocol.py index 101d5484..c1b7be2c 100644 --- a/netlib/websockets/protocol.py +++ b/netlib/websockets/protocol.py @@ -19,7 +19,8 @@ import hashlib import os import six -from ..http import Headers + +from netlib import http websockets_magic = b'258EAFA5-E914-47DA-95CA-C5AB0DC85B11' VERSION = "13" @@ -72,11 +73,11 @@ class WebsocketsProtocol(object): specified, it is generated, and can be found in sec-websocket-key in the returned header set. - Returns an instance of Headers + Returns an instance of http.Headers """ if not key: key = base64.b64encode(os.urandom(16)).decode('ascii') - return Headers( + return http.Headers( sec_websocket_key=key, sec_websocket_version=version, connection="Upgrade", @@ -88,7 +89,7 @@ class WebsocketsProtocol(object): """ The server response is a valid HTTP 101 response. """ - return Headers( + return http.Headers( sec_websocket_accept=self.create_server_nonce(key), connection="Upgrade", upgrade="websocket" |