From f81c6e99aa5fc7a73e3aab4e2eb5094e853ebe07 Mon Sep 17 00:00:00 2001 From: sta Date: Mon, 5 Jul 2021 20:42:13 +0900 Subject: [PATCH] [Modify] Polish it --- websocket-sharp/Server/HttpServer.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/websocket-sharp/Server/HttpServer.cs b/websocket-sharp/Server/HttpServer.cs index be4b66a1..9889f0a5 100644 --- a/websocket-sharp/Server/HttpServer.cs +++ b/websocket-sharp/Server/HttpServer.cs @@ -161,19 +161,22 @@ namespace WebSocketSharp.Server Uri uri; string msg; + if (!tryCreateUri (url, out uri, out msg)) throw new ArgumentException (msg, "url"); var host = uri.GetDnsSafeHost (true); - 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"); }