Modified some error messages in Ext.cs and WebSocketServer.cs

This commit is contained in:
sta 2014-09-02 13:58:40 +09:00
parent d9528ffe75
commit faaa2e1939
2 changed files with 10 additions and 11 deletions

View File

@ -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");

View File

@ -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";