From 48f26d799f374cda876cba389799c42ed6e49890 Mon Sep 17 00:00:00 2001 From: Joel Martin Date: Wed, 24 Aug 2011 13:26:28 -0500 Subject: [PATCH] websockify: pull HyBi fixes. Pull 86af0b614d and 7b496ce5b from websockify. Fix HyBi support on 64-bit systems. https://github.com/kanaka/noVNC/issues/76 - cleanup/update TODO. - remove explicit check for ctypes module for HyBi. Clarify that we support HyBi 07-10. HyBi 07 reports version 7 in the handshake. HyBi 08-10 report version 8 in the handshake. Remove version 9 since that is not yet actually defined. --- utils/websocket.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/utils/websocket.py b/utils/websocket.py index 36f64ef3..8ae64d7f 100644 --- a/utils/websocket.py +++ b/utils/websocket.py @@ -8,7 +8,7 @@ Licensed under LGPL version 3 (see docs/LICENSE.LGPL-3) Supports following protocol versions: - http://tools.ietf.org/html/draft-hixie-thewebsocketprotocol-75 - http://tools.ietf.org/html/draft-hixie-thewebsocketprotocol-76 - - http://tools.ietf.org/html/draft-ietf-hybi-thewebsocketprotocol-07 + - http://tools.ietf.org/html/draft-ietf-hybi-thewebsocketprotocol-10 You can make a cert/key with openssl using: openssl req -new -x509 -days 365 -nodes -out self.pem -keyout self.pem @@ -49,8 +49,7 @@ else: # Degraded functionality if these imports are missing for mod, sup in [('numpy', 'HyBi protocol'), - ('ctypes', 'HyBi protocol'), ('ssl', 'TLS/SSL/wss'), - ('resource', 'daemonizing')]: + ('ssl', 'TLS/SSL/wss'), ('resource', 'daemonizing')]: try: globals()[mod] = __import__(mod) except ImportError: @@ -298,9 +297,9 @@ Sec-WebSocket-Accept: %s\r f['mask'] = buf[f['hlen']:f['hlen']+4] b = c = '' if f['length'] >= 4: - mask = numpy.frombuffer(buf, dtype=numpy.dtype('= 2.6 and numpy module is required for HyBi-07 or greater") - if ver in ['7', '8', '9']: + # HyBi-07 report version 7 + # HyBi-08 - HyBi-10 report version 8 + if ver in ['7', '8']: self.version = "hybi-0" + ver else: raise self.EClose('Unsupported protocol version %s' % ver)