aboutsummaryrefslogtreecommitdiffstats
path: root/netlib/websockets/masker.py
diff options
context:
space:
mode:
authorAldo Cortesi <aldo@nullcube.com>2016-10-20 11:56:38 +1300
committerAldo Cortesi <aldo@nullcube.com>2016-10-20 11:56:38 +1300
commit8430f857b504a3e7406dc36e54dc32783569d0dd (patch)
treed3116cd540faf01f272a0892fc6a9b83b4f6de8a /netlib/websockets/masker.py
parent853e03a5e753354fad3a3fa5384ef3a09384ef43 (diff)
downloadmitmproxy-8430f857b504a3e7406dc36e54dc32783569d0dd.tar.gz
mitmproxy-8430f857b504a3e7406dc36e54dc32783569d0dd.tar.bz2
mitmproxy-8430f857b504a3e7406dc36e54dc32783569d0dd.zip
The final piece: netlib -> mitproxy.net
Diffstat (limited to 'netlib/websockets/masker.py')
-rw-r--r--netlib/websockets/masker.py25
1 files changed, 0 insertions, 25 deletions
diff --git a/netlib/websockets/masker.py b/netlib/websockets/masker.py
deleted file mode 100644
index 47b1a688..00000000
--- a/netlib/websockets/masker.py
+++ /dev/null
@@ -1,25 +0,0 @@
-class Masker:
- """
- Data sent from the server must be masked to prevent malicious clients
- from sending data over the wire in predictable patterns.
-
- Servers do not have to mask data they send to the client.
- https://tools.ietf.org/html/rfc6455#section-5.3
- """
-
- def __init__(self, key):
- self.key = key
- self.offset = 0
-
- def mask(self, offset, data):
- result = bytearray(data)
- for i in range(len(data)):
- result[i] ^= self.key[offset % 4]
- offset += 1
- result = bytes(result)
- return result
-
- def __call__(self, data):
- ret = self.mask(self.offset, data)
- self.offset += len(ret)
- return ret