Modified some error messages in Ext.cs and WebSocketServer.cs
This commit is contained in:
parent
d9528ffe75
commit
faaa2e1939
@ -242,7 +242,7 @@ namespace WebSocketSharp
|
|||||||
internal static string CheckIfValidCloseStatusCode (this ushort code)
|
internal static string CheckIfValidCloseStatusCode (this ushort code)
|
||||||
{
|
{
|
||||||
return !code.IsCloseStatusCode ()
|
return !code.IsCloseStatusCode ()
|
||||||
? "Invalid close status code."
|
? "An invalid close status code."
|
||||||
: null;
|
: null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -289,9 +289,9 @@ namespace WebSocketSharp
|
|||||||
return path == null || path.Length == 0
|
return path == null || path.Length == 0
|
||||||
? "'path' is null or empty."
|
? "'path' is null or empty."
|
||||||
: path[0] != '/'
|
: path[0] != '/'
|
||||||
? "'path' isn't absolute path."
|
? "'path' isn't an absolute path."
|
||||||
: path.IndexOfAny (new[] { '?', '#' }) > -1
|
: path.IndexOfAny (new[] { '?', '#' }) > -1
|
||||||
? "'path' contains either or both query and fragment components."
|
? "'path' includes either or both query and fragment components."
|
||||||
: null;
|
: null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -834,13 +834,13 @@ namespace WebSocketSharp
|
|||||||
{
|
{
|
||||||
result = null;
|
result = null;
|
||||||
if (uriString.Length == 0) {
|
if (uriString.Length == 0) {
|
||||||
message = "Empty string.";
|
message = "An empty string.";
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
var uri = uriString.ToUri ();
|
var uri = uriString.ToUri ();
|
||||||
if (!uri.IsAbsoluteUri) {
|
if (!uri.IsAbsoluteUri) {
|
||||||
message = "Not absolute URI: " + uriString;
|
message = "Not an absolute URI: " + uriString;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -851,7 +851,7 @@ namespace WebSocketSharp
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (uri.Fragment.Length > 0) {
|
if (uri.Fragment.Length > 0) {
|
||||||
message = "Contains the fragment component: " + uriString;
|
message = "Includes the fragment component: " + uriString;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -863,7 +863,7 @@ namespace WebSocketSharp
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ((schm == "ws" && port == 443) || (schm == "wss" && port == 80)) {
|
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;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1309,7 +1309,7 @@ namespace WebSocketSharp
|
|||||||
throw new ArgumentNullException ("protocol");
|
throw new ArgumentNullException ("protocol");
|
||||||
|
|
||||||
if (protocol.Length == 0)
|
if (protocol.Length == 0)
|
||||||
throw new ArgumentException ("Empty string.", "protocol");
|
throw new ArgumentException ("An empty string.", "protocol");
|
||||||
|
|
||||||
return request.Headers.Contains ("Upgrade", protocol) &&
|
return request.Headers.Contains ("Upgrade", protocol) &&
|
||||||
request.Headers.Contains ("Connection", "Upgrade");
|
request.Headers.Contains ("Connection", "Upgrade");
|
||||||
|
@ -147,10 +147,9 @@ namespace WebSocketSharp.Server
|
|||||||
if (!tryCreateUri (url, out _uri, out msg))
|
if (!tryCreateUri (url, out _uri, out msg))
|
||||||
throw new ArgumentException (msg, "url");
|
throw new ArgumentException (msg, "url");
|
||||||
|
|
||||||
var host = _uri.DnsSafeHost;
|
_address = _uri.DnsSafeHost.ToIPAddress ();
|
||||||
_address = host.ToIPAddress ();
|
|
||||||
if (_address == null || !_address.IsLocal ())
|
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;
|
_port = _uri.Port;
|
||||||
_secure = _uri.Scheme == "wss";
|
_secure = _uri.Scheme == "wss";
|
||||||
|
Loading…
Reference in New Issue
Block a user