Add HTTP/2 error code from latest draft.
Add HTTP_1_1_REQUIRED error code for RST_STREAM and GOAWAY frames that was introduced in draft-15. Also add INADEQUATE_SECURTY error code wherever it had been forgotten. This lands server change 79690279 by bnc in spdy_framer.cc and spdy_protocol.{h,cc}. BUG=431306 Review URL: https://codereview.chromium.org/700583005 Cr-Commit-Position: refs/heads/master@{#303993}
This commit is contained in:
@ -480,6 +480,10 @@ const char* SpdyFramer::StatusCodeToString(int status_code) {
|
||||
return "CONNECT_ERROR";
|
||||
case RST_STREAM_ENHANCE_YOUR_CALM:
|
||||
return "ENHANCE_YOUR_CALM";
|
||||
case RST_STREAM_INADEQUATE_SECURITY:
|
||||
return "INADEQUATE_SECURITY";
|
||||
case RST_STREAM_HTTP_1_1_REQUIRED:
|
||||
return "HTTP_1_1_REQUIRED";
|
||||
}
|
||||
return "UNKNOWN_STATUS";
|
||||
}
|
||||
|
@ -372,9 +372,9 @@ bool SpdyConstants::IsValidRstStreamStatus(SpdyMajorVersion version,
|
||||
}
|
||||
*/
|
||||
|
||||
// ENHANCE_YOUR_CALM is the last valid status code.
|
||||
// HTTP_1_1_REQUIRED is the last valid status code.
|
||||
if (rst_stream_status_field >
|
||||
SerializeRstStreamStatus(version, RST_STREAM_ENHANCE_YOUR_CALM)) {
|
||||
SerializeRstStreamStatus(version, RST_STREAM_HTTP_1_1_REQUIRED)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -436,6 +436,10 @@ SpdyRstStreamStatus SpdyConstants::ParseRstStreamStatus(
|
||||
return RST_STREAM_CONNECT_ERROR;
|
||||
case 11:
|
||||
return RST_STREAM_ENHANCE_YOUR_CALM;
|
||||
case 12:
|
||||
return RST_STREAM_INADEQUATE_SECURITY;
|
||||
case 13:
|
||||
return RST_STREAM_HTTP_1_1_REQUIRED;
|
||||
}
|
||||
break;
|
||||
}
|
||||
@ -499,6 +503,10 @@ int SpdyConstants::SerializeRstStreamStatus(
|
||||
return 10;
|
||||
case RST_STREAM_ENHANCE_YOUR_CALM:
|
||||
return 11;
|
||||
case RST_STREAM_INADEQUATE_SECURITY:
|
||||
return 12;
|
||||
case RST_STREAM_HTTP_1_1_REQUIRED:
|
||||
return 13;
|
||||
default:
|
||||
LOG(DFATAL) << "Unhandled RST_STREAM status "
|
||||
<< rst_stream_status;
|
||||
@ -589,6 +597,8 @@ SpdyGoAwayStatus SpdyConstants::ParseGoAwayStatus(SpdyMajorVersion version,
|
||||
return GOAWAY_ENHANCE_YOUR_CALM;
|
||||
case 12:
|
||||
return GOAWAY_INADEQUATE_SECURITY;
|
||||
case 13:
|
||||
return GOAWAY_HTTP_1_1_REQUIRED;
|
||||
}
|
||||
break;
|
||||
}
|
||||
@ -666,6 +676,7 @@ int SpdyConstants::SerializeGoAwayStatus(SpdyMajorVersion version,
|
||||
case GOAWAY_CONNECT_ERROR:
|
||||
case GOAWAY_ENHANCE_YOUR_CALM:
|
||||
case GOAWAY_INADEQUATE_SECURITY:
|
||||
case GOAWAY_HTTP_1_1_REQUIRED:
|
||||
return 1; // PROTOCOL_ERROR.
|
||||
default:
|
||||
LOG(DFATAL) << "Serializing unhandled GOAWAY status " << status;
|
||||
@ -700,6 +711,8 @@ int SpdyConstants::SerializeGoAwayStatus(SpdyMajorVersion version,
|
||||
return 11;
|
||||
case GOAWAY_INADEQUATE_SECURITY:
|
||||
return 12;
|
||||
case GOAWAY_HTTP_1_1_REQUIRED:
|
||||
return 13;
|
||||
default:
|
||||
LOG(DFATAL) << "Serializing unhandled GOAWAY status " << status;
|
||||
return -1;
|
||||
|
@ -397,7 +397,9 @@ enum SpdyRstStreamStatus {
|
||||
RST_STREAM_SETTINGS_TIMEOUT = 12,
|
||||
RST_STREAM_CONNECT_ERROR = 13,
|
||||
RST_STREAM_ENHANCE_YOUR_CALM = 14,
|
||||
RST_STREAM_NUM_STATUS_CODES = 15
|
||||
RST_STREAM_INADEQUATE_SECURITY = 15,
|
||||
RST_STREAM_HTTP_1_1_REQUIRED = 16,
|
||||
RST_STREAM_NUM_STATUS_CODES = 17
|
||||
};
|
||||
|
||||
// Status codes for GOAWAY frames.
|
||||
@ -415,7 +417,8 @@ enum SpdyGoAwayStatus {
|
||||
GOAWAY_COMPRESSION_ERROR = 9,
|
||||
GOAWAY_CONNECT_ERROR = 10,
|
||||
GOAWAY_ENHANCE_YOUR_CALM = 11,
|
||||
GOAWAY_INADEQUATE_SECURITY = 12
|
||||
GOAWAY_INADEQUATE_SECURITY = 12,
|
||||
GOAWAY_HTTP_1_1_REQUIRED = 13
|
||||
};
|
||||
|
||||
// A SPDY priority is a number between 0 and 7 (inclusive).
|
||||
|
@ -398,6 +398,10 @@ SpdyProtocolErrorDetails MapRstStreamStatusToProtocolError(
|
||||
return STATUS_CODE_CONNECT_ERROR;
|
||||
case RST_STREAM_ENHANCE_YOUR_CALM:
|
||||
return STATUS_CODE_ENHANCE_YOUR_CALM;
|
||||
case RST_STREAM_INADEQUATE_SECURITY:
|
||||
return STATUS_CODE_INADEQUATE_SECURITY;
|
||||
case RST_STREAM_HTTP_1_1_REQUIRED:
|
||||
return STATUS_CODE_HTTP_1_1_REQUIRED;
|
||||
default:
|
||||
NOTREACHED();
|
||||
return static_cast<SpdyProtocolErrorDetails>(-1);
|
||||
|
@ -105,6 +105,8 @@ enum SpdyProtocolErrorDetails {
|
||||
STATUS_CODE_SETTINGS_TIMEOUT = 32,
|
||||
STATUS_CODE_CONNECT_ERROR = 33,
|
||||
STATUS_CODE_ENHANCE_YOUR_CALM = 34,
|
||||
STATUS_CODE_INADEQUATE_SECURITY = 35,
|
||||
STATUS_CODE_HTTP_1_1_REQUIRED = 36,
|
||||
|
||||
// SpdySession errors
|
||||
PROTOCOL_ERROR_UNEXPECTED_PING = 22,
|
||||
@ -116,7 +118,7 @@ enum SpdyProtocolErrorDetails {
|
||||
PROTOCOL_ERROR_RECEIVE_WINDOW_VIOLATION = 28,
|
||||
|
||||
// Next free value.
|
||||
NUM_SPDY_PROTOCOL_ERROR_DETAILS = 35,
|
||||
NUM_SPDY_PROTOCOL_ERROR_DETAILS = 37,
|
||||
};
|
||||
SpdyProtocolErrorDetails NET_EXPORT_PRIVATE
|
||||
MapFramerErrorToProtocolError(SpdyFramer::SpdyError error);
|
||||
@ -129,7 +131,7 @@ SpdyGoAwayStatus NET_EXPORT_PRIVATE MapNetErrorToGoAwayStatus(Error err);
|
||||
// to be updated with new values, as do the mapping functions above.
|
||||
COMPILE_ASSERT(12 == SpdyFramer::LAST_ERROR,
|
||||
SpdyProtocolErrorDetails_SpdyErrors_mismatch);
|
||||
COMPILE_ASSERT(15 == RST_STREAM_NUM_STATUS_CODES,
|
||||
COMPILE_ASSERT(17 == RST_STREAM_NUM_STATUS_CODES,
|
||||
SpdyProtocolErrorDetails_RstStreamStatus_mismatch);
|
||||
|
||||
// Splits pushed |headers| into request and response parts. Request headers are
|
||||
|
@ -5019,6 +5019,10 @@ TEST(MapRstStreamStatusToProtocolError, MapsValues) {
|
||||
MapRstStreamStatusToProtocolError(RST_STREAM_FRAME_SIZE_ERROR));
|
||||
CHECK_EQ(STATUS_CODE_ENHANCE_YOUR_CALM,
|
||||
MapRstStreamStatusToProtocolError(RST_STREAM_ENHANCE_YOUR_CALM));
|
||||
CHECK_EQ(STATUS_CODE_INADEQUATE_SECURITY,
|
||||
MapRstStreamStatusToProtocolError(RST_STREAM_INADEQUATE_SECURITY));
|
||||
CHECK_EQ(STATUS_CODE_HTTP_1_1_REQUIRED,
|
||||
MapRstStreamStatusToProtocolError(RST_STREAM_HTTP_1_1_REQUIRED));
|
||||
}
|
||||
|
||||
TEST(MapNetErrorToGoAwayStatus, MapsValue) {
|
||||
|
Reference in New Issue
Block a user