fix: auto-prepend http:// to bare remote server URLs#175
Open
jfversluis wants to merge 1 commit intomainfrom
Open
fix: auto-prepend http:// to bare remote server URLs#175jfversluis wants to merge 1 commit intomainfrom
jfversluis wants to merge 1 commit intomainfrom
Conversation
When users enter a plain IP like 192.168.1.5:4322 without a scheme, the remote connection fails because the URL parser can't resolve it. Add ConnectionSettings.NormalizeRemoteUrl() that: - Passes through URLs that already have http/https/ws/wss scheme - Detects devtunnels/ngrok/cloudflare hosts and uses https:// - Uses http:// for bare IPs, localhost, and LAN hostnames - Trims whitespace and trailing slashes Applied at Dashboard mobile connect, Settings SaveAndApply, and InitializeRemoteAsync (which converts http→ws, https→wss). Includes 13 new test cases covering all normalization paths. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
When entering a plain IP address like
192.168.1.5:4322in the Remote URL field (withouthttp://), PolyPilot can't connect. The URL was passed through without a scheme, and the fallback inInitializeRemoteAsyncdefaulted towss://which fails for plain LAN connections.Fix
Added
ConnectionSettings.NormalizeRemoteUrl()— a static helper that ensures the URL always has a proper scheme:192.168.1.5:4322http://192.168.1.5:4322localhost:4322http://localhost:4322xxx.devtunnels.mshttps://xxx.devtunnels.msabc.ngrok.iohttps://abc.ngrok.iohttp://already-valid.comhttp://already-valid.com(unchanged)Applied at three entry points:
DashboardConnect)SaveAndApply)InitializeRemoteAsync) — which then converts http→ws, https→wssTests
13 new test cases in
ConnectionSettingsTests.cscovering null/empty, existing schemes, bare IPs, known TLS hosts, whitespace/slash trimming, and double-scheme prevention.All 1139 existing tests continue to pass (2 pre-existing failures unrelated to this change).