Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions distributed/dashboard/tests/test_scheduler_bokeh.py
Original file line number Diff line number Diff line change
Expand Up @@ -1132,16 +1132,16 @@ async def test_proxy_to_workers(s, a, b):
assert response_direct.code == 200
assert b"System" in response_direct.body

dashboard_port = s.http_server.port
http_client = AsyncHTTPClient()
unsafe_host = "<><><>" # Some unsafe characters that should be escaped
proxy_url = f"http://localhost:{dashboard_port}/proxy/1234/{unsafe_host}/status"
response = await http_client.fetch(proxy_url, raise_error=False)
if proxy_exists:
dashboard_port = s.http_server.port
http_client = AsyncHTTPClient()
unsafe_host = "<><><>" # Some unsafe characters that should be escaped
proxy_url = f"http://localhost:{dashboard_port}/proxy/1234/{unsafe_host}/status"
response = await http_client.fetch(proxy_url, raise_error=False)
assert response.code == 400
assert unsafe_host not in response.body.decode(), (
"Unsafe characters should be escaped"
)
assert unsafe_host not in response.body.decode(), (
"Unsafe characters should be escaped"
)


@gen_cluster(
Expand Down
4 changes: 2 additions & 2 deletions distributed/http/proxy.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,9 +97,9 @@ def initialize(self, dask_server=None, extra=None):
self.extra = extra or {}

def get(self, port, host, proxied_path):
worker_url = f"{host}:{port}/{proxied_path}"
worker_url = html.escape(f"{host}:{port}/{proxied_path}")
msg = f"""
<p> Try navigating to <a href=http://{worker_url}>{worker_url}</a> for your worker dashboard </p>
<p> Try navigating to <a href="http://{worker_url}">{worker_url}</a> for your worker dashboard </p>

<p>
Dask tried to proxy you to that page through your
Expand Down
Loading