Commit 48f26d79 authored by Joel Martin's avatar Joel Martin

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.
parent ec40268e
......@@ -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('<L4'),
mask = numpy.frombuffer(buf, dtype=numpy.dtype('<u4'),
offset=f['hlen'], count=1)
data = numpy.frombuffer(buf, dtype=numpy.dtype('<L4'),
data = numpy.frombuffer(buf, dtype=numpy.dtype('<u4'),
offset=f['hlen'] + 4, count=int(f['length'] / 4))
#b = numpy.bitwise_xor(data, mask).data
b = numpy.bitwise_xor(data, mask).tostring()
......@@ -615,7 +614,9 @@ Sec-WebSocket-Accept: %s\r
if sys.hexversion < 0x2060000 or not numpy:
raise self.EClose("Python >= 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)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment