diff options
Diffstat (limited to 'netlib/websockets')
-rw-r--r-- | netlib/websockets/frame.py | 2 | ||||
-rw-r--r-- | netlib/websockets/protocol.py | 25 |
2 files changed, 12 insertions, 15 deletions
diff --git a/netlib/websockets/frame.py b/netlib/websockets/frame.py index fce2c9d3..da5a97f3 100644 --- a/netlib/websockets/frame.py +++ b/netlib/websockets/frame.py @@ -14,7 +14,7 @@ from netlib import utils MAX_16_BIT_INT = (1 << 16) MAX_64_BIT_INT = (1 << 64) -DEFAULT=object() +DEFAULT = object() OPCODE = utils.BiDi( CONTINUE=0x00, diff --git a/netlib/websockets/protocol.py b/netlib/websockets/protocol.py index 940132ad..101d5484 100644 --- a/netlib/websockets/protocol.py +++ b/netlib/websockets/protocol.py @@ -1,18 +1,18 @@ +""" +Colleciton of utility functions that implement small portions of the RFC6455 +WebSockets Protocol Useful for building WebSocket clients and servers. +Emphassis is on readabilty, simplicity and modularity, not performance or +completeness +This is a work in progress and does not yet contain all the utilites need to +create fully complient client/servers # +Spec: https://tools.ietf.org/html/rfc6455 -# Colleciton of utility functions that implement small portions of the RFC6455 -# WebSockets Protocol Useful for building WebSocket clients and servers. -# -# Emphassis is on readabilty, simplicity and modularity, not performance or -# completeness -# -# This is a work in progress and does not yet contain all the utilites need to -# create fully complient client/servers # -# Spec: https://tools.ietf.org/html/rfc6455 +The magic sha that websocket servers must know to prove they understand +RFC6455 +""" -# The magic sha that websocket servers must know to prove they understand -# RFC6455 from __future__ import absolute_import import base64 import hashlib @@ -94,21 +94,18 @@ class WebsocketsProtocol(object): upgrade="websocket" ) - @classmethod def check_client_handshake(self, headers): if headers.get("upgrade") != "websocket": return return headers.get("sec-websocket-key") - @classmethod def check_server_handshake(self, headers): if headers.get("upgrade") != "websocket": return return headers.get("sec-websocket-accept") - @classmethod def create_server_nonce(self, client_nonce): return base64.b64encode(hashlib.sha1(client_nonce + websockets_magic).digest()) |