components/python/websockify/patches/websockify-byte-order.patch
branchs11u2-sru
changeset 4156 4b1def16fe9b
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/components/python/websockify/patches/websockify-byte-order.patch	Mon Apr 20 12:35:51 2015 -0700
@@ -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.6.0/websockify/websocket.py.~1~	2014-02-18 14:03:09.000000000 -0800
++++ websockify-0.6.0/websockify/websocket.py	2015-02-25 02:02:30.561296598 -0800
+@@ -118,9 +118,9 @@ class WebSocketRequestHandler(SimpleHTTP
+         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()