components/python/websockify/patches/websockify-byte-order.patch
changeset 3652 7e731a1b0b39
child 3998 5bd484384122
equal deleted inserted replaced
3651:1ca146aae014 3652:7e731a1b0b39
       
     1 In-house developed patch.
       
     2 Internal bugdb id# 20202461
       
     3 Prevents inappropriate byte swapping of WebSocket frame data and
       
     4 and mask on big endian ISAs (like SPARC).
       
     5 Not Solaris specific. Suitable for upstream contribution.
       
     6 Bug and patch submitted upstream, waiting review:
       
     7 https://github.com/kanaka/websockify/issues/150
       
     8 
       
     9 --- websockify-0.5.1/websockify/websocket.py.orig	2014-10-13 14:59:26.382830765 -0700
       
    10 +++ websockify-0.5.1/websockify/websocket.py	2014-10-13 14:58:26.088075181 -0700
       
    11 @@ -241,9 +241,9 @@
       
    12          if numpy:
       
    13              b = c = s2b('')
       
    14              if plen >= 4:
       
    15 -                mask = numpy.frombuffer(buf, dtype=numpy.dtype('<u4'),
       
    16 +                mask = numpy.frombuffer(buf, dtype=numpy.dtype('u4'),
       
    17                          offset=hlen, count=1)
       
    18 -                data = numpy.frombuffer(buf, dtype=numpy.dtype('<u4'),
       
    19 +                data = numpy.frombuffer(buf, dtype=numpy.dtype('u4'),
       
    20                          offset=pstart, count=int(plen / 4))
       
    21                  #b = numpy.bitwise_xor(data, mask).data
       
    22                  b = numpy.bitwise_xor(data, mask).tostring()