components/python/websockify/patches/websockify-byte-order.patch
author Niall Power <niall.power@oracle.com>
Tue, 20 Jan 2015 14:02:18 -0800
changeset 3652 7e731a1b0b39
child 3998 5bd484384122
permissions -rw-r--r--
PSARC/2014/377 noVNC - A browser based VNC client 19557488 The noVNC client should be added to Userland 20202461 Websockify is broken on SPARC because of unnecessary byte swapping 20202582 Solaris zones nova compute driver needs console access support

In-house developed patch.
Internal bugdb id# 20202461
Prevents inappropriate byte swapping of WebSocket frame data and
and mask on big endian ISAs (like SPARC).
Not Solaris specific. Suitable for upstream contribution.
Bug and patch submitted upstream, waiting review:
https://github.com/kanaka/websockify/issues/150

--- websockify-0.5.1/websockify/websocket.py.orig	2014-10-13 14:59:26.382830765 -0700
+++ websockify-0.5.1/websockify/websocket.py	2014-10-13 14:58:26.088075181 -0700
@@ -241,9 +241,9 @@
         if numpy:
             b = c = s2b('')
             if plen >= 4:
-                mask = numpy.frombuffer(buf, dtype=numpy.dtype('<u4'),
+                mask = numpy.frombuffer(buf, dtype=numpy.dtype('u4'),
                         offset=hlen, count=1)
-                data = numpy.frombuffer(buf, dtype=numpy.dtype('<u4'),
+                data = numpy.frombuffer(buf, dtype=numpy.dtype('u4'),
                         offset=pstart, count=int(plen / 4))
                 #b = numpy.bitwise_xor(data, mask).data
                 b = numpy.bitwise_xor(data, mask).tostring()