components/python/websockify/patches/websockify-byte-order.patch
changeset 3652 7e731a1b0b39
child 3998 5bd484384122
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/components/python/websockify/patches/websockify-byte-order.patch	Tue Jan 20 14:02:18 2015 -0800
@@ -0,0 +1,22 @@
+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()