Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

websocket ssl errors #3933

Closed
totaam opened this issue Jul 22, 2023 · 1 comment
Closed

websocket ssl errors #3933

totaam opened this issue Jul 22, 2023 · 1 comment
Labels
bug Something isn't working network

Comments

@totaam
Copy link
Collaborator

totaam commented Jul 22, 2023

This bug was being triggered by the unit tests, unfortunately the whole test class was being silenced because of an environment error which has now been fixed.
Likely culprit: #3313

  • server:
xpra start --no-daemon :100  -d http,ssl,ws,websocket \
    --bind-tcp=0.0.0.0:10000 \
    --bind-ws=0.0.0.0:10001
  • client fails without --ssl-server-verify-mode=none:
Error: read on ws socket: 127.0.0.1:55382 <- 127.0.0.1:10001 failed: <class 'RuntimeError'>
Traceback (most recent call last):
  File "/usr/lib64/python3.11/site-packages/xpra/net/protocol/socket_handler.py", line 666, in _io_thread_loop
    while not self._closed and callback():
                               ^^^^^^^^^^
  File "/usr/lib64/python3.11/site-packages/xpra/net/protocol/socket_handler.py", line 760, in _read
    self._process_read(buf)
  File "/usr/lib64/python3.11/site-packages/xpra/net/websockets/protocol.py", line 112, in parse_ws_frame
    raise RuntimeError(f"cannot handle fragmented {op} frames")
RuntimeError: cannot handle fragmented 13 frames
Connection failed

The improved unit tests show:

RuntimeError: 2 errors testing ssl sockets:
* failed to connect to   tcp port using uri wss://foo:bar@127.0.0.1:33211/: expected info client to return OK but got CONNECTION_FAILED
* failed to connect to    ws port using uri wss://foo:bar@127.0.0.1:39927/: expected info client to return OK but got CONNECTION_FAILED

Slightly different failure, but hopefully the same cause.

@totaam totaam added bug Something isn't working network labels Jul 22, 2023
totaam added a commit that referenced this issue Jul 22, 2023
totaam added a commit that referenced this issue Jul 22, 2023
* #3933 for the sockets test
* notifications test: 416b65a + f1c2037
@totaam
Copy link
Collaborator Author

totaam commented Jul 22, 2023

Was caused by stray newline characters.
It seems that the http handler occasionally stops parsing before or after the empty newline \r\n that follows the headers, so we now strip it before starting the websocket packet parsing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working network
Projects
None yet
Development

No branches or pull requests

1 participant