Xpra: Ticket #2104: support websockify > 0.8

They've moved things around..

Mon, 14 Jan 2019 06:23:58 GMT - Antoine Martin: attachment set

work in progress, needs guess_type()

Mon, 14 Jan 2019 15:36:13 GMT - Antoine Martin: status changed

Preliminary work in r21365.

They've changed something I struggle to figure out. Hitting the TCP port using wget:

Thu, 17 Jan 2019 15:55:29 GMT - Antoine Martin: attachment set

some changes required to run against the latest websockify

Tue, 22 Jan 2019 12:03:32 GMT - Antoine Martin:

Couldn't figure out what was going wrong, so bisected websockify instead:

Next commit is:

Tue, 22 Jan 2019 14:19:04 GMT - Antoine Martin:

So the first breakage comes from the changes to websocket.py diff-653cb1e48180f6007df323a009690197. This commit is huge, and it's not clear at all why calling socket.recv on the underlying tcp socket returns nothing... (even in blocking mode)

Meanwhile, this may have uncovered a bug in python-websocket-client:

Traceback (most recent call last):
  File "/usr/lib64/python2.7/site-packages/xpra/scripts/main.py", line 967, in connect_or_fail
    return connect_to(display_desc, opts)
  File "/usr/lib64/python2.7/site-packages/xpra/scripts/main.py", line 1098, in connect_to
    return websocket_client_connection(host, port, conn, dtype)
  File "/usr/lib64/python2.7/site-packages/xpra/net/websocket_connection.py", line 79, in websocket_client_connection
    ws = websocket.create_connection(url, SOCKET_TIMEOUT, subprotocols=subprotocols, socket=sock)
  File "/usr/lib/python2.7/site-packages/websocket/_core.py", line 502, in create_connection
    websock.connect(url, **options)
  File "/usr/lib/python2.7/site-packages/websocket/_core.py", line 222, in connect
    self.handshake_response = handshake(self.sock, *addrs, **options)
  File "/usr/lib/python2.7/site-packages/websocket/_handshake.py", line 70, in handshake
    success, subproto = _validate(resp, key, options.get("subprotocols"))
  File "/usr/lib/python2.7/site-packages/websocket/_handshake.py", line 160, in _validate
    subproto = headers.get("sec-websocket-protocol", None).lower()
AttributeError: 'NoneType' object has no attribute 'lower'

Change requested: https://github.com/websocket-client/websocket-client/compare/master...totaam:patch-1

Wed, 23 Jan 2019 07:07:01 GMT - Antoine Martin: description changed

Wed, 23 Jan 2019 09:56:31 GMT - Antoine Martin: description changed

Found that there were typos in that changeset: self._sendmg should be self._sendmsg.

During testing, I also hit this one:

Traceback (most recent call last):
  File "/usr/lib64/python2.7/site-packages/xpra/net/protocol.py", line 1042, in close
  File "/usr/lib64/python2.7/site-packages/xpra/server/websocket.py", line 342, in close
  File "/usr/lib64/python2.7/site-packages/xpra/net/bytestreams.py", line 334, in close
  File "/usr/lib/python2.7/site-packages/websockify-0.8.0-py2.7.egg/websockify/websocket.py", line 489, in close
  File "/usr/lib/python2.7/site-packages/websockify-0.8.0-py2.7.egg/websockify/websocket.py", line 689, in _close
AttributeError: 'NoneType' object has no attribute 'close'

Wed, 23 Jan 2019 17:29:51 GMT - Antoine Martin: status changed; resolution set

Fixed in r21463. Support added for websockify>0.8 in the performance test in r21465. (#1926)

Maybe we should propagate the EWOULDBLOCK write event. (and not just from websockets IO)

Will follow up in:

Sat, 23 Jan 2021 05:42:19 GMT - migration script:

this ticket has been moved to: https://github.com/Xpra-org/xpra/issues/2104