Migrates remaining google3 users of spdy::Http2HeaderBlock to quiche::HttpHeaderBlock. Protected by refactoring, no functional change; not protected. PiperOrigin-RevId: 678863755
diff --git a/quiche/http2/core/spdy_framer.cc b/quiche/http2/core/spdy_framer.cc index 897e253..c8a3a31 100644 --- a/quiche/http2/core/spdy_framer.cc +++ b/quiche/http2/core/spdy_framer.cc
@@ -19,9 +19,9 @@ #include "quiche/http2/core/zero_copy_output_buffer.h" #include "quiche/http2/hpack/hpack_constants.h" #include "quiche/http2/hpack/hpack_encoder.h" +#include "quiche/common/http/http_header_block.h" #include "quiche/common/platform/api/quiche_bug_tracker.h" #include "quiche/common/platform/api/quiche_logging.h" -#include "quiche/spdy/core/http2_header_block.h" namespace spdy { @@ -47,7 +47,7 @@ // The size of one parameter in SETTINGS frame. const size_t kOneSettingParameterSize = 6; -size_t GetUncompressedSerializedLength(const Http2HeaderBlock& headers) { +size_t GetUncompressedSerializedLength(const quiche::HttpHeaderBlock& headers) { const size_t num_name_value_pairs_size = sizeof(uint32_t); const size_t length_of_name_size = num_name_value_pairs_size; const size_t length_of_value_size = num_name_value_pairs_size; @@ -95,7 +95,7 @@ } // Serializes a HEADERS frame from the given SpdyHeadersIR and encoded header -// block. Does not need or use the Http2HeaderBlock inside SpdyHeadersIR. +// block. Does not need or use the quiche::HttpHeaderBlock inside SpdyHeadersIR. // Return false if the serialization fails. |encoding| should not be empty. bool SerializeHeadersGivenEncoding(const SpdyHeadersIR& headers, const std::string& encoding, @@ -138,7 +138,7 @@ } // Serializes a PUSH_PROMISE frame from the given SpdyPushPromiseIR and -// encoded header block. Does not need or use the Http2HeaderBlock inside +// encoded header block. Does not need or use the quiche::HttpHeaderBlock inside // SpdyPushPromiseIR. bool SerializePushPromiseGivenEncoding(const SpdyPushPromiseIR& push_promise, const std::string& encoding,
diff --git a/quiche/http2/core/spdy_framer_test.cc b/quiche/http2/core/spdy_framer_test.cc index aa0b205..a8341f4 100644 --- a/quiche/http2/core/spdy_framer_test.cc +++ b/quiche/http2/core/spdy_framer_test.cc
@@ -29,10 +29,10 @@ #include "quiche/http2/hpack/hpack_encoder.h" #include "quiche/http2/test_tools/mock_spdy_framer_visitor.h" #include "quiche/http2/test_tools/spdy_test_utils.h" +#include "quiche/common/http/http_header_block.h" #include "quiche/common/platform/api/quiche_logging.h" #include "quiche/common/platform/api/quiche_test.h" #include "quiche/common/quiche_text_utils.h" -#include "quiche/spdy/core/http2_header_block.h" using ::http2::Http2DecoderAdapter; using ::testing::_; @@ -554,7 +554,7 @@ SpdyFrameType header_control_type_; bool header_buffer_valid_; std::unique_ptr<RecordingHeadersHandler> headers_handler_; - Http2HeaderBlock headers_; + quiche::HttpHeaderBlock headers_; bool header_has_priority_; SpdyStreamId header_parent_stream_id_; bool header_exclusive_; @@ -638,7 +638,8 @@ INSTANTIATE_TEST_SUITE_P(SpdyFramerTests, SpdyFramerTest, ::testing::Values(USE, NOT_USE)); -// Test that we can encode and decode a Http2HeaderBlock in serialized form. +// Test that we can encode and decode a quiche::HttpHeaderBlock in serialized +// form. TEST_P(SpdyFramerTest, HeaderBlockInBuffer) { SpdyFramer framer(SpdyFramer::DISABLE_COMPRESSION); @@ -1167,7 +1168,7 @@ SpdyFramer framer(SpdyFramer::DISABLE_COMPRESSION); std::string value("value1\0value2", 13); // TODO(jgraettinger): If this pattern appears again, move to test class. - Http2HeaderBlock header_set; + quiche::HttpHeaderBlock header_set; header_set["name"] = value; HpackEncoder encoder; encoder.DisableCompression(); @@ -2458,7 +2459,7 @@ }; // frame-format on - Http2HeaderBlock header_block; + quiche::HttpHeaderBlock header_block; header_block["bar"] = "foo"; header_block["foo"] = "bar"; HpackEncoder encoder;
diff --git a/quiche/http2/core/spdy_protocol.cc b/quiche/http2/core/spdy_protocol.cc index 27d2608..d0c3414 100644 --- a/quiche/http2/core/spdy_protocol.cc +++ b/quiche/http2/core/spdy_protocol.cc
@@ -15,10 +15,10 @@ #include "absl/strings/str_cat.h" #include "absl/strings/string_view.h" #include "quiche/http2/core/spdy_alt_svc_wire_format.h" +#include "quiche/common/http/http_header_block.h" #include "quiche/common/platform/api/quiche_bug_tracker.h" #include "quiche/common/platform/api/quiche_flag_utils.h" #include "quiche/common/platform/api/quiche_logging.h" -#include "quiche/spdy/core/http2_header_block.h" namespace spdy { @@ -309,7 +309,7 @@ bool SpdyFrameWithFinIR::fin() const { return fin_; } SpdyFrameWithHeaderBlockIR::SpdyFrameWithHeaderBlockIR( - SpdyStreamId stream_id, Http2HeaderBlock header_block) + SpdyStreamId stream_id, quiche::HttpHeaderBlock header_block) : SpdyFrameWithFinIR(stream_id), header_block_(std::move(header_block)) {} SpdyFrameWithHeaderBlockIR::~SpdyFrameWithHeaderBlockIR() = default;
diff --git a/quiche/http2/core/spdy_protocol.h b/quiche/http2/core/spdy_protocol.h index ccf3e36..cbb7d9e 100644 --- a/quiche/http2/core/spdy_protocol.h +++ b/quiche/http2/core/spdy_protocol.h
@@ -23,10 +23,10 @@ #include "absl/types/variant.h" #include "quiche/http2/core/spdy_alt_svc_wire_format.h" #include "quiche/http2/core/spdy_bitmasks.h" +#include "quiche/common/http/http_header_block.h" #include "quiche/common/platform/api/quiche_export.h" #include "quiche/common/platform/api/quiche_flags.h" #include "quiche/common/platform/api/quiche_logging.h" -#include "quiche/spdy/core/http2_header_block.h" namespace spdy { @@ -501,8 +501,8 @@ public: ~SpdyFrameWithHeaderBlockIR() override; - const Http2HeaderBlock& header_block() const { return header_block_; } - void set_header_block(Http2HeaderBlock header_block) { + const quiche::HttpHeaderBlock& header_block() const { return header_block_; } + void set_header_block(quiche::HttpHeaderBlock header_block) { // Deep copy. header_block_ = std::move(header_block); } @@ -512,13 +512,13 @@ protected: SpdyFrameWithHeaderBlockIR(SpdyStreamId stream_id, - Http2HeaderBlock header_block); + quiche::HttpHeaderBlock header_block); SpdyFrameWithHeaderBlockIR(const SpdyFrameWithHeaderBlockIR&) = delete; SpdyFrameWithHeaderBlockIR& operator=(const SpdyFrameWithHeaderBlockIR&) = delete; private: - Http2HeaderBlock header_block_; + quiche::HttpHeaderBlock header_block_; }; class QUICHE_EXPORT SpdyDataIR : public SpdyFrameWithFinIR { @@ -712,8 +712,8 @@ class QUICHE_EXPORT SpdyHeadersIR : public SpdyFrameWithHeaderBlockIR { public: explicit SpdyHeadersIR(SpdyStreamId stream_id) - : SpdyHeadersIR(stream_id, Http2HeaderBlock()) {} - SpdyHeadersIR(SpdyStreamId stream_id, Http2HeaderBlock header_block) + : SpdyHeadersIR(stream_id, quiche::HttpHeaderBlock()) {} + SpdyHeadersIR(SpdyStreamId stream_id, quiche::HttpHeaderBlock header_block) : SpdyFrameWithHeaderBlockIR(stream_id, std::move(header_block)) {} SpdyHeadersIR(const SpdyHeadersIR&) = delete; SpdyHeadersIR& operator=(const SpdyHeadersIR&) = delete; @@ -780,9 +780,10 @@ class QUICHE_EXPORT SpdyPushPromiseIR : public SpdyFrameWithHeaderBlockIR { public: SpdyPushPromiseIR(SpdyStreamId stream_id, SpdyStreamId promised_stream_id) - : SpdyPushPromiseIR(stream_id, promised_stream_id, Http2HeaderBlock()) {} + : SpdyPushPromiseIR(stream_id, promised_stream_id, + quiche::HttpHeaderBlock()) {} SpdyPushPromiseIR(SpdyStreamId stream_id, SpdyStreamId promised_stream_id, - Http2HeaderBlock header_block) + quiche::HttpHeaderBlock header_block) : SpdyFrameWithHeaderBlockIR(stream_id, std::move(header_block)), promised_stream_id_(promised_stream_id), padded_(false),
diff --git a/quiche/http2/test_tools/spdy_test_utils.h b/quiche/http2/test_tools/spdy_test_utils.h index ff49121..eb46666 100644 --- a/quiche/http2/test_tools/spdy_test_utils.h +++ b/quiche/http2/test_tools/spdy_test_utils.h
@@ -17,7 +17,7 @@ namespace spdy { inline bool operator==(absl::string_view x, - const Http2HeaderBlock::ValueProxy& y) { + const quiche::HttpHeaderBlock::ValueProxy& y) { return y.operator==(x); }