[Modify] Polish it

This commit is contained in:
sta 2020-09-13 22:43:37 +09:00
parent d3085f0c4b
commit c7b746bdaf

View File

@ -129,17 +129,17 @@ namespace WebSocketSharp.Net
_secure = true; _secure = true;
var len = uriPrefix.Length; var len = uriPrefix.Length;
var startHost = uriPrefix.IndexOf (':') + 3; var host = uriPrefix.IndexOf (':') + 3;
var root = uriPrefix.IndexOf ('/', startHost + 1, len - startHost - 1); var root = uriPrefix.IndexOf ('/', host + 1, len - host - 1);
var colon = uriPrefix.LastIndexOf (':', root - 1, root - startHost - 1); var colon = uriPrefix.LastIndexOf (':', root - 1, root - host - 1);
if (uriPrefix[root - 1] != ']' && colon > startHost) { if (uriPrefix[root - 1] != ']' && colon > host) {
_host = uriPrefix.Substring (startHost, colon - startHost); _host = uriPrefix.Substring (host, colon - host);
_port = uriPrefix.Substring (colon + 1, root - colon - 1); _port = uriPrefix.Substring (colon + 1, root - colon - 1);
} }
else { else {
_host = uriPrefix.Substring (startHost, root - startHost); _host = uriPrefix.Substring (host, root - host);
_port = _secure ? "443" : "80"; _port = _secure ? "443" : "80";
} }