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

Unified Diff: net/spdy/spdy_framer.cc

Issue 2018513002: Plumb unmodified HTTP/2 stream weight value through SPDY framing code. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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 1b4972da738a8cc6dff78ad739b6e255daef928f..9eab64179dc0db2ed513f649c37a3bd5cc8e6d97 100644
--- a/net/spdy/spdy_framer.cc
+++ b/net/spdy/spdy_framer.cc
@@ -1502,7 +1502,7 @@ size_t SpdyFramer::ProcessControlFrameBeforeHeaderBlock(const char* data,
}
const bool has_priority =
(current_frame_flags_ & HEADERS_FLAG_PRIORITY) != 0;
- SpdyPriority priority = 0;
+ int weight = 0;
uint32_t parent_stream_id = 0;
bool exclusive = false;
if (protocol_version_ == HTTP2 && has_priority) {
@@ -1512,10 +1512,12 @@ size_t SpdyFramer::ProcessControlFrameBeforeHeaderBlock(const char* data,
UnpackStreamDependencyValues(stream_dependency, &exclusive,
&parent_stream_id);
- uint8_t weight = 0;
- successful_read = reader.ReadUInt8(&weight);
+ uint8_t serialized_weight = 0;
+ successful_read = reader.ReadUInt8(&serialized_weight);
if (successful_read) {
- priority = MapWeightToPriority(weight);
+ // Per RFC 7540 section 6.3, serialized weight value is actual
+ // value - 1.
+ weight = serialized_weight + 1;
}
}
DCHECK(reader.IsDoneReading());
@@ -1532,7 +1534,7 @@ size_t SpdyFramer::ProcessControlFrameBeforeHeaderBlock(const char* data,
} else {
visitor_->OnHeaders(
current_frame_stream_id_,
- (current_frame_flags_ & HEADERS_FLAG_PRIORITY) != 0, priority,
+ (current_frame_flags_ & HEADERS_FLAG_PRIORITY) != 0, weight,
parent_stream_id, exclusive,
(current_frame_flags_ & CONTROL_FLAG_FIN) != 0,
expect_continuation_ == 0);
@@ -2594,12 +2596,9 @@ SpdySerializedFrame SpdyFramer::SerializeHeaders(const SpdyHeadersIR& headers) {
size += headers.padding_payload_len();
}
- SpdyPriority priority = static_cast<SpdyPriority>(headers.priority());
+ int weight = 0;
if (headers.has_priority()) {
- if (headers.priority() > GetLowestPriority()) {
- SPDY_BUG << "Priority out-of-bounds.";
- priority = GetLowestPriority();
- }
+ weight = ClampHttp2Weight(headers.weight());
size += 5;
}
@@ -2645,7 +2644,8 @@ SpdySerializedFrame SpdyFramer::SerializeHeaders(const SpdyHeadersIR& headers) {
if (headers.has_priority()) {
builder.WriteUInt32(PackStreamDependencyValues(
headers.exclusive(), headers.parent_stream_id()));
- builder.WriteUInt8(MapPriorityToWeight(priority));
+ // Per RFC 7540 section 6.3, serialized weight value is actual value - 1.
+ builder.WriteUInt8(weight - 1);
}
WritePayloadWithContinuation(&builder,
hpack_encoding,
« 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