In HTTP/3, write Priority on control stream before writing headers.
Currently the priority is in gQUIC fashion, where we only use the weight to build priority queue.
Priority might be sent on the control stream before handshake is confirmed. So this CL modifies QuicSendControlStream to send stream type and settings before any other data is sent.
gfe-relnote: v99 only, not in prod.
PiperOrigin-RevId: 256285943
Change-Id: Iaf72f9d6256a2692b284e3f6142755ff0d04d710
diff --git a/quic/core/http/quic_spdy_stream.cc b/quic/core/http/quic_spdy_stream.cc
index 9966f81..c625410 100644
--- a/quic/core/http/quic_spdy_stream.cc
+++ b/quic/core/http/quic_spdy_stream.cc
@@ -168,6 +168,7 @@
trailers_length_(0, 0),
trailers_decompressed_(false),
trailers_consumed_(false),
+ priority_sent_(false),
headers_bytes_to_be_marked_consumed_(0),
pretend_blocked_decoding_for_tests_(false),
http_decoder_visitor_(new HttpDecoderVisitor(this)),
@@ -204,6 +205,7 @@
trailers_length_(0, 0),
trailers_decompressed_(false),
trailers_consumed_(false),
+ priority_sent_(false),
headers_bytes_to_be_marked_consumed_(0),
pretend_blocked_decoding_for_tests_(false),
http_decoder_visitor_(new HttpDecoderVisitor(this)),
@@ -920,6 +922,13 @@
std::move(ack_listener));
}
+ if (session()->perspective() == Perspective::IS_CLIENT && !priority_sent_) {
+ PriorityFrame frame;
+ PopulatePriorityFrame(&frame);
+ spdy_session_->WriteH3Priority(frame);
+ priority_sent_ = true;
+ }
+
// Encode header list.
std::string encoded_headers =
spdy_session_->qpack_encoder()->EncodeHeaderList(id(), &header_block);
@@ -948,5 +957,12 @@
return encoded_headers.size();
}
+void QuicSpdyStream::PopulatePriorityFrame(PriorityFrame* frame) {
+ frame->weight = priority();
+ frame->dependency_type = ROOT_OF_TREE;
+ frame->prioritized_type = REQUEST_STREAM;
+ frame->prioritized_element_id = id();
+}
+
#undef ENDPOINT // undef for jumbo builds
} // namespace quic