Skip to content

Fixed TUI web socket URL logic#557

Merged
tieneupin merged 4 commits intomainfrom
tui-websocket-fix
Apr 2, 2025
Merged

Fixed TUI web socket URL logic#557
tieneupin merged 4 commits intomainfrom
tui-websocket-fix

Conversation

@tieneupin
Copy link
Contributor

@tieneupin tieneupin commented Apr 1, 2025

The client-side websocket component previously took the server URL and passed it through urllib.parse.urlparse(server)._replace(scheme="ws", path=""). This would have eliminated any trailing URL paths after the netloc component, which would be present if the request was redirected to the backend server through a proxy and had its URL re-mapped (e.g. the URL after redirecting through the web UI could be "http://{hostname}:{port}/proxy_path/path/to/end/point").

This PR accounts for that by storing the URL path of the server it is attempting to connect to, and will correctly insert that into the final websocket URL constructed.

This same problem occurs when the TUI client tries to submit a version check and update request to the server, so the same fix was applied to that branch of logic. Interestingly, a trailing slash "/" is now needed when constructing the version check query (i.e. url._replace(path="{proxy_path}/version/", ... )) in order for the request to be successful. It throws an error otherwise.

@tieneupin tieneupin self-assigned this Apr 1, 2025
@tieneupin tieneupin added bug Something isn't working server Relates to the server component client Relates to the client component labels Apr 1, 2025
@codecov
Copy link

codecov bot commented Apr 1, 2025

Codecov Report

Attention: Patch coverage is 0% with 4 lines in your changes missing coverage. Please review.

Project coverage is 28.84%. Comparing base (03a2b40) to head (17ac97f).
Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #557      +/-   ##
==========================================
- Coverage   28.85%   28.84%   -0.01%     
==========================================
  Files          80       80              
  Lines       10564    10567       +3     
  Branches     1406     1406              
==========================================
  Hits         3048     3048              
- Misses       7414     7417       +3     
  Partials      102      102              
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@tieneupin tieneupin requested a review from d-j-hatton April 2, 2025 10:16
@tieneupin tieneupin marked this pull request as ready for review April 2, 2025 10:16
@tieneupin tieneupin merged commit 5177b98 into main Apr 2, 2025
17 checks passed
@tieneupin tieneupin deleted the tui-websocket-fix branch April 2, 2025 10:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working client Relates to the client component server Relates to the server component

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants