pbrady pushed to python-websockify (epel7). "add missing patch from previous commit"

notifications at fedoraproject.org notifications at fedoraproject.org
Wed Apr 29 13:15:57 UTC 2015


>From 624e162e7a47f335e20937364ec796e06d0abbb3 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?P=C3=A1draig=20Brady?= <P at draigBrady.com>
Date: Wed, 29 Apr 2015 14:08:04 +0100
Subject: add missing patch from previous commit


diff --git a/big-endian.patch b/big-endian.patch
new file mode 100644
index 0000000..8235f62
--- /dev/null
+++ b/big-endian.patch
@@ -0,0 +1,53 @@
+From af10f458a1590691e4c2f03a499d6c22fdf81cfe Mon Sep 17 00:00:00 2001
+From: Rafael Folco <rafaelfolco at gmail.com>
+Date: Wed, 25 Mar 2015 01:20:25 -0300
+Subject: [PATCH] BUGFIX:  Websocket frame corruption on big-endian #150
+
+This patch fixes noVNC endianess problem on handshake.
+It affects noVNC sessions on Big Endian platforms.
+
+Fixes #150
+---
+ websockify/websocket.py | 20 ++++++++++++--------
+ 1 file changed, 12 insertions(+), 8 deletions(-)
+
+diff --git a/websockify/websocket.py b/websockify/websocket.py
+index 1b3dca9..de56af3 100644
+--- a/websockify/websocket.py
++++ b/websockify/websocket.py
+@@ -118,20 +118,24 @@ class WebSocketRequestHandler(SimpleHTTPRequestHandler):
+         if numpy:
+             b = c = s2b('')
+             if plen >= 4:
+-                mask = numpy.frombuffer(buf, dtype=numpy.dtype('<u4'),
+-                        offset=hlen, count=1)
+-                data = numpy.frombuffer(buf, dtype=numpy.dtype('<u4'),
+-                        offset=pstart, count=int(plen / 4))
++                dtype=numpy.dtype('<u4')
++                if sys.byteorder == 'big':
++                    dtype = dtype.newbyteorder('>')
++                mask = numpy.frombuffer(buf, dtype, offset=hlen, count=1)
++                data = numpy.frombuffer(buf, dtype, offset=pstart,
++                        count=int(plen / 4))
+                 #b = numpy.bitwise_xor(data, mask).data
+                 b = numpy.bitwise_xor(data, mask).tostring()
+ 
+             if plen % 4:
+                 #self.msg("Partial unmask")
+-                mask = numpy.frombuffer(buf, dtype=numpy.dtype('B'),
+-                        offset=hlen, count=(plen % 4))
+-                data = numpy.frombuffer(buf, dtype=numpy.dtype('B'),
+-                        offset=pend - (plen % 4),
++                dtype=numpy.dtype('B')
++                if sys.byteorder == 'big':
++                    dtype = dtype.newbyteorder('>')
++                mask = numpy.frombuffer(buf, dtype, offset=hlen,
+                         count=(plen % 4))
++                data = numpy.frombuffer(buf, dtype,
++                        offset=pend - (plen % 4), count=(plen % 4))
+                 c = numpy.bitwise_xor(data, mask).tostring()
+             return b + c
+         else:
+-- 
+2.3.4
+
-- 
cgit v0.10.2


	http://pkgs.fedoraproject.org/cgit/python-websockify.git/commit/?h=epel7&id=624e162e7a47f335e20937364ec796e06d0abbb3


More information about the scm-commits mailing list