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

Unified Diff: net/spdy/spdy_framer.cc

Issue 243643002: Refactor RST_STREAM status code handling. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Expanded FRAME_TOO_LARGE/FRAME_SIZE_ERROR comment. Created 6 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 | « net/spdy/spdy_frame_builder.cc ('k') | net/spdy/spdy_framer_test.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/spdy/spdy_framer.cc
diff --git a/net/spdy/spdy_framer.cc b/net/spdy/spdy_framer.cc
index 23080accd994ad2c6982d3e639fdaab2a1c28981..5242e806b36b2d77aaba722e8dfb61c37a362cd1 100644
--- a/net/spdy/spdy_framer.cc
+++ b/net/spdy/spdy_framer.cc
@@ -438,6 +438,10 @@ const char* SpdyFramer::StatusCodeToString(int status_code) {
return "INVALID_CREDENTIALS";
case RST_STREAM_FRAME_TOO_LARGE:
return "FRAME_TOO_LARGE";
+ case RST_STREAM_CONNECT_ERROR:
+ return "CONNECT_ERROR";
+ case RST_STREAM_ENHANCE_YOUR_CALM:
+ return "ENHANCE_YOUR_CALM";
}
return "UNKNOWN_STATUS";
}
@@ -1816,10 +1820,8 @@ size_t SpdyFramer::ProcessRstStreamFramePayload(const char* data, size_t len) {
uint32 status_raw = status;
bool successful_read = reader.ReadUInt32(&status_raw);
DCHECK(successful_read);
- // We've read an unsigned integer, so it's enough to only check
- // upper bound to ensure the value is in valid range.
- if (status_raw > RST_STREAM_INVALID &&
- status_raw < RST_STREAM_NUM_STATUS_CODES) {
+ if (SpdyConstants::IsValidRstStreamStatus(protocol_version(),
+ status_raw)) {
status = static_cast<SpdyRstStreamStatus>(status_raw);
} else {
// TODO(hkhalil): Probably best to OnError here, depending on
« no previous file with comments | « net/spdy/spdy_frame_builder.cc ('k') | net/spdy/spdy_framer_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698