Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(448)

Unified Diff: net/websockets/websocket_errors.h

Issue 14850012: Add missing status codes to WebSocketError enum. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 7 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | net/websockets/websocket_errors.cc » ('j') | net/websockets/websocket_errors_unittest.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/websockets/websocket_errors.h
diff --git a/net/websockets/websocket_errors.h b/net/websockets/websocket_errors.h
index 35d2462cea23aa27c20b0b22f06846b29ab2a5b6..5dd66517a63a38fec4320c3052c46589f08df9ac 100644
--- a/net/websockets/websocket_errors.h
+++ b/net/websockets/websocket_errors.h
@@ -9,12 +9,66 @@
namespace net {
-// Error values for WebSocket framing.
-// This values are compatible to RFC6455 defined status codes.
+// Reason codes used with close messages. NoStatusReceived,
+// AbnormalClosure and TlsHandshake are special in that they
+// should never be sent on the wire; they are only used within the
+// implementation.
enum WebSocketError {
- WEB_SOCKET_OK = 1000,
- WEB_SOCKET_ERR_PROTOCOL_ERROR = 1002,
- WEB_SOCKET_ERR_MESSAGE_TOO_BIG = 1009
+ // Status codes in the range 0 to 999 are not used.
+
+ // The following are standard codes defined by RFC6455.
+ kWebSocketNormalClosure = 1000,
+ kWebSocketErrorGoingAway = 1001,
+ kWebSocketErrorProtocolError = 1002,
+ kWebSocketErrorUnsupportedData = 1003,
+ kWebSocketErrorNoStatusReceived = 1005,
+ kWebSocketErrorAbnormalClosure = 1006,
+ kWebSocketErrorInvalidFramePayloadData = 1007,
+ kWebSocketErrorPolicyViolation = 1008,
+ kWebSocketErrorMessageTooBig = 1009,
+ kWebSocketErrorMandatoryExtension = 1010,
+ kWebSocketErrorInternalServerError = 1011,
+ kWebSocketErrorTlsHandshake = 1015,
+
+ // The following codes are defined in the
+ // draft-ietf-hybi-websocket-multiplexing spec and so are subject to change.
+ // Codes starting with 2000 apply to the physical connection. They are used
+ // for dropping the control channel.
tyoshino (SeeGerritForStatus) 2013/05/02 13:56:22 drop reason code of multiplexing spec are used onl
Adam Rice 2013/05/04 09:51:53 I thought it was necessary to include them to make
+ kWebSocketErrorPhysicalConnectionFailed = 2000,
+ kWebSocketErrorInvalidEncapsulatingMessage = 2001,
+ kWebSocketErrorChannelIdTruncated = 2002,
+ kWebSocketErrorEncapsulatedFrameIsTruncated = 2003,
+ kWebSocketErrorUnknownMuxOpcode = 2004,
+ kWebSocketErrorInvalidMuxControlBlock = 2005,
+ kWebSocketErrorChannelAlreadyExists = 2006,
+ kWebSocketErrorNewChannelSlotViolation = 2007,
+ kWebSocketErrorNewChannelSlotOverFlow = 2008,
+ kWebSocketErrorBadRequest = 2009,
+ kWebSocketErrorUnknownRequestEncoding = 2010,
+ kWebSocketErrorBadResponse = 2011,
+ kWebSocketErrorUnknownResponseEncoding = 2012,
+
+ // The range 1000-2999 is reserved by RFC6455 for use by the WebSocket
+ // protocol and public extensions.
+ kWebSocketErrorProtocolReservedMax = 2999,
+
+ // Codes starting with 3000 apply to the logical connection in the
+ // draft-ietf-hybi-websocket-multiplexing spec
+ kWebSocketErrorLogicalChannelFailed = 3000,
+ kWebSocketErrorSendQuotaViolation = 3005,
+ kWebSocketErrorSendQuotaOverflow = 3006,
+ kWebSocketErrorIdleTimeout = 3007,
+ kWebSocketErrorDropChannelAck = 3008,
+ kWebSocketErrorBadFragmentation = 3009,
+
+ // The range 3000-3999 is reserved by RFC6455 for registered use by libraries,
+ // frameworks and applications.
+ kWebSocketErrorRegisteredReservedMax = 3999,
+
+ // The range 4000-4999 is reserved by RFC6455 for private use by prior
+ // agreement of the endpoints.
+ kWebSocketErrorPrivateReservedMin = 4000,
+ kWebSocketErrorPrivateReservedMax = 4999,
};
// Convert WebSocketError to net::Error defined in net/base/net_errors.h.
@@ -22,4 +76,4 @@ NET_EXPORT_PRIVATE Error WebSocketErrorToNetError(WebSocketError error);
} // namespace net
-#endif // NET_WEBSOCKETS_WEBSOCKET_FRAME_H_
+#endif // NET_WEBSOCKETS_WEBSOCKET_ERRORS_H_
tyoshino (SeeGerritForStatus) 2013/05/02 13:56:22 good catch.
« no previous file with comments | « no previous file | net/websockets/websocket_errors.cc » ('j') | net/websockets/websocket_errors_unittest.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698