Skip to content

Commit fa7bd3d

Browse files
committed
rebase
1 parent 184118d commit fa7bd3d

File tree

2 files changed

+13
-12
lines changed

2 files changed

+13
-12
lines changed

src/Microsoft.Diagnostics.WebSocketServer/WebSocketServerImpl.cs

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -172,24 +172,24 @@ private static void ParseWebSocketURL(string endPoint, out Uri uri)
172172
uriToParse = endPoint;
173173
}
174174

175-
string[] supportedSchemes = new string[] { "ws", "wss", "http", "https" };
176175

177176
if (!string.IsNullOrEmpty(uriToParse) && Uri.TryCreate(uriToParse, UriKind.Absolute, out uri))
178177
{
179-
bool supported = false;
180-
foreach (string scheme in supportedSchemes)
178+
if (uri.Scheme == "ws")
181179
{
182-
if (string.Equals(uri.Scheme, scheme, StringComparison.InvariantCultureIgnoreCase))
183-
{
184-
supported = true;
185-
break;
186-
}
180+
uri = new UriBuilder(uri) { Scheme = "http" }.Uri;
181+
return;
187182
}
188-
if (!supported)
183+
if (uri.Scheme == "wss")
189184
{
190-
throw new ArgumentException(string.Format("Unsupported Uri schema, \"{0}\"", uri.Scheme));
185+
uri = new UriBuilder(uri) { Scheme = "https" }.Uri;
186+
return;
191187
}
192-
return;
188+
if (uri.Scheme == "http" || uri.Scheme == "https")
189+
{
190+
return;
191+
}
192+
throw new ArgumentException(string.Format("Unsupported Uri schema, \"{0}\"", uri.Scheme));
193193
}
194194
else
195195
{

src/Tools/dotnet-dsrouter/Program.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,8 @@ private static Command AndroidRouterCommand()
267267
new("--web-socket", "-ws")
268268
{
269269
Description = "The router WebSocket address using format ws://[host]:[port]/[path] or wss://[host]:[port]/[path]. " +
270-
"Launch app with WasmExtraConfig property specifying diagnostic_options with a server connect_url"
270+
"Launch app with WasmExtraConfig property specifying diagnostic_options with a server connect_url",
271+
DefaultValueFactory = _ => "ws://127.0.0.1:8088/diagnostics"
271272
};
272273

273274
private static readonly Option<int> RuntimeTimeoutOption =

0 commit comments

Comments
 (0)