Added the CheckIfValidCloseParameters (ushort, string) method
This commit is contained in:
parent
85d77399cc
commit
2c8ca0a491
@ -251,6 +251,17 @@ namespace WebSocketSharp
|
|||||||
: null;
|
: null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
internal static string CheckIfValidCloseParameters (this ushort code, string reason)
|
||||||
|
{
|
||||||
|
return !code.IsCloseStatusCode ()
|
||||||
|
? "An invalid close status code."
|
||||||
|
: code.IsNoStatusCode () && !reason.IsNullOrEmpty ()
|
||||||
|
? "NoStatusCode cannot have a reason."
|
||||||
|
: !reason.IsNullOrEmpty () && Encoding.UTF8.GetBytes (reason).Length > 123
|
||||||
|
? "A reason has greater than the allowable max size."
|
||||||
|
: null;
|
||||||
|
}
|
||||||
|
|
||||||
internal static string CheckIfValidCloseStatusCode (this ushort code)
|
internal static string CheckIfValidCloseStatusCode (this ushort code)
|
||||||
{
|
{
|
||||||
return !code.IsCloseStatusCode ()
|
return !code.IsCloseStatusCode ()
|
||||||
|
Loading…
Reference in New Issue
Block a user