diff --git a/xpra/net/websockets/common.py b/xpra/net/websockets/common.py index 976f8fe514..2ff589868e 100644 --- a/xpra/net/websockets/common.py +++ b/xpra/net/websockets/common.py @@ -8,6 +8,7 @@ from time import monotonic from hashlib import sha1 from base64 import b64encode +from urllib.parse import quote from xpra.os_util import strtobytes, bytestostr from xpra.log import Logger @@ -54,7 +55,8 @@ def client_upgrade(read, write, host, port, path=""): log("client_upgrade: done") def get_client_upgrade_request(host, port, path, key): - request = f"GET /{path} HTTP/1.1" + url_path = quote(path) + request = f"GET /{url_path} HTTP/1.1" log(f"client websocket upgrade request: {request!r}") lines = [request.encode("latin1")] headers = get_headers(host, port) diff --git a/xpra/scripts/main.py b/xpra/scripts/main.py index f52ddc4881..f3317593ab 100755 --- a/xpra/scripts/main.py +++ b/xpra/scripts/main.py @@ -742,7 +742,11 @@ def display_desc_to_uri(display_desc): uri += f"{cid}:{iport}" else: raise NotImplementedError("%s is not implemented yet" % dtype) - uri += "/" + uri += "/" + display_desc_to_display_path(display_desc) + return uri + +def display_desc_to_display_path(display_desc): + uri = "" display = display_desc.get("display") if display: uri += display.lstrip(":") @@ -1068,8 +1072,8 @@ def sockpathfail_cb(msg): except ImportError as e: # pragma: no cover raise InitExit(EXIT_UNSUPPORTED, f"cannot handle websocket connection: {e}") from None else: - display = display_desc.get("display", "") - client_upgrade(conn.read, conn.write, host, port, display) + display_path = display_desc_to_display_path(display_desc) + client_upgrade(conn.read, conn.write, host, port, display_path) conn.target = get_host_target_string(display_desc) return conn raise InitException(f"unsupported display type: {dtype}")