[Modify] Polish it
This commit is contained in:
parent
ceac08866e
commit
fb4a07ec6e
@ -161,9 +161,17 @@ namespace WebSocketSharp.Server
|
|||||||
throw new ArgumentException (msg, "url");
|
throw new ArgumentException (msg, "url");
|
||||||
|
|
||||||
var host = getHost (uri);
|
var host = getHost (uri);
|
||||||
|
|
||||||
var addr = host.ToIPAddress ();
|
var addr = host.ToIPAddress ();
|
||||||
if (!addr.IsLocal ())
|
if (addr == null) {
|
||||||
throw new ArgumentException ("The host part isn't a local host name: " + url, "url");
|
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");
|
init (host, addr, uri.Port, uri.Scheme == "https");
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user