Skip to content

Commit

Permalink
preserve URL arguments in http request path
Browse files Browse the repository at this point in the history
  • Loading branch information
totaam committed Sep 2, 2022
1 parent 1f94ad7 commit de46aa3
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
4 changes: 3 additions & 1 deletion xpra/net/websockets/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down
10 changes: 7 additions & 3 deletions xpra/scripts/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(":")
Expand Down Expand Up @@ -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}")
Expand Down

0 comments on commit de46aa3

Please sign in to comment.