Skip to content

Commit fb4a07e

Browse files
committed
[Modify] Polish it
1 parent ceac088 commit fb4a07e

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

websocket-sharp/Server/HttpServer.cs

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -161,9 +161,17 @@ public HttpServer (string url)
161161
throw new ArgumentException (msg, "url");
162162

163163
var host = getHost (uri);
164+
164165
var addr = host.ToIPAddress ();
165-
if (!addr.IsLocal ())
166-
throw new ArgumentException ("The host part isn't a local host name: " + url, "url");
166+
if (addr == null) {
167+
msg = "The host part could not be converted to an IP address.";
168+
throw new ArgumentException (msg, "url");
169+
}
170+
171+
if (!addr.IsLocal ()) {
172+
msg = "The IP address of the host is not a local IP address.";
173+
throw new ArgumentException (msg, "url");
174+
}
167175

168176
init (host, addr, uri.Port, uri.Scheme == "https");
169177
}

0 commit comments

Comments
 (0)