diff --git a/websocket-sharp/Ext.cs b/websocket-sharp/Ext.cs index 71170945..56628a39 100644 --- a/websocket-sharp/Ext.cs +++ b/websocket-sharp/Ext.cs @@ -242,7 +242,7 @@ namespace WebSocketSharp internal static string CheckIfValidCloseStatusCode (this ushort code) { return !code.IsCloseStatusCode () - ? "Invalid close status code." + ? "An invalid close status code." : null; } @@ -289,9 +289,9 @@ namespace WebSocketSharp return path == null || path.Length == 0 ? "'path' is null or empty." : path[0] != '/' - ? "'path' isn't absolute path." + ? "'path' isn't an absolute path." : path.IndexOfAny (new[] { '?', '#' }) > -1 - ? "'path' contains either or both query and fragment components." + ? "'path' includes either or both query and fragment components." : null; } @@ -834,13 +834,13 @@ namespace WebSocketSharp { result = null; if (uriString.Length == 0) { - message = "Empty string."; + message = "An empty string."; return false; } var uri = uriString.ToUri (); if (!uri.IsAbsoluteUri) { - message = "Not absolute URI: " + uriString; + message = "Not an absolute URI: " + uriString; return false; } @@ -851,7 +851,7 @@ namespace WebSocketSharp } if (uri.Fragment.Length > 0) { - message = "Contains the fragment component: " + uriString; + message = "Includes the fragment component: " + uriString; return false; } @@ -863,7 +863,7 @@ namespace WebSocketSharp } if ((schm == "ws" && port == 443) || (schm == "wss" && port == 80)) { - message = "Invalid pair of scheme and port: " + uriString; + message = "An invalid pair of scheme and port: " + uriString; return false; } } @@ -1309,7 +1309,7 @@ namespace WebSocketSharp throw new ArgumentNullException ("protocol"); if (protocol.Length == 0) - throw new ArgumentException ("Empty string.", "protocol"); + throw new ArgumentException ("An empty string.", "protocol"); return request.Headers.Contains ("Upgrade", protocol) && request.Headers.Contains ("Connection", "Upgrade"); diff --git a/websocket-sharp/Server/WebSocketServer.cs b/websocket-sharp/Server/WebSocketServer.cs index d34e2e13..bec0a92a 100644 --- a/websocket-sharp/Server/WebSocketServer.cs +++ b/websocket-sharp/Server/WebSocketServer.cs @@ -147,10 +147,9 @@ namespace WebSocketSharp.Server if (!tryCreateUri (url, out _uri, out msg)) throw new ArgumentException (msg, "url"); - var host = _uri.DnsSafeHost; - _address = host.ToIPAddress (); + _address = _uri.DnsSafeHost.ToIPAddress (); if (_address == null || !_address.IsLocal ()) - throw new ArgumentException ("The host part isn't a local host name: " + host, "url"); + throw new ArgumentException ("The host part isn't a local host name: " + url, "url"); _port = _uri.Port; _secure = _uri.Scheme == "wss";