Remove PRIORITY frame. PRIORITY frame has been removed from the draft HTTP/3 spec at https://github.com/quicwg/base-drafts/pull/2922. Also remove protocol flag FLAGS_quic_allow_http3_priority. gfe-relnote: n/a, change to QUIC v99-only code. Protected by existing disabled gfe2_reloadable_flag_quic_enable_version_99. PiperOrigin-RevId: 289115003 Change-Id: I52891171f4c2b11107f0afc2db6e069963b13d6e
diff --git a/quic/core/http/http_decoder.cc b/quic/core/http/http_decoder.cc index 51c70e0..e3ca73e 100644 --- a/quic/core/http/http_decoder.cc +++ b/quic/core/http/http_decoder.cc
@@ -146,9 +146,6 @@ case static_cast<uint64_t>(HttpFrameType::HEADERS): continue_processing = visitor_->OnHeadersFrameStart(header_length); break; - case static_cast<uint64_t>(HttpFrameType::PRIORITY): - continue_processing = visitor_->OnPriorityFrameStart(header_length); - break; case static_cast<uint64_t>(HttpFrameType::CANCEL_PUSH): break; case static_cast<uint64_t>(HttpFrameType::SETTINGS): @@ -210,12 +207,6 @@ remaining_frame_length_ -= payload.length(); break; } - case static_cast<uint64_t>(HttpFrameType::PRIORITY): { - // TODO(rch): avoid buffering if the entire frame is present, and - // instead parse directly out of |reader|. - BufferFramePayload(reader); - break; - } case static_cast<uint64_t>(HttpFrameType::CANCEL_PUSH): { BufferFramePayload(reader); break; @@ -332,17 +323,6 @@ continue_processing = visitor_->OnHeadersFrameEnd(); break; } - case static_cast<uint64_t>(HttpFrameType::PRIORITY): { - // TODO(rch): avoid buffering if the entire frame is present, and - // instead parse directly out of |reader|. - PriorityFrame frame; - QuicDataReader reader(buffer_.data(), current_frame_length_); - if (!ParsePriorityFrame(&reader, &frame)) { - return false; - } - continue_processing = visitor_->OnPriorityFrame(frame); - break; - } case static_cast<uint64_t>(HttpFrameType::CANCEL_PUSH): { CancelPushFrame frame; QuicDataReader reader(buffer_.data(), current_frame_length_); @@ -508,51 +488,6 @@ visitor_->OnError(this); } -bool HttpDecoder::ParsePriorityFrame(QuicDataReader* reader, - PriorityFrame* frame) { - uint8_t flags; - if (!reader->ReadUInt8(&flags)) { - // TODO(b/124216424): Use HTTP_MALFORMED_FRAME. - RaiseError(QUIC_INVALID_FRAME_DATA, "Unable to read PRIORITY frame flags."); - return false; - } - - // Assign two most significant bits to prioritized_type. - frame->prioritized_type = static_cast<PriorityElementType>((flags >> 6) & 3); - // Assign the next two most significant bits to dependency type. - frame->dependency_type = static_cast<PriorityElementType>((flags >> 4) & 3); - frame->exclusive = flags & kPriorityExclusiveBit; - // TODO(bnc): Close connection with HTTP_MALFORMED_FRAME - // if lowest three bits are not all zero. - - if (frame->prioritized_type != ROOT_OF_TREE && - !reader->ReadVarInt62(&frame->prioritized_element_id)) { - // TODO(b/124216424): Use HTTP_MALFORMED_FRAME. - RaiseError(QUIC_INVALID_FRAME_DATA, - "Unable to read prioritized_element_id."); - return false; - } - if (frame->dependency_type != ROOT_OF_TREE && - !reader->ReadVarInt62(&frame->element_dependency_id)) { - // TODO(b/124216424): Use HTTP_MALFORMED_FRAME. - RaiseError(QUIC_INVALID_FRAME_DATA, - "Unable to read element_dependency_id."); - return false; - } - if (!reader->ReadUInt8(&frame->weight)) { - // TODO(b/124216424): Use HTTP_MALFORMED_FRAME. - RaiseError(QUIC_INVALID_FRAME_DATA, - "Unable to read PRIORITY frame weight."); - return false; - } - if (!reader->IsDoneReading()) { - // TODO(b/124216424): Use HTTP_MALFORMED_FRAME. - RaiseError(QUIC_INVALID_FRAME_DATA, "Superfluous data in PRIORITY frame."); - return false; - } - return true; -} - bool HttpDecoder::ParseSettingsFrame(QuicDataReader* reader, SettingsFrame* frame) { while (!reader->IsDoneReading()) { @@ -582,9 +517,6 @@ QuicByteCount HttpDecoder::MaxFrameLength(uint64_t frame_type) { switch (frame_type) { - case static_cast<uint64_t>(HttpFrameType::PRIORITY): - return kPriorityFirstByteLength + VARIABLE_LENGTH_INTEGER_LENGTH_8 * 2 + - kPriorityWeightLength; case static_cast<uint64_t>(HttpFrameType::CANCEL_PUSH): return sizeof(PushId); case static_cast<uint64_t>(HttpFrameType::SETTINGS):
diff --git a/quic/core/http/http_decoder.h b/quic/core/http/http_decoder.h index 1dc2225..a77ce6c 100644 --- a/quic/core/http/http_decoder.h +++ b/quic/core/http/http_decoder.h
@@ -39,13 +39,6 @@ // On*FrameStart() methods are called after the frame header is completely // processed. At that point it is safe to consume |header_length| bytes. - // Called when a PRIORITY frame has been received. - // |header_length| contains PRIORITY frame length and payload length. - virtual bool OnPriorityFrameStart(QuicByteCount header_length) = 0; - - // Called when a PRIORITY frame has been successfully parsed. - virtual bool OnPriorityFrame(const PriorityFrame& frame) = 0; - // Called when a CANCEL_PUSH frame has been successfully parsed. virtual bool OnCancelPushFrame(const CancelPushFrame& frame) = 0; @@ -181,9 +174,6 @@ // Sets |error_| and |error_detail_| accordingly. void RaiseError(QuicErrorCode error, std::string error_detail); - // Parses the payload of a PRIORITY frame from |reader| into |frame|. - bool ParsePriorityFrame(QuicDataReader* reader, PriorityFrame* frame); - // Parses the payload of a SETTINGS frame from |reader| into |frame|. bool ParseSettingsFrame(QuicDataReader* reader, SettingsFrame* frame);
diff --git a/quic/core/http/http_decoder_test.cc b/quic/core/http/http_decoder_test.cc index bcdf6c1..942edfd 100644 --- a/quic/core/http/http_decoder_test.cc +++ b/quic/core/http/http_decoder_test.cc
@@ -41,8 +41,6 @@ // Called if an error is detected. MOCK_METHOD1(OnError, void(HttpDecoder* decoder)); - MOCK_METHOD1(OnPriorityFrameStart, bool(QuicByteCount header_length)); - MOCK_METHOD1(OnPriorityFrame, bool(const PriorityFrame& frame)); MOCK_METHOD1(OnCancelPushFrame, bool(const CancelPushFrame& frame)); MOCK_METHOD1(OnMaxPushIdFrame, bool(const MaxPushIdFrame& frame)); MOCK_METHOD1(OnGoAwayFrame, bool(const GoAwayFrame& frame)); @@ -73,8 +71,6 @@ class HttpDecoderTest : public QuicTest { public: HttpDecoderTest() : decoder_(&visitor_) { - ON_CALL(visitor_, OnPriorityFrameStart(_)).WillByDefault(Return(true)); - ON_CALL(visitor_, OnPriorityFrame(_)).WillByDefault(Return(true)); ON_CALL(visitor_, OnCancelPushFrame(_)).WillByDefault(Return(true)); ON_CALL(visitor_, OnMaxPushIdFrame(_)).WillByDefault(Return(true)); ON_CALL(visitor_, OnGoAwayFrame(_)).WillByDefault(Return(true)); @@ -372,116 +368,6 @@ EXPECT_EQ("", decoder_.error_detail()); } -TEST_F(HttpDecoderTest, PriorityFrame) { - InSequence s; - std::string input = quiche::QuicheTextUtils::HexDecode( - "02" // type (PRIORITY) - "04" // length - "08" // request stream, request stream, exclusive - "03" // prioritized_element_id - "04" // element_dependency_id - "FF"); // weight - - PriorityFrame frame; - frame.prioritized_type = REQUEST_STREAM; - frame.dependency_type = REQUEST_STREAM; - frame.exclusive = true; - frame.prioritized_element_id = 0x03; - frame.element_dependency_id = 0x04; - frame.weight = 0xFF; - - // Visitor pauses processing. - EXPECT_CALL(visitor_, OnPriorityFrameStart(2)).WillOnce(Return(false)); - quiche::QuicheStringPiece remaining_input(input); - QuicByteCount processed_bytes = - ProcessInputWithGarbageAppended(remaining_input); - EXPECT_EQ(2u, processed_bytes); - remaining_input = remaining_input.substr(processed_bytes); - - EXPECT_CALL(visitor_, OnPriorityFrame(frame)).WillOnce(Return(false)); - processed_bytes = ProcessInputWithGarbageAppended(remaining_input); - EXPECT_EQ(remaining_input.size(), processed_bytes); - EXPECT_THAT(decoder_.error(), IsQuicNoError()); - EXPECT_EQ("", decoder_.error_detail()); - - // Process the full frame. - EXPECT_CALL(visitor_, OnPriorityFrameStart(2)); - EXPECT_CALL(visitor_, OnPriorityFrame(frame)); - EXPECT_EQ(input.size(), ProcessInput(input)); - EXPECT_THAT(decoder_.error(), IsQuicNoError()); - EXPECT_EQ("", decoder_.error_detail()); - - // Process the frame incrementally. - EXPECT_CALL(visitor_, OnPriorityFrameStart(2)); - EXPECT_CALL(visitor_, OnPriorityFrame(frame)); - ProcessInputCharByChar(input); - EXPECT_THAT(decoder_.error(), IsQuicNoError()); - EXPECT_EQ("", decoder_.error_detail()); - - std::string input2 = quiche::QuicheTextUtils::HexDecode( - "02" // type (PRIORITY) - "02" // length - "f8" // root of tree, root of tree, exclusive - "FF"); // weight - PriorityFrame frame2; - frame2.prioritized_type = ROOT_OF_TREE; - frame2.dependency_type = ROOT_OF_TREE; - frame2.exclusive = true; - frame2.weight = 0xFF; - - EXPECT_CALL(visitor_, OnPriorityFrameStart(2)); - EXPECT_CALL(visitor_, OnPriorityFrame(frame2)); - EXPECT_EQ(input2.size(), ProcessInput(input2)); - EXPECT_THAT(decoder_.error(), IsQuicNoError()); - EXPECT_EQ("", decoder_.error_detail()); -} - -// Regression test for https://crbug.com/981291 and https://crbug.com/981646. -TEST_F(HttpDecoderTest, CorruptPriorityFrame) { - const char* const payload1 = - "\x01" // request stream, request stream, exclusive - "\x03" // prioritized_element_id - "\x04" // element_dependency_id - "\xFF" // weight - "\xFF"; // superfluous data - const char* const payload2 = - "\xf1" // root of tree, root of tree, exclusive - "\xFF" // weight - "\xFF"; // superfluous data - struct { - const char* const payload; - size_t payload_length; - const char* const error_message; - } kTestData[] = { - {payload1, 0, "Unable to read PRIORITY frame flags."}, - {payload1, 1, "Unable to read prioritized_element_id."}, - {payload1, 2, "Unable to read element_dependency_id."}, - {payload1, 3, "Unable to read PRIORITY frame weight."}, - {payload1, 5, "Superfluous data in PRIORITY frame."}, - {payload2, 0, "Unable to read PRIORITY frame flags."}, - {payload2, 1, "Unable to read PRIORITY frame weight."}, - {payload2, 3, "Superfluous data in PRIORITY frame."}, - }; - - for (const auto& test_data : kTestData) { - std::string input; - input.push_back(2u); // type PRIORITY - input.push_back(test_data.payload_length); - size_t header_length = input.size(); - input.append(test_data.payload, test_data.payload_length); - - HttpDecoder decoder(&visitor_); - EXPECT_CALL(visitor_, OnPriorityFrameStart(header_length)); - EXPECT_CALL(visitor_, OnError(&decoder)); - - QuicByteCount processed_bytes = - decoder.ProcessInput(input.data(), input.size()); - EXPECT_EQ(input.size(), processed_bytes); - EXPECT_THAT(decoder.error(), IsError(QUIC_INVALID_FRAME_DATA)); - EXPECT_EQ(test_data.error_message, decoder.error_detail()); - } -} - TEST_F(HttpDecoderTest, SettingsFrame) { InSequence s; std::string input = quiche::QuicheTextUtils::HexDecode(
diff --git a/quic/core/http/http_encoder.cc b/quic/core/http/http_encoder.cc index 481c469..2f35897 100644 --- a/quic/core/http/http_encoder.cc +++ b/quic/core/http/http_encoder.cc
@@ -11,36 +11,6 @@ namespace { -// Set the first byte of a PRIORITY frame according to its fields. -uint8_t SetPriorityFields(uint8_t num, - PriorityElementType type, - bool prioritized) { - switch (type) { - case REQUEST_STREAM: - return num; - case PUSH_STREAM: - if (prioritized) { - return num | (1 << 6); - } - return num | (1 << 4); - case PLACEHOLDER: - if (prioritized) { - return num | (1 << 7); - } - return num | (1 << 5); - case ROOT_OF_TREE: - if (prioritized) { - num = num | (1 << 6); - return num | (1 << 7); - } - num = num | (1 << 4); - return num | (1 << 5); - default: - QUIC_NOTREACHED(); - return num; - } -} - bool WriteFrameHeader(QuicByteCount length, HttpFrameType type, QuicDataWriter* writer) { @@ -54,29 +24,6 @@ payload_length; } -// Write prioritized element id and element dependency id if needed. -bool MaybeWriteIds(const PriorityFrame& priority, QuicDataWriter* writer) { - if (priority.prioritized_type != ROOT_OF_TREE) { - if (!writer->WriteVarInt62(priority.prioritized_element_id)) { - return false; - } - } else { - DCHECK_EQ(0u, priority.prioritized_element_id) - << "Prioritized element id should be 0 when prioritized type is " - "ROOT_OF_TREE"; - } - if (priority.dependency_type != ROOT_OF_TREE) { - if (!writer->WriteVarInt62(priority.element_dependency_id)) { - return false; - } - } else { - DCHECK_EQ(0u, priority.element_dependency_id) - << "Element dependency id should be 0 when dependency type is " - "ROOT_OF_TREE"; - } - return true; -} - } // namespace // static @@ -122,48 +69,6 @@ } // static -QuicByteCount HttpEncoder::SerializePriorityFrame( - const PriorityFrame& priority, - std::unique_ptr<char[]>* output) { - QuicByteCount payload_length = - kPriorityFirstByteLength + - (priority.prioritized_type == ROOT_OF_TREE - ? 0 - : QuicDataWriter::GetVarInt62Len(priority.prioritized_element_id)) + - (priority.dependency_type == ROOT_OF_TREE - ? 0 - : QuicDataWriter::GetVarInt62Len(priority.element_dependency_id)) + - kPriorityWeightLength; - QuicByteCount total_length = - GetTotalLength(payload_length, HttpFrameType::PRIORITY); - - output->reset(new char[total_length]); - QuicDataWriter writer(total_length, output->get()); - - if (!WriteFrameHeader(payload_length, HttpFrameType::PRIORITY, &writer)) { - QUIC_DLOG(ERROR) << "Http encoder failed when attempting to serialize " - "priority frame header."; - return 0; - } - - // Set the first byte of the payload. - uint8_t firstByte = 0; - firstByte = SetPriorityFields(firstByte, priority.prioritized_type, true); - firstByte = SetPriorityFields(firstByte, priority.dependency_type, false); - if (priority.exclusive) { - firstByte |= kPriorityExclusiveBit; - } - - if (writer.WriteUInt8(firstByte) && MaybeWriteIds(priority, &writer) && - writer.WriteUInt8(priority.weight)) { - return total_length; - } - QUIC_DLOG(ERROR) << "Http encoder failed when attempting to serialize " - "priority frame payload."; - return 0; -} - -// static QuicByteCount HttpEncoder::SerializeCancelPushFrame( const CancelPushFrame& cancel_push, std::unique_ptr<char[]>* output) {
diff --git a/quic/core/http/http_encoder.h b/quic/core/http/http_encoder.h index 4420fc6..b856187 100644 --- a/quic/core/http/http_encoder.h +++ b/quic/core/http/http_encoder.h
@@ -31,11 +31,6 @@ QuicByteCount payload_length, std::unique_ptr<char[]>* output); - // Serializes a PRIORITY frame into a new buffer stored in |output|. - // Returns the length of the buffer on success, or 0 otherwise. - static QuicByteCount SerializePriorityFrame(const PriorityFrame& priority, - std::unique_ptr<char[]>* output); - // Serializes a CANCEL_PUSH frame into a new buffer stored in |output|. // Returns the length of the buffer on success, or 0 otherwise. static QuicByteCount SerializeCancelPushFrame(
diff --git a/quic/core/http/http_encoder_test.cc b/quic/core/http/http_encoder_test.cc index 5c99b7d..5ad79d8 100644 --- a/quic/core/http/http_encoder_test.cc +++ b/quic/core/http/http_encoder_test.cc
@@ -38,73 +38,6 @@ output, QUICHE_ARRAYSIZE(output)); } -TEST(HttpEncoderTest, SerializePriorityFrame) { - PriorityFrame priority; - priority.prioritized_type = REQUEST_STREAM; - priority.dependency_type = REQUEST_STREAM; - priority.exclusive = true; - priority.prioritized_element_id = 0x03; - priority.element_dependency_id = 0x04; - priority.weight = 0xFF; - char output[] = {// type (PRIORITY) - 0x2, - // length - 0x4, - // request stream, request stream, exclusive - 0x08, - // prioritized_element_id - 0x03, - // element_dependency_id - 0x04, - // weight - 0xFF}; - - std::unique_ptr<char[]> buffer; - uint64_t length = HttpEncoder::SerializePriorityFrame(priority, &buffer); - EXPECT_EQ(QUICHE_ARRAYSIZE(output), length); - quiche::test::CompareCharArraysWithHexError("PRIORITY", buffer.get(), length, - output, QUICHE_ARRAYSIZE(output)); - - PriorityFrame priority2; - priority2.prioritized_type = ROOT_OF_TREE; - priority2.dependency_type = REQUEST_STREAM; - priority2.exclusive = true; - priority2.element_dependency_id = 0x04; - priority2.weight = 0xFF; - char output2[] = {// type (PRIORIRTY) - 0x2, - // length - 0x3, - // root of tree, request stream, exclusive - 0xc8, - // element_dependency_id - 0x04, - // weight - 0xff}; - length = HttpEncoder::SerializePriorityFrame(priority2, &buffer); - EXPECT_EQ(QUICHE_ARRAYSIZE(output2), length); - quiche::test::CompareCharArraysWithHexError( - "PRIORITY", buffer.get(), length, output2, QUICHE_ARRAYSIZE(output2)); - - PriorityFrame priority3; - priority3.prioritized_type = ROOT_OF_TREE; - priority3.dependency_type = ROOT_OF_TREE; - priority3.exclusive = true; - priority3.weight = 0xFF; - char output3[] = {// type (PRIORITY) - 0x2, - // length - 0x2, - // root of tree, root of tree, exclusive - 0xf8, - // weight - 0xff}; - length = HttpEncoder::SerializePriorityFrame(priority3, &buffer); - EXPECT_EQ(QUICHE_ARRAYSIZE(output3), length); - quiche::test::CompareCharArraysWithHexError( - "PRIORITY", buffer.get(), length, output3, QUICHE_ARRAYSIZE(output3)); -} - TEST(HttpEncoderTest, SerializeCancelPushFrame) { CancelPushFrame cancel_push; cancel_push.push_id = 0x01;
diff --git a/quic/core/http/http_frames.h b/quic/core/http/http_frames.h index de0abc4..6ad6da7 100644 --- a/quic/core/http/http_frames.h +++ b/quic/core/http/http_frames.h
@@ -21,7 +21,6 @@ enum class HttpFrameType : uint8_t { DATA = 0x0, HEADERS = 0x1, - PRIORITY = 0X2, CANCEL_PUSH = 0X3, SETTINGS = 0x4, PUSH_PROMISE = 0x5, @@ -30,7 +29,7 @@ DUPLICATE_PUSH = 0xE }; -// 4.2.1. DATA +// 7.2.1. DATA // // DATA frames (type=0x0) convey arbitrary, variable-length sequences of // octets associated with an HTTP request or response payload. @@ -38,7 +37,7 @@ quiche::QuicheStringPiece data; }; -// 4.2.2. HEADERS +// 7.2.2. HEADERS // // The HEADERS frame (type=0x1) is used to carry a header block, // compressed using QPACK. @@ -46,58 +45,7 @@ quiche::QuicheStringPiece headers; }; -// 4.2.3. PRIORITY -// -// The PRIORITY (type=0x02) frame specifies the sender-advised priority -// of a stream - -// Length of the weight field of a priority frame. -const QuicByteCount kPriorityWeightLength = 1; -// Length of a priority frame's first byte. -const QuicByteCount kPriorityFirstByteLength = 1; -// The bit that indicates Priority frame is exclusive. -const uint8_t kPriorityExclusiveBit = 8; - -enum PriorityElementType : uint8_t { - REQUEST_STREAM = 0, - PUSH_STREAM = 1, - PLACEHOLDER = 2, - ROOT_OF_TREE = 3 -}; - -struct QUIC_EXPORT_PRIVATE PriorityFrame { - PriorityElementType prioritized_type = REQUEST_STREAM; - PriorityElementType dependency_type = REQUEST_STREAM; - bool exclusive = false; - uint64_t prioritized_element_id = 0; - uint64_t element_dependency_id = 0; - uint8_t weight = 0; - - bool operator==(const PriorityFrame& rhs) const { - return prioritized_type == rhs.prioritized_type && - dependency_type == rhs.dependency_type && - exclusive == rhs.exclusive && - prioritized_element_id == rhs.prioritized_element_id && - element_dependency_id == rhs.element_dependency_id && - weight == rhs.weight; - } - std::string ToString() const { - return quiche::QuicheStrCat( - "Priority Frame : {prioritized_type: ", prioritized_type, - ", dependency_type: ", dependency_type, ", exclusive: ", exclusive, - ", prioritized_element_id: ", prioritized_element_id, - ", element_dependency_id: ", element_dependency_id, - ", weight: ", weight, "}"); - } - - friend QUIC_EXPORT_PRIVATE std::ostream& operator<<(std::ostream& os, - const PriorityFrame& s) { - os << s.ToString(); - return os; - } -}; - -// 4.2.4. CANCEL_PUSH +// 7.2.3. CANCEL_PUSH // // The CANCEL_PUSH frame (type=0x3) is used to request cancellation of // server push prior to the push stream being created. @@ -111,7 +59,7 @@ } }; -// 4.2.5. SETTINGS +// 7.2.4. SETTINGS // // The SETTINGS frame (type=0x4) conveys configuration parameters that // affect how endpoints communicate, such as preferences and constraints @@ -144,7 +92,7 @@ } }; -// 4.2.6. PUSH_PROMISE +// 7.2.5. PUSH_PROMISE // // The PUSH_PROMISE frame (type=0x05) is used to carry a request header // set from server to client, as in HTTP/2. @@ -157,7 +105,7 @@ } }; -// 4.2.7. GOAWAY +// 7.2.6. GOAWAY // // The GOAWAY frame (type=0x7) is used to initiate graceful shutdown of // a connection by a server. @@ -169,7 +117,7 @@ } }; -// 4.2.8. MAX_PUSH_ID +// 7.2.7. MAX_PUSH_ID // // The MAX_PUSH_ID frame (type=0xD) is used by clients to control the // number of server pushes that the server can initiate. @@ -181,7 +129,7 @@ } }; -// 4.2.9. DUPLICATE_PUSH +// 7.2.8. DUPLICATE_PUSH // // The DUPLICATE_PUSH frame (type=0xE) is used by servers to indicate // that an existing pushed resource is related to multiple client
diff --git a/quic/core/http/quic_receive_control_stream.cc b/quic/core/http/quic_receive_control_stream.cc index 26d2e82..2269faf 100644 --- a/quic/core/http/quic_receive_control_stream.cc +++ b/quic/core/http/quic_receive_control_stream.cc
@@ -10,7 +10,6 @@ #include "net/third_party/quiche/src/quic/core/http/http_decoder.h" #include "net/third_party/quiche/src/quic/core/http/quic_spdy_session.h" #include "net/third_party/quiche/src/quic/core/quic_types.h" -#include "net/third_party/quiche/src/quic/platform/api/quic_flags.h" #include "net/third_party/quiche/src/common/platform/api/quiche_string_piece.h" namespace quic { @@ -31,26 +30,6 @@ ConnectionCloseBehavior::SEND_CONNECTION_CLOSE_PACKET); } - bool OnPriorityFrameStart(QuicByteCount header_length) override { - if (stream_->session()->perspective() == Perspective::IS_CLIENT) { - stream_->session()->connection()->CloseConnection( - QUIC_HTTP_DECODER_ERROR, "Server must not send Priority frames.", - ConnectionCloseBehavior::SEND_CONNECTION_CLOSE_PACKET); - return false; - } - return stream_->OnPriorityFrameStart(header_length); - } - - bool OnPriorityFrame(const PriorityFrame& frame) override { - if (stream_->session()->perspective() == Perspective::IS_CLIENT) { - stream_->session()->connection()->CloseConnection( - QUIC_HTTP_DECODER_ERROR, "Server must not send Priority frames.", - ConnectionCloseBehavior::SEND_CONNECTION_CLOSE_PACKET); - return false; - } - return stream_->OnPriorityFrame(frame); - } - bool OnCancelPushFrame(const CancelPushFrame& /*frame*/) override { CloseConnectionOnWrongFrame("Cancel Push"); return false; @@ -238,26 +217,4 @@ return true; } -bool QuicReceiveControlStream::OnPriorityFrameStart( - QuicByteCount /* header_length */) { - DCHECK_EQ(Perspective::IS_SERVER, session()->perspective()); - return true; -} - -bool QuicReceiveControlStream::OnPriorityFrame(const PriorityFrame& priority) { - DCHECK_EQ(Perspective::IS_SERVER, session()->perspective()); - if (!GetQuicFlag(FLAGS_quic_allow_http3_priority)) { - return true; - } - QuicStream* stream = - session()->GetOrCreateStream(priority.prioritized_element_id); - // It's possible that the client sends a Priority frame for a request stream - // that the server is not permitted to open. In that case, simply drop the - // frame. - if (stream) { - stream->SetPriority(spdy::SpdyStreamPrecedence(priority.weight)); - } - return true; -} - } // namespace quic
diff --git a/quic/core/http/quic_receive_control_stream.h b/quic/core/http/quic_receive_control_stream.h index 84217ce..58a0be7 100644 --- a/quic/core/http/quic_receive_control_stream.h +++ b/quic/core/http/quic_receive_control_stream.h
@@ -38,9 +38,6 @@ // Called from HttpDecoderVisitor. bool OnSettingsFrameStart(QuicByteCount header_length); bool OnSettingsFrame(const SettingsFrame& settings); - bool OnPriorityFrameStart(QuicByteCount header_length); - // TODO(renjietang): Decode Priority in HTTP/3 style. - bool OnPriorityFrame(const PriorityFrame& priority); // False until a SETTINGS frame is received. bool settings_frame_received_;
diff --git a/quic/core/http/quic_receive_control_stream_test.cc b/quic/core/http/quic_receive_control_stream_test.cc index b9a2923..b603efc 100644 --- a/quic/core/http/quic_receive_control_stream_test.cc +++ b/quic/core/http/quic_receive_control_stream_test.cc
@@ -110,13 +110,6 @@ return std::string(buffer.get(), settings_frame_length); } - std::string PriorityFrame(const PriorityFrame& frame) { - std::unique_ptr<char[]> priority_buffer; - QuicByteCount priority_frame_length = - HttpEncoder::SerializePriorityFrame(frame, &priority_buffer); - return std::string(priority_buffer.get(), priority_frame_length); - } - QuicStreamOffset NumBytesConsumed() { return QuicStreamPeer::sequencer(receive_control_stream_) ->NumBytesConsumed(); @@ -225,25 +218,6 @@ receive_control_stream_->OnStreamFrame(frame); } -TEST_P(QuicReceiveControlStreamTest, ReceivePriorityFrame) { - if (perspective() == Perspective::IS_CLIENT) { - return; - } - SetQuicFlag(FLAGS_quic_allow_http3_priority, true); - struct PriorityFrame frame; - frame.prioritized_type = REQUEST_STREAM; - frame.dependency_type = ROOT_OF_TREE; - frame.prioritized_element_id = stream_->id(); - frame.weight = 1; - std::string serialized_frame = PriorityFrame(frame); - QuicStreamFrame data(receive_control_stream_->id(), false, 1, - serialized_frame); - - EXPECT_EQ(3u, stream_->precedence().spdy3_priority()); - receive_control_stream_->OnStreamFrame(data); - EXPECT_EQ(1u, stream_->precedence().spdy3_priority()); -} - TEST_P(QuicReceiveControlStreamTest, ReceiveGoAwayFrame) { GoAwayFrame goaway; goaway.stream_id = 0x00;
diff --git a/quic/core/http/quic_send_control_stream.cc b/quic/core/http/quic_send_control_stream.cc index 7146361..2da2118 100644 --- a/quic/core/http/quic_send_control_stream.cc +++ b/quic/core/http/quic_send_control_stream.cc
@@ -72,17 +72,6 @@ settings_sent_ = true; } -void QuicSendControlStream::WritePriority(const PriorityFrame& priority) { - QuicConnection::ScopedPacketFlusher flusher(session()->connection()); - MaybeSendSettingsFrame(); - std::unique_ptr<char[]> buffer; - QuicByteCount frame_length = - HttpEncoder::SerializePriorityFrame(priority, &buffer); - QUIC_DVLOG(1) << "Control Stream " << id() << " is writing " << priority; - WriteOrBufferData(quiche::QuicheStringPiece(buffer.get(), frame_length), - false, nullptr); -} - void QuicSendControlStream::SendMaxPushIdFrame(PushId max_push_id) { QuicConnection::ScopedPacketFlusher flusher(session()->connection());
diff --git a/quic/core/http/quic_send_control_stream.h b/quic/core/http/quic_send_control_stream.h index 30f50ab..f8c9515 100644 --- a/quic/core/http/quic_send_control_stream.h +++ b/quic/core/http/quic_send_control_stream.h
@@ -41,9 +41,6 @@ // Construct a MAX_PUSH_ID frame and send it on this stream. void SendMaxPushIdFrame(PushId max_push_id); - // Send |Priority| on this stream. It must be sent after settings. - void WritePriority(const PriorityFrame& priority); - // Serialize a GOAWAY frame from |stream_id| and send it on this stream. void SendGoAway(QuicStreamId stream_id);
diff --git a/quic/core/http/quic_send_control_stream_test.cc b/quic/core/http/quic_send_control_stream_test.cc index ab5b89a..5da6448 100644 --- a/quic/core/http/quic_send_control_stream_test.cc +++ b/quic/core/http/quic_send_control_stream_test.cc
@@ -157,20 +157,6 @@ send_control_stream_->MaybeSendSettingsFrame(); } -TEST_P(QuicSendControlStreamTest, WritePriorityBeforeSettings) { - Initialize(); - testing::InSequence s; - - // The first write will trigger the control stream to write stream type and a - // Settings frame before the Priority frame. - EXPECT_CALL(session_, WritevData(send_control_stream_, _, _, _, _)).Times(3); - PriorityFrame frame; - send_control_stream_->WritePriority(frame); - - EXPECT_CALL(session_, WritevData(send_control_stream_, _, _, _, _)); - send_control_stream_->WritePriority(frame); -} - TEST_P(QuicSendControlStreamTest, ResetControlStream) { Initialize(); QuicRstStreamFrame rst_frame(kInvalidControlFrameId,
diff --git a/quic/core/http/quic_spdy_session.cc b/quic/core/http/quic_spdy_session.cc index 1aef2e3..209e46f 100644 --- a/quic/core/http/quic_spdy_session.cc +++ b/quic/core/http/quic_spdy_session.cc
@@ -531,16 +531,6 @@ return frame.size(); } -void QuicSpdySession::WriteH3Priority(const PriorityFrame& priority) { - DCHECK(VersionUsesHttp3(transport_version())); - DCHECK(GetQuicFlag(FLAGS_quic_allow_http3_priority)); - DCHECK(perspective() == Perspective::IS_CLIENT) - << "Server must not send priority"; - - QuicConnection::ScopedPacketFlusher flusher(connection()); - send_control_stream_->WritePriority(priority); -} - void QuicSpdySession::OnHttp3GoAway(QuicStreamId stream_id) { DCHECK_EQ(perspective(), Perspective::IS_CLIENT); if (!QuicUtils::IsBidirectionalStreamId(stream_id) ||
diff --git a/quic/core/http/quic_spdy_session.h b/quic/core/http/quic_spdy_session.h index 032ee12..b0a83e9 100644 --- a/quic/core/http/quic_spdy_session.h +++ b/quic/core/http/quic_spdy_session.h
@@ -149,9 +149,6 @@ int weight, bool exclusive); - // Writes a HTTP/3 PRIORITY frame to the peer. - void WriteH3Priority(const PriorityFrame& priority); - // Process received HTTP/3 GOAWAY frame. This method should only be called on // the client side. virtual void OnHttp3GoAway(QuicStreamId stream_id);
diff --git a/quic/core/http/quic_spdy_stream.cc b/quic/core/http/quic_spdy_stream.cc index ce3cb3e..4d36df0 100644 --- a/quic/core/http/quic_spdy_stream.cc +++ b/quic/core/http/quic_spdy_stream.cc
@@ -46,16 +46,6 @@ ConnectionCloseBehavior::SEND_CONNECTION_CLOSE_PACKET); } - bool OnPriorityFrameStart(QuicByteCount /*header_length*/) override { - CloseConnectionOnWrongFrame("Priority"); - return false; - } - - bool OnPriorityFrame(const PriorityFrame& /*frame*/) override { - CloseConnectionOnWrongFrame("Priority"); - return false; - } - bool OnCancelPushFrame(const CancelPushFrame& /*frame*/) override { CloseConnectionOnWrongFrame("Cancel Push"); return false; @@ -1037,13 +1027,7 @@ std::move(ack_listener)); } - if (GetQuicFlag(FLAGS_quic_allow_http3_priority) && - session()->perspective() == Perspective::IS_CLIENT && !priority_sent_) { - PriorityFrame frame; - PopulatePriorityFrame(&frame); - spdy_session_->WriteH3Priority(frame); - priority_sent_ = true; - } + // TODO(b/147306124): Send PRIORITY_UPDATE frame. // Encode header list. QuicByteCount encoder_stream_sent_byte_count; @@ -1081,12 +1065,5 @@ return encoded_headers.size() + encoder_stream_sent_byte_count; } -void QuicSpdyStream::PopulatePriorityFrame(PriorityFrame* frame) { - frame->weight = precedence().spdy3_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
diff --git a/quic/core/http/quic_spdy_stream.h b/quic/core/http/quic_spdy_stream.h index 419b88f..49fe1dc 100644 --- a/quic/core/http/quic_spdy_stream.h +++ b/quic/core/http/quic_spdy_stream.h
@@ -246,9 +246,6 @@ ack_listener_ = std::move(ack_listener); } - // Fills in |frame| with appropriate fields. - virtual void PopulatePriorityFrame(PriorityFrame* frame); - private: friend class test::QuicSpdyStreamPeer; friend class test::QuicStreamPeer;
diff --git a/quic/core/http/quic_spdy_stream_test.cc b/quic/core/http/quic_spdy_stream_test.cc index 9b17b65..1a01015 100644 --- a/quic/core/http/quic_spdy_stream_test.cc +++ b/quic/core/http/quic_spdy_stream_test.cc
@@ -1280,37 +1280,6 @@ EXPECT_TRUE(stream_->fin_sent()); } -TEST_P(QuicSpdyStreamTest, ClientWritesPriority) { - SetQuicFlag(FLAGS_quic_allow_http3_priority, true); - InitializeWithPerspective(kShouldProcessData, Perspective::IS_CLIENT); - - if (UsesHttp3()) { - // In this case, TestStream::WriteHeadersImpl() does not prevent writes. - // Six writes include priority for headers, headers frame header, headers - // frame, priority of trailers, trailing headers frame header, and trailers. - EXPECT_CALL(*session_, WritevData(stream_, stream_->id(), _, _, _)) - .Times(4); - auto send_control_stream = - QuicSpdySessionPeer::GetSendControlStream(session_.get()); - // The control stream will write priority for headers as well as - // the settings/max_push_id. - EXPECT_CALL(*session_, WritevData(send_control_stream, - send_control_stream->id(), _, _, _)) - .Times(1); - } - - // Write the initial headers, without a FIN. - EXPECT_CALL(*stream_, WriteHeadersMock(false)); - stream_->WriteHeaders(SpdyHeaderBlock(), /*fin=*/false, nullptr); - - // Writing trailers implicitly sends a FIN. - SpdyHeaderBlock trailers; - trailers["trailer key"] = "trailer value"; - EXPECT_CALL(*stream_, WriteHeadersMock(true)); - stream_->WriteTrailers(std::move(trailers), nullptr); - EXPECT_TRUE(stream_->fin_sent()); -} - // Test that when writing trailers, the trailers that are actually sent to the // peer contain the final offset field indicating last byte of data. TEST_P(QuicSpdyStreamTest, WritingTrailersFinalOffset) {