[Modify] Polish it
This commit is contained in:
parent
02c986811f
commit
7db92ec350
@ -178,19 +178,22 @@ namespace WebSocketSharp.Server
|
||||
|
||||
Uri uri;
|
||||
string msg;
|
||||
|
||||
if (!tryCreateUri (url, out uri, out msg))
|
||||
throw new ArgumentException (msg, "url");
|
||||
|
||||
var host = uri.DnsSafeHost;
|
||||
|
||||
var addr = host.ToIPAddress ();
|
||||
|
||||
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");
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user