From d3085f0c4b079b1b297d390db72d9083a3a45228 Mon Sep 17 00:00:00 2001 From: sta Date: Sat, 12 Sep 2020 22:09:48 +0900 Subject: [PATCH] [Modify] Polish it --- websocket-sharp/Net/HttpListenerPrefix.cs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/websocket-sharp/Net/HttpListenerPrefix.cs b/websocket-sharp/Net/HttpListenerPrefix.cs index 8c149ca7..ee864fd7 100644 --- a/websocket-sharp/Net/HttpListenerPrefix.cs +++ b/websocket-sharp/Net/HttpListenerPrefix.cs @@ -133,6 +133,7 @@ namespace WebSocketSharp.Net var root = uriPrefix.IndexOf ('/', startHost + 1, len - startHost - 1); var colon = uriPrefix.LastIndexOf (':', root - 1, root - startHost - 1); + if (uriPrefix[root - 1] != ']' && colon > startHost) { _host = uriPrefix.Substring (startHost, colon - startHost); _port = uriPrefix.Substring (colon + 1, root - colon - 1); @@ -144,8 +145,13 @@ namespace WebSocketSharp.Net _path = uriPrefix.Substring (root); - _prefix = - String.Format ("http{0}://{1}:{2}{3}", _secure ? "s" : "", _host, _port, _path); + _prefix = String.Format ( + "http{0}://{1}:{2}{3}", + _secure ? "s" : "", + _host, + _port, + _path + ); } #endregion