From 7db92ec3501d5c80a3d06bd0416f058907b3f76d Mon Sep 17 00:00:00 2001 From: sta Date: Tue, 7 Sep 2021 19:35:00 +0900 Subject: [PATCH] [Modify] Polish it --- websocket-sharp/Server/WebSocketServer.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/websocket-sharp/Server/WebSocketServer.cs b/websocket-sharp/Server/WebSocketServer.cs index 2c5a02ee..1d2c0f1c 100644 --- a/websocket-sharp/Server/WebSocketServer.cs +++ b/websocket-sharp/Server/WebSocketServer.cs @@ -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"); }