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

Unified Diff: net/spdy/spdy_framer.cc

Issue 286313002: Accept and ignore PRIORITY frames in SPDY4+. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 7 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_framer.h ('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 ebc523b06156981bd371077d1d3b2dd9d0332af4..f7b52831d7912d9bf166f3bbfb55f35d2559c948 100644
--- a/net/spdy/spdy_framer.cc
+++ b/net/spdy/spdy_framer.cc
@@ -305,13 +305,13 @@ size_t SpdyFramer::GetPushPromiseMinimumSize() const {
return GetControlFrameHeaderSize() + 4;
}
-size_t SpdyFramer::GetContinuationMinimumSize() const {
+size_t SpdyFramer::GetContinuationMinimumSize() const {
// Size, in bytes, of a CONTINUATION frame not including the variable-length
// headers fragments.
return GetControlFrameHeaderSize();
}
-size_t SpdyFramer::GetAltSvcMinimumSize() const {
+size_t SpdyFramer::GetAltSvcMinimumSize() const {
// Size, in bytes, of an ALTSVC frame not including the Protocol-ID, Host, and
// (optional) Origin fields, all of which can vary in length.
// Note that this gives a lower bound on the frame size rather than a true
@@ -321,6 +321,12 @@ size_t SpdyFramer::GetAltSvcMinimumSize() const {
return GetControlFrameHeaderSize() + 9;
}
+size_t SpdyFramer::GetPrioritySize() const {
+ // Size, in bytes, of a PRIORITY frame.
+ // Calculated as frame prefix + 4 (stream dependency) + 1 (weight)
+ return GetControlFrameHeaderSize() + 5;
+}
+
size_t SpdyFramer::GetFrameMinimumSize() const {
return std::min(GetDataFrameMinimumSize(), GetControlFrameHeaderSize());
}
@@ -478,6 +484,8 @@ const char* SpdyFramer::FrameTypeToString(SpdyFrameType type) {
return "CONTINUATION";
case ALTSVC:
return "ALTSVC";
+ case PRIORITY:
+ return "PRIORITY";
}
return "UNKNOWN_CONTROL_TYPE";
}
@@ -969,6 +977,14 @@ void SpdyFramer::ProcessControlFrameHeader(uint16 control_frame_type_field) {
set_error(SPDY_INVALID_CONTROL_FRAME_FLAGS);
}
break;
+ case PRIORITY:
+ if (current_frame_length_ != GetPrioritySize() ||
+ protocol_version() <= SPDY3) {
+ set_error(SPDY_INVALID_CONTROL_FRAME);
+ } else if (current_frame_flags_ != 0) {
+ set_error(SPDY_INVALID_CONTROL_FRAME_FLAGS);
+ }
+ break;
default:
LOG(WARNING) << "Valid " << display_protocol_
<< " control frame with unhandled type: "
@@ -1748,6 +1764,13 @@ size_t SpdyFramer::ProcessControlFramePayload(const char* data, size_t len) {
visitor_->OnBlocked(current_frame_stream_id_);
}
break;
+ case PRIORITY: {
+ DCHECK_LT(SPDY3, protocol_version());
+ // TODO(hkhalil): Process PRIORITY frames rather than ignore them.
+ reader.Seek(5);
+ DCHECK(reader.IsDoneReading());
+ }
+ break;
default:
// Unreachable.
LOG(FATAL) << "Unhandled control frame " << current_frame_type_;
« no previous file with comments | « net/spdy/spdy_framer.h ('k') | net/spdy/spdy_framer_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698