[Modify] Polish it

This commit is contained in:
sta 2020-10-11 17:32:47 +09:00
parent ad495cc60b
commit 2a3bcdf525

View File

@ -356,19 +356,24 @@ namespace WebSocketSharp.Net
if (host != null && host.Length > 0) { if (host != null && host.Length > 0) {
var bestLen = -1; var bestLen = -1;
foreach (var pref in _prefixes.Keys) { foreach (var pref in _prefixes.Keys) {
if (dns) { if (dns) {
var prefHost = pref.Host; var prefHost = pref.Host;
if (Uri.CheckHostName (prefHost) == UriHostNameType.Dns && prefHost != host) var prefDns = Uri.CheckHostName (prefHost) == UriHostNameType.Dns;
if (prefDns) {
if (prefHost != host)
continue; continue;
} }
}
if (pref.Port != port) if (pref.Port != port)
continue; continue;
var prefPath = pref.Path; var prefPath = pref.Path;
var len = prefPath.Length; var len = prefPath.Length;
if (len < bestLen) if (len < bestLen)
continue; continue;
@ -384,6 +389,7 @@ namespace WebSocketSharp.Net
var prefs = _unhandled; var prefs = _unhandled;
listener = searchHttpListenerFromSpecial (path, prefs); listener = searchHttpListenerFromSpecial (path, prefs);
if (listener == null && pathSlash != path) if (listener == null && pathSlash != path)
listener = searchHttpListenerFromSpecial (pathSlash, prefs); listener = searchHttpListenerFromSpecial (pathSlash, prefs);
@ -392,6 +398,7 @@ namespace WebSocketSharp.Net
prefs = _all; prefs = _all;
listener = searchHttpListenerFromSpecial (path, prefs); listener = searchHttpListenerFromSpecial (path, prefs);
if (listener == null && pathSlash != path) if (listener == null && pathSlash != path)
listener = searchHttpListenerFromSpecial (pathSlash, prefs); listener = searchHttpListenerFromSpecial (pathSlash, prefs);