diff --git a/websocket-sharp/CloseEventArgs.cs b/websocket-sharp/CloseEventArgs.cs index cc79e444..5831805a 100644 --- a/websocket-sharp/CloseEventArgs.cs +++ b/websocket-sharp/CloseEventArgs.cs @@ -63,7 +63,7 @@ namespace WebSocketSharp _payloadData = new PayloadData (); _rawData = _payloadData.ApplicationData; - _code = (ushort) CloseStatusCode.NoStatusCode; + _code = (ushort) CloseStatusCode.NoStatus; _reason = String.Empty; } @@ -87,7 +87,7 @@ namespace WebSocketSharp var len = _rawData.Length; _code = len > 1 ? _rawData.SubArray (0, 2).ToUInt16 (ByteOrder.Big) - : (ushort) CloseStatusCode.NoStatusCode; + : (ushort) CloseStatusCode.NoStatus; _reason = len > 2 ? Encoding.UTF8.GetString (_rawData.SubArray (2, len - 2)) diff --git a/websocket-sharp/CloseStatusCode.cs b/websocket-sharp/CloseStatusCode.cs index 7f8ec1f9..7ca2739a 100644 --- a/websocket-sharp/CloseStatusCode.cs +++ b/websocket-sharp/CloseStatusCode.cs @@ -65,9 +65,9 @@ namespace WebSocketSharp /// /// Equivalent to close status 1003. /// Indicates that an endpoint is terminating the connection because it has received - /// an unacceptable type message. + /// a type of data that it cannot accept. /// - IncorrectData = 1003, + UnsupportedData = 1003, /// /// Equivalent to close status 1004. /// Still undefined. A Reserved value. @@ -77,7 +77,7 @@ namespace WebSocketSharp /// Equivalent to close status 1005. /// Indicates that no status code was actually present. A Reserved value. /// - NoStatusCode = 1005, + NoStatus = 1005, /// /// Equivalent to close status 1006. /// Indicates that the connection was closed abnormally. A Reserved value. @@ -88,7 +88,7 @@ namespace WebSocketSharp /// Indicates that an endpoint is terminating the connection because it has received /// a message that contains data that isn't consistent with the type of the message. /// - InconsistentData = 1007, + InvalidData = 1007, /// /// Equivalent to close status 1008. /// Indicates that an endpoint is terminating the connection because it has received @@ -107,7 +107,7 @@ namespace WebSocketSharp /// the server to negotiate one or more extension, but the server didn't return them /// in the handshake response. /// - IgnoreExtension = 1010, + MandatoryExtension = 1010, /// /// Equivalent to close status 1011. /// Indicates that the server is terminating the connection because it has encountered diff --git a/websocket-sharp/Ext.cs b/websocket-sharp/Ext.cs index 3b583b2e..e1cb9606 100644 --- a/websocket-sharp/Ext.cs +++ b/websocket-sharp/Ext.cs @@ -255,8 +255,8 @@ namespace WebSocketSharp { return !code.IsCloseStatusCode () ? "An invalid close status code." - : code.IsNoStatusCode () && !reason.IsNullOrEmpty () - ? "NoStatusCode cannot have a reason." + : code.IsNoStatus () && !reason.IsNullOrEmpty () + ? "NoStatus cannot have a reason." : !reason.IsNullOrEmpty () && Encoding.UTF8.GetBytes (reason).Length > 123 ? "A reason has greater than the allowable max size." : null; @@ -264,8 +264,8 @@ namespace WebSocketSharp internal static string CheckIfValidCloseParameters (this CloseStatusCode code, string reason) { - return code.IsNoStatusCode () && !reason.IsNullOrEmpty () - ? "NoStatusCode cannot have a reason." + return code.IsNoStatus () && !reason.IsNullOrEmpty () + ? "NoStatus cannot have a reason." : !reason.IsNullOrEmpty () && Encoding.UTF8.GetBytes (reason).Length > 123 ? "A reason has greater than the allowable max size." : null; @@ -496,22 +496,22 @@ namespace WebSocketSharp { return code == CloseStatusCode.ProtocolError ? "A WebSocket protocol error has occurred." - : code == CloseStatusCode.IncorrectData - ? "An incorrect data has been received." + : code == CloseStatusCode.UnsupportedData + ? "Unsupported data has been received." : code == CloseStatusCode.Abnormal ? "An exception has occurred." - : code == CloseStatusCode.InconsistentData - ? "An inconsistent data has been received." + : code == CloseStatusCode.InvalidData + ? "Invalid data has been received." : code == CloseStatusCode.PolicyViolation ? "A policy violation has occurred." : code == CloseStatusCode.TooBig - ? "A too big data has been received." - : code == CloseStatusCode.IgnoreExtension + ? "A too big message has been received." + : code == CloseStatusCode.MandatoryExtension ? "WebSocket client didn't receive expected extension(s)." : code == CloseStatusCode.ServerError ? "WebSocket server got an internal error." : code == CloseStatusCode.TlsHandshakeFailure - ? "An error has occurred while handshaking." + ? "An error has occurred during a TLS handshake." : String.Empty; } @@ -604,14 +604,14 @@ namespace WebSocketSharp return value.StartsWith (method.ToExtensionString ()); } - internal static bool IsNoStatusCode (this ushort code) + internal static bool IsNoStatus (this ushort code) { - return code == (ushort) CloseStatusCode.NoStatusCode; + return code == (ushort) CloseStatusCode.NoStatus; } - internal static bool IsNoStatusCode (this CloseStatusCode code) + internal static bool IsNoStatus (this CloseStatusCode code) { - return code == CloseStatusCode.NoStatusCode; + return code == CloseStatusCode.NoStatus; } internal static bool IsPortNumber (this int value) @@ -622,7 +622,7 @@ namespace WebSocketSharp internal static bool IsReserved (this ushort code) { return code == (ushort) CloseStatusCode.Undefined || - code == (ushort) CloseStatusCode.NoStatusCode || + code == (ushort) CloseStatusCode.NoStatus || code == (ushort) CloseStatusCode.Abnormal || code == (ushort) CloseStatusCode.TlsHandshakeFailure; } @@ -630,7 +630,7 @@ namespace WebSocketSharp internal static bool IsReserved (this CloseStatusCode code) { return code == CloseStatusCode.Undefined || - code == CloseStatusCode.NoStatusCode || + code == CloseStatusCode.NoStatus || code == CloseStatusCode.Abnormal || code == CloseStatusCode.TlsHandshakeFailure; } diff --git a/websocket-sharp/Server/HttpServer.cs b/websocket-sharp/Server/HttpServer.cs index 9afac295..97ce3d11 100644 --- a/websocket-sharp/Server/HttpServer.cs +++ b/websocket-sharp/Server/HttpServer.cs @@ -766,7 +766,7 @@ namespace WebSocketSharp.Server _state = ServerState.ShuttingDown; } - if (code.IsNoStatusCode ()) { + if (code.IsNoStatus ()) { _services.Stop (new CloseEventArgs (), true, true); } else { @@ -802,7 +802,7 @@ namespace WebSocketSharp.Server _state = ServerState.ShuttingDown; } - if (code.IsNoStatusCode ()) { + if (code.IsNoStatus ()) { _services.Stop (new CloseEventArgs (), true, true); } else { diff --git a/websocket-sharp/Server/WebSocketServer.cs b/websocket-sharp/Server/WebSocketServer.cs index 7173123d..7ba2a52d 100644 --- a/websocket-sharp/Server/WebSocketServer.cs +++ b/websocket-sharp/Server/WebSocketServer.cs @@ -852,7 +852,7 @@ namespace WebSocketSharp.Server } stopReceiving (5000); - if (code.IsNoStatusCode ()) { + if (code.IsNoStatus ()) { _services.Stop (new CloseEventArgs (), true, true); } else { @@ -887,7 +887,7 @@ namespace WebSocketSharp.Server } stopReceiving (5000); - if (code.IsNoStatusCode ()) { + if (code.IsNoStatus ()) { _services.Stop (new CloseEventArgs (), true, true); } else { diff --git a/websocket-sharp/WebSocket.cs b/websocket-sharp/WebSocket.cs index bc848e1c..eb2fca4b 100644 --- a/websocket-sharp/WebSocket.cs +++ b/websocket-sharp/WebSocket.cs @@ -773,8 +773,8 @@ namespace WebSocketSharp // ? return processUnsupportedFrame ( frame, - CloseStatusCode.IncorrectData, - "Incorrect data has been received while receiving the fragmented data."); + CloseStatusCode.UnsupportedData, + "Unsupported data has been received while receiving the fragmented data."); } return true; @@ -1075,7 +1075,7 @@ namespace WebSocketSharp ? processPongFrame (frame) : frame.IsClose ? processCloseFrame (frame) - : processUnsupportedFrame (frame, CloseStatusCode.IncorrectData, null); + : processUnsupportedFrame (frame, CloseStatusCode.UnsupportedData, null); } // As server @@ -1746,7 +1746,7 @@ namespace WebSocketSharp return; } - if (code.IsNoStatusCode ()) { + if (code.IsNoStatus ()) { close (new CloseEventArgs (), true, true); return; } @@ -1773,7 +1773,7 @@ namespace WebSocketSharp return; } - if (code.IsNoStatusCode ()) { + if (code.IsNoStatus ()) { close (new CloseEventArgs (), true, true); return; } @@ -1807,7 +1807,7 @@ namespace WebSocketSharp return; } - if (code.IsNoStatusCode ()) { + if (code.IsNoStatus ()) { close (new CloseEventArgs (), true, true); return; } @@ -1841,7 +1841,7 @@ namespace WebSocketSharp return; } - if (code.IsNoStatusCode ()) { + if (code.IsNoStatus ()) { close (new CloseEventArgs (), true, true); return; } @@ -1895,7 +1895,7 @@ namespace WebSocketSharp return; } - if (code.IsNoStatusCode ()) { + if (code.IsNoStatus ()) { closeAsync (new CloseEventArgs (), true, true); return; } @@ -1925,7 +1925,7 @@ namespace WebSocketSharp return; } - if (code.IsNoStatusCode ()) { + if (code.IsNoStatus ()) { closeAsync (new CloseEventArgs (), true, true); return; } @@ -1964,7 +1964,7 @@ namespace WebSocketSharp return; } - if (code.IsNoStatusCode ()) { + if (code.IsNoStatus ()) { closeAsync (new CloseEventArgs (), true, true); return; } @@ -2004,7 +2004,7 @@ namespace WebSocketSharp return; } - if (code.IsNoStatusCode ()) { + if (code.IsNoStatus ()) { closeAsync (new CloseEventArgs (), true, true); return; }