[Modify] Polish it

This commit is contained in:
sta 2017-07-05 14:48:31 +09:00
parent ceac08866e
commit fb4a07ec6e

View File

@ -161,9 +161,17 @@ namespace WebSocketSharp.Server
throw new ArgumentException (msg, "url");
var host = getHost (uri);
var addr = host.ToIPAddress ();
if (!addr.IsLocal ())
throw new ArgumentException ("The host part isn't a local host name: " + url, "url");
if (addr == null) {
msg = "The host part could not be converted to an IP address.";
throw new ArgumentException (msg, "url");
}
if (!addr.IsLocal ()) {
msg = "The IP address of the host is not a local IP address.";
throw new ArgumentException (msg, "url");
}
init (host, addr, uri.Port, uri.Scheme == "https");
}