Migrate //third_party/spdy to Http2HeaderBlock.
PiperOrigin-RevId: 461893611
diff --git a/quiche/spdy/core/hpack/hpack_decoder_adapter.cc b/quiche/spdy/core/hpack/hpack_decoder_adapter.cc
index 874a794..122fe45 100644
--- a/quiche/spdy/core/hpack/hpack_decoder_adapter.cc
+++ b/quiche/spdy/core/hpack/hpack_decoder_adapter.cc
@@ -98,7 +98,7 @@
return true;
}
-const SpdyHeaderBlock& HpackDecoderAdapter::decoded_block() const {
+const Http2HeaderBlock& HpackDecoderAdapter::decoded_block() const {
return listener_adapter_.decoded_block();
}
@@ -148,7 +148,7 @@
void HpackDecoderAdapter::ListenerAdapter::OnHeaderListEnd() {
QUICHE_DVLOG(2) << "HpackDecoderAdapter::ListenerAdapter::OnHeaderListEnd";
- // We don't clear the SpdyHeaderBlock here to allow access to it until the
+ // We don't clear the Http2HeaderBlock here to allow access to it until the
// next HPACK block is decoded.
if (handler_ != nullptr) {
handler_->OnHeaderBlockEnd(total_uncompressed_bytes_, total_hpack_bytes_);
diff --git a/quiche/spdy/core/hpack/hpack_decoder_adapter.h b/quiche/spdy/core/hpack/hpack_decoder_adapter.h
index d1eefbd..5cd16fc 100644
--- a/quiche/spdy/core/hpack/hpack_decoder_adapter.h
+++ b/quiche/spdy/core/hpack/hpack_decoder_adapter.h
@@ -20,7 +20,7 @@
#include "quiche/http2/hpack/http2_hpack_constants.h"
#include "quiche/common/platform/api/quiche_export.h"
#include "quiche/spdy/core/hpack/hpack_header_table.h"
-#include "quiche/spdy/core/spdy_header_block.h"
+#include "quiche/spdy/core/http2_header_block.h"
#include "quiche/spdy/core/spdy_headers_handler_interface.h"
namespace spdy {
@@ -43,7 +43,7 @@
size_t GetCurrentHeaderTableSizeSetting() const;
// If a SpdyHeadersHandlerInterface is provided, the decoder will emit
- // headers to it rather than accumulating them in a SpdyHeaderBlock.
+ // headers to it rather than accumulating them in a Http2HeaderBlock.
// Does not take ownership of the handler, but does use the pointer until
// the current HPACK block is completely decoded.
void HandleControlFrameHeadersStart(SpdyHeadersHandlerInterface* handler);
@@ -65,7 +65,7 @@
// call to HandleControlFrameHeadersData().
// TODO(birenroy): Remove this method when all users of HpackDecoder specify
// a SpdyHeadersHandlerInterface.
- const SpdyHeaderBlock& decoded_block() const;
+ const Http2HeaderBlock& decoded_block() const;
// Returns the current dynamic table size, including the 32 bytes per entry
// overhead mentioned in RFC 7541 section 4.1.
@@ -98,11 +98,11 @@
~ListenerAdapter() override;
// If a SpdyHeadersHandlerInterface is provided, the decoder will emit
- // headers to it rather than accumulating them in a SpdyHeaderBlock.
+ // headers to it rather than accumulating them in a Http2HeaderBlock.
// Does not take ownership of the handler, but does use the pointer until
// the current HPACK block is completely decoded.
void set_handler(SpdyHeadersHandlerInterface* handler);
- const SpdyHeaderBlock& decoded_block() const { return decoded_block_; }
+ const Http2HeaderBlock& decoded_block() const { return decoded_block_; }
// Override the HpackDecoderListener methods:
void OnHeaderListStart() override;
@@ -115,8 +115,8 @@
private:
// If the caller doesn't provide a handler, the header list is stored in
- // this SpdyHeaderBlock.
- SpdyHeaderBlock decoded_block_;
+ // this Http2HeaderBlock.
+ Http2HeaderBlock decoded_block_;
// If non-NULL, handles decoded headers. Not owned.
SpdyHeadersHandlerInterface* handler_;
diff --git a/quiche/spdy/core/hpack/hpack_decoder_adapter_test.cc b/quiche/spdy/core/hpack/hpack_decoder_adapter_test.cc
index 5df9d82..2143807 100644
--- a/quiche/spdy/core/hpack/hpack_decoder_adapter_test.cc
+++ b/quiche/spdy/core/hpack/hpack_decoder_adapter_test.cc
@@ -197,7 +197,7 @@
return DecodeHeaderBlock(hbb.buffer());
}
- const SpdyHeaderBlock& decoded_block() const {
+ const Http2HeaderBlock& decoded_block() const {
if (start_choice_ == START_WITH_HANDLER) {
return handler_.decoded_block();
} else {
@@ -205,7 +205,7 @@
}
}
- static size_t SizeOfHeaders(const SpdyHeaderBlock& headers) {
+ static size_t SizeOfHeaders(const Http2HeaderBlock& headers) {
size_t size = 0;
for (const auto& kv : headers) {
if (kv.first == kCookieKey) {
@@ -221,7 +221,7 @@
return size;
}
- const SpdyHeaderBlock& DecodeBlockExpectingSuccess(absl::string_view str) {
+ const Http2HeaderBlock& DecodeBlockExpectingSuccess(absl::string_view str) {
EXPECT_TRUE(DecodeHeaderBlock(str));
return decoded_block();
}
@@ -234,9 +234,9 @@
EXPECT_EQ(size, entry->size());
}
- SpdyHeaderBlock MakeHeaderBlock(
+ Http2HeaderBlock MakeHeaderBlock(
const std::vector<std::pair<std::string, std::string>>& headers) {
- SpdyHeaderBlock result;
+ Http2HeaderBlock result;
for (const auto& kv : headers) {
result.AppendValueOrAddHeader(kv.first, kv.second);
}
@@ -289,7 +289,7 @@
EXPECT_TRUE(HandleControlFrameHeadersData(s.substr(s.size() / 2)));
EXPECT_FALSE(HandleControlFrameHeadersData(s));
- SpdyHeaderBlock expected_block = MakeHeaderBlock({{"a", a_value}});
+ Http2HeaderBlock expected_block = MakeHeaderBlock({{"a", a_value}});
EXPECT_EQ(expected_block, decoded_block());
}
@@ -365,7 +365,7 @@
std::vector<std::pair<std::string, std::string>> expected_headers = {
{":method", "GET"}, {":path", "/index.html"}, {":method", "GET"}};
- SpdyHeaderBlock expected_block1 = MakeHeaderBlock(expected_headers);
+ Http2HeaderBlock expected_block1 = MakeHeaderBlock(expected_headers);
EXPECT_EQ(expected_block1, decoded_block());
// Full and partial headers, won't add partial to the headers.
@@ -375,7 +375,7 @@
expected_headers.push_back({"goo", "gar"});
expected_headers.push_back({"goo", "gar"});
- SpdyHeaderBlock expected_block2 = MakeHeaderBlock(expected_headers);
+ Http2HeaderBlock expected_block2 = MakeHeaderBlock(expected_headers);
EXPECT_EQ(expected_block2, decoded_block());
// Add the needed data.
@@ -385,7 +385,7 @@
expected_headers.push_back({"spam", "gggs"});
- SpdyHeaderBlock expected_block3 = MakeHeaderBlock(expected_headers);
+ Http2HeaderBlock expected_block3 = MakeHeaderBlock(expected_headers);
EXPECT_EQ(expected_block3, decoded_block());
}
@@ -437,44 +437,44 @@
// Decoding indexed static table field should work.
TEST_P(HpackDecoderAdapterTest, IndexedHeaderStatic) {
// Reference static table entries #2 and #5.
- const SpdyHeaderBlock& header_set1 = DecodeBlockExpectingSuccess("\x82\x85");
- SpdyHeaderBlock expected_header_set1;
+ const Http2HeaderBlock& header_set1 = DecodeBlockExpectingSuccess("\x82\x85");
+ Http2HeaderBlock expected_header_set1;
expected_header_set1[":method"] = "GET";
expected_header_set1[":path"] = "/index.html";
EXPECT_EQ(expected_header_set1, header_set1);
// Reference static table entry #2.
- const SpdyHeaderBlock& header_set2 = DecodeBlockExpectingSuccess("\x82");
- SpdyHeaderBlock expected_header_set2;
+ const Http2HeaderBlock& header_set2 = DecodeBlockExpectingSuccess("\x82");
+ Http2HeaderBlock expected_header_set2;
expected_header_set2[":method"] = "GET";
EXPECT_EQ(expected_header_set2, header_set2);
}
TEST_P(HpackDecoderAdapterTest, IndexedHeaderDynamic) {
// First header block: add an entry to header table.
- const SpdyHeaderBlock& header_set1 = DecodeBlockExpectingSuccess(
+ const Http2HeaderBlock& header_set1 = DecodeBlockExpectingSuccess(
"\x40\x03"
"foo"
"\x03"
"bar");
- SpdyHeaderBlock expected_header_set1;
+ Http2HeaderBlock expected_header_set1;
expected_header_set1["foo"] = "bar";
EXPECT_EQ(expected_header_set1, header_set1);
// Second header block: add another entry to header table.
- const SpdyHeaderBlock& header_set2 = DecodeBlockExpectingSuccess(
+ const Http2HeaderBlock& header_set2 = DecodeBlockExpectingSuccess(
"\xbe\x40\x04"
"spam"
"\x04"
"eggs");
- SpdyHeaderBlock expected_header_set2;
+ Http2HeaderBlock expected_header_set2;
expected_header_set2["foo"] = "bar";
expected_header_set2["spam"] = "eggs";
EXPECT_EQ(expected_header_set2, header_set2);
// Third header block: refer to most recently added entry.
- const SpdyHeaderBlock& header_set3 = DecodeBlockExpectingSuccess("\xbe");
- SpdyHeaderBlock expected_header_set3;
+ const Http2HeaderBlock& header_set3 = DecodeBlockExpectingSuccess("\xbe");
+ Http2HeaderBlock expected_header_set3;
expected_header_set3["spam"] = "eggs";
EXPECT_EQ(expected_header_set3, header_set3);
}
@@ -608,10 +608,10 @@
// First header with indexed name, second header with string literal
// name.
const char input[] = "\x04\x0c/sample/path\x00\x06:path2\x0e/sample/path/2";
- const SpdyHeaderBlock& header_set = DecodeBlockExpectingSuccess(
+ const Http2HeaderBlock& header_set = DecodeBlockExpectingSuccess(
absl::string_view(input, ABSL_ARRAYSIZE(input) - 1));
- SpdyHeaderBlock expected_header_set;
+ Http2HeaderBlock expected_header_set;
expected_header_set[":path"] = "/sample/path";
expected_header_set[":path2"] = "/sample/path/2";
EXPECT_EQ(expected_header_set, header_set);
@@ -621,10 +621,10 @@
// indexing and string literal names should work.
TEST_P(HpackDecoderAdapterTest, LiteralHeaderIncrementalIndexing) {
const char input[] = "\x44\x0c/sample/path\x40\x06:path2\x0e/sample/path/2";
- const SpdyHeaderBlock& header_set = DecodeBlockExpectingSuccess(
+ const Http2HeaderBlock& header_set = DecodeBlockExpectingSuccess(
absl::string_view(input, ABSL_ARRAYSIZE(input) - 1));
- SpdyHeaderBlock expected_header_set;
+ Http2HeaderBlock expected_header_set;
expected_header_set[":path"] = "/sample/path";
expected_header_set[":path2"] = "/sample/path/2";
EXPECT_EQ(expected_header_set, header_set);
@@ -705,7 +705,7 @@
TEST_P(HpackDecoderAdapterTest, BasicC31) {
HpackEncoder encoder;
- SpdyHeaderBlock expected_header_set;
+ Http2HeaderBlock expected_header_set;
expected_header_set[":method"] = "GET";
expected_header_set[":scheme"] = "http";
expected_header_set[":path"] = "/";
@@ -744,7 +744,7 @@
// | -> :authority: www.example.com
std::string first =
absl::HexStringToBytes("828684418cf1e3c2e5f23a6ba0ab90f4ff");
- const SpdyHeaderBlock& first_header_set = DecodeBlockExpectingSuccess(first);
+ const Http2HeaderBlock& first_header_set = DecodeBlockExpectingSuccess(first);
EXPECT_THAT(first_header_set,
ElementsAre(
@@ -781,7 +781,7 @@
// | -> cache-control: no-cache
std::string second = absl::HexStringToBytes("828684be5886a8eb10649cbf");
- const SpdyHeaderBlock& second_header_set =
+ const Http2HeaderBlock& second_header_set =
DecodeBlockExpectingSuccess(second);
EXPECT_THAT(second_header_set,
@@ -824,7 +824,7 @@
// | -> custom-key: custom-value
std::string third = absl::HexStringToBytes(
"828785bf408825a849e95ba97d7f8925a849e95bb8e8b4bf");
- const SpdyHeaderBlock& third_header_set = DecodeBlockExpectingSuccess(third);
+ const Http2HeaderBlock& third_header_set = DecodeBlockExpectingSuccess(third);
EXPECT_THAT(
third_header_set,
@@ -897,7 +897,7 @@
"941054d444a8200595040b8166e082a6"
"2d1bff6e919d29ad171863c78f0b97c8"
"e9ae82ae43d3");
- const SpdyHeaderBlock& first_header_set = DecodeBlockExpectingSuccess(first);
+ const Http2HeaderBlock& first_header_set = DecodeBlockExpectingSuccess(first);
EXPECT_THAT(first_header_set,
ElementsAre(
@@ -936,7 +936,7 @@
// | -> location:
// | https://www.example.com
std::string second = absl::HexStringToBytes("4883640effc1c0bf");
- const SpdyHeaderBlock& second_header_set =
+ const Http2HeaderBlock& second_header_set =
DecodeBlockExpectingSuccess(second);
EXPECT_THAT(second_header_set,
@@ -1013,7 +1013,7 @@
"77ad94e7821dd7f2e6c7b335dfdfcd5b"
"3960d5af27087f3672c1ab270fb5291f"
"9587316065c003ed4ee5b1063d5007");
- const SpdyHeaderBlock& third_header_set = DecodeBlockExpectingSuccess(third);
+ const Http2HeaderBlock& third_header_set = DecodeBlockExpectingSuccess(third);
EXPECT_THAT(third_header_set,
ElementsAre(
@@ -1077,12 +1077,12 @@
hbb.AppendIndexedHeader(62);
// Can't have DecodeHeaderBlock do the default check for size of the decoded
- // data because SpdyHeaderBlock will join multiple headers with the same
+ // data because Http2HeaderBlock will join multiple headers with the same
// name into a single entry, thus we won't see repeated occurrences of the
// name, instead seeing separators between values.
EXPECT_TRUE(DecodeHeaderBlock(hbb.buffer(), kNoCheckDecodedSize));
- SpdyHeaderBlock expected_header_set;
+ Http2HeaderBlock expected_header_set;
expected_header_set.AppendValueOrAddHeader(name, value1);
expected_header_set.AppendValueOrAddHeader(name, value1);
expected_header_set.AppendValueOrAddHeader(name, value2);
@@ -1090,7 +1090,7 @@
expected_header_set.AppendValueOrAddHeader(name, value3);
expected_header_set.AppendValueOrAddHeader(name, value3);
- // SpdyHeaderBlock stores these 6 strings as '\0' separated values.
+ // Http2HeaderBlock stores these 6 strings as '\0' separated values.
// Make sure that is what happened.
std::string joined_values = expected_header_set[name].as_string();
EXPECT_EQ(joined_values.size(),
@@ -1107,7 +1107,7 @@
// Regression test for https://crbug.com/747395.
TEST_P(HpackDecoderAdapterTest, Cookies) {
- SpdyHeaderBlock expected_header_set;
+ Http2HeaderBlock expected_header_set;
expected_header_set["cookie"] = "foo; bar";
EXPECT_TRUE(DecodeHeaderBlock(absl::HexStringToBytes("608294e76003626172")));
diff --git a/quiche/spdy/core/hpack/hpack_encoder.cc b/quiche/spdy/core/hpack/hpack_encoder.cc
index 7bfb8a4..3b95cfe 100644
--- a/quiche/spdy/core/hpack/hpack_encoder.cc
+++ b/quiche/spdy/core/hpack/hpack_encoder.cc
@@ -84,7 +84,8 @@
HpackEncoder::~HpackEncoder() = default;
-std::string HpackEncoder::EncodeHeaderBlock(const SpdyHeaderBlock& header_set) {
+std::string HpackEncoder::EncodeHeaderBlock(
+ const Http2HeaderBlock& header_set) {
// Separate header set into pseudo-headers and regular headers.
Representations pseudo_headers;
Representations regular_headers;
@@ -265,10 +266,10 @@
}
}
-// Iteratively encodes a SpdyHeaderBlock.
+// Iteratively encodes a Http2HeaderBlock.
class HpackEncoder::Encoderator : public ProgressiveEncoder {
public:
- Encoderator(const SpdyHeaderBlock& header_set, HpackEncoder* encoder);
+ Encoderator(const Http2HeaderBlock& header_set, HpackEncoder* encoder);
Encoderator(const Representations& representations, HpackEncoder* encoder);
// Encoderator is neither copyable nor movable.
@@ -289,7 +290,7 @@
bool has_next_;
};
-HpackEncoder::Encoderator::Encoderator(const SpdyHeaderBlock& header_set,
+HpackEncoder::Encoderator::Encoderator(const Http2HeaderBlock& header_set,
HpackEncoder* encoder)
: encoder_(encoder), has_next_(true) {
// Separate header set into pseudo-headers and regular headers.
@@ -362,7 +363,7 @@
}
std::unique_ptr<HpackEncoder::ProgressiveEncoder> HpackEncoder::EncodeHeaderSet(
- const SpdyHeaderBlock& header_set) {
+ const Http2HeaderBlock& header_set) {
return std::make_unique<Encoderator>(header_set, this);
}
diff --git a/quiche/spdy/core/hpack/hpack_encoder.h b/quiche/spdy/core/hpack/hpack_encoder.h
index 4974e19..d63c9f2 100644
--- a/quiche/spdy/core/hpack/hpack_encoder.h
+++ b/quiche/spdy/core/hpack/hpack_encoder.h
@@ -18,6 +18,7 @@
#include "quiche/common/platform/api/quiche_export.h"
#include "quiche/spdy/core/hpack/hpack_header_table.h"
#include "quiche/spdy/core/hpack/hpack_output_stream.h"
+#include "quiche/spdy/core/http2_header_block.h"
#include "quiche/spdy/core/spdy_protocol.h"
// An HpackEncoder encodes header sets as outlined in
@@ -50,7 +51,7 @@
~HpackEncoder();
// Encodes and returns the given header set as a string.
- std::string EncodeHeaderBlock(const SpdyHeaderBlock& header_set);
+ std::string EncodeHeaderBlock(const Http2HeaderBlock& header_set);
class QUICHE_EXPORT_PRIVATE ProgressiveEncoder {
public:
@@ -64,9 +65,9 @@
};
// Returns a ProgressiveEncoder which must be outlived by both the given
- // SpdyHeaderBlock and this object.
+ // Http2HeaderBlock and this object.
std::unique_ptr<ProgressiveEncoder> EncodeHeaderSet(
- const SpdyHeaderBlock& header_set);
+ const Http2HeaderBlock& header_set);
// Returns a ProgressiveEncoder which must be outlived by this HpackEncoder.
// The encoder will not attempt to split any \0-delimited values in
// |representations|. If such splitting is desired, it must be performed by
diff --git a/quiche/spdy/core/hpack/hpack_encoder_test.cc b/quiche/spdy/core/hpack/hpack_encoder_test.cc
index 9402512..fe80ffe 100644
--- a/quiche/spdy/core/hpack/hpack_encoder_test.cc
+++ b/quiche/spdy/core/hpack/hpack_encoder_test.cc
@@ -72,12 +72,12 @@
// TODO(dahollings): Remove or clean up these methods when deprecating
// non-incremental encoding path.
static std::string EncodeHeaderBlock(HpackEncoder* encoder,
- const SpdyHeaderBlock& header_set) {
+ const Http2HeaderBlock& header_set) {
return encoder->EncodeHeaderBlock(header_set);
}
static bool EncodeIncremental(HpackEncoder* encoder,
- const SpdyHeaderBlock& header_set,
+ const Http2HeaderBlock& header_set,
std::string* output) {
std::unique_ptr<HpackEncoder::ProgressiveEncoder> encoderator =
encoder->EncodeHeaderSet(header_set);
@@ -209,14 +209,14 @@
expected_.AppendPrefix(kHeaderTableSizeUpdateOpcode);
expected_.AppendUint32(size);
}
- Representations MakeRepresentations(const SpdyHeaderBlock& header_set) {
+ Representations MakeRepresentations(const Http2HeaderBlock& header_set) {
Representations r;
for (const auto& header : header_set) {
r.push_back(header);
}
return r;
}
- void CompareWithExpectedEncoding(const SpdyHeaderBlock& header_set) {
+ void CompareWithExpectedEncoding(const Http2HeaderBlock& header_set) {
std::string actual_out;
std::string expected_out = expected_.TakeString();
switch (strategy_) {
@@ -348,7 +348,7 @@
ExpectIndex(DynamicIndexToWireIndex(key_2_index_));
- SpdyHeaderBlock headers;
+ Http2HeaderBlock headers;
headers[key_2_->name()] = key_2_->value();
CompareWithExpectedEncoding(headers);
EXPECT_THAT(headers_observed_,
@@ -358,7 +358,7 @@
TEST_P(HpackEncoderTest, SingleStaticIndex) {
ExpectIndex(kStaticEntryIndex);
- SpdyHeaderBlock headers;
+ Http2HeaderBlock headers;
headers[static_->name()] = static_->value();
CompareWithExpectedEncoding(headers);
}
@@ -367,7 +367,7 @@
peer_.table()->SetMaxSize(1); // Also evicts all fixtures.
ExpectIndex(kStaticEntryIndex);
- SpdyHeaderBlock headers;
+ Http2HeaderBlock headers;
headers[static_->name()] = static_->value();
CompareWithExpectedEncoding(headers);
@@ -377,7 +377,7 @@
TEST_P(HpackEncoderTest, SingleLiteralWithIndexName) {
ExpectIndexedLiteral(DynamicIndexToWireIndex(key_2_index_), "value3");
- SpdyHeaderBlock headers;
+ Http2HeaderBlock headers;
headers[key_2_->name()] = "value3";
CompareWithExpectedEncoding(headers);
@@ -390,7 +390,7 @@
TEST_P(HpackEncoderTest, SingleLiteralWithLiteralName) {
ExpectIndexedLiteral("key3", "value3");
- SpdyHeaderBlock headers;
+ Http2HeaderBlock headers;
headers["key3"] = "value3";
CompareWithExpectedEncoding(headers);
@@ -406,7 +406,7 @@
// A header overflowing the header table is still emitted.
// The header table is empty.
- SpdyHeaderBlock headers;
+ Http2HeaderBlock headers;
headers["key3"] = "value3";
CompareWithExpectedEncoding(headers);
@@ -419,7 +419,7 @@
ExpectIndex(DynamicIndexToWireIndex(key_1_index_));
ExpectIndexedLiteral("key3", "value3");
- SpdyHeaderBlock headers;
+ Http2HeaderBlock headers;
headers[key_1_->name()] = key_1_->value();
headers["key3"] = "value3";
CompareWithExpectedEncoding(headers);
@@ -430,14 +430,14 @@
ExpectIndex(DynamicIndexToWireIndex(cookie_c_index_));
ExpectIndexedLiteral(peer_.table()->GetByName("cookie"), "e=ff");
- SpdyHeaderBlock headers;
+ Http2HeaderBlock headers;
headers["cookie"] = "a=bb; c=dd; e=ff";
CompareWithExpectedEncoding(headers);
}
TEST_P(HpackEncoderTest, MultiValuedHeadersNotCrumbled) {
ExpectIndexedLiteral("foo", "bar, baz");
- SpdyHeaderBlock headers;
+ Http2HeaderBlock headers;
headers["foo"] = "bar, baz";
CompareWithExpectedEncoding(headers);
}
@@ -479,7 +479,7 @@
}
ExpectNonIndexedLiteral("multivalue", "value1, value2");
- SpdyHeaderBlock headers;
+ Http2HeaderBlock headers;
headers[":path"] = "/index.html";
headers["cookie"] = "foo=bar; baz=bing";
headers["hello"] = "goodbye";
@@ -514,7 +514,7 @@
// Pass 1.
{
- SpdyHeaderBlock headers;
+ Http2HeaderBlock headers;
headers["key1"] = "value1";
headers["cookie"] = "a=bb";
@@ -529,7 +529,7 @@
// 62: cookie: c=dd
// Pass 2.
{
- SpdyHeaderBlock headers;
+ Http2HeaderBlock headers;
headers["key2"] = "value2";
headers["cookie"] = "c=dd; e=ff";
@@ -550,7 +550,7 @@
// 62: cookie: e=ff
// Pass 3.
{
- SpdyHeaderBlock headers;
+ Http2HeaderBlock headers;
headers["key2"] = "value2";
headers["cookie"] = "a=bb; b=cc; c=dd";
@@ -584,7 +584,7 @@
}
TEST_P(HpackEncoderTest, PseudoHeadersFirst) {
- SpdyHeaderBlock headers;
+ Http2HeaderBlock headers;
// A pseudo-header that should not be indexed.
headers[":path"] = "/spam/eggs.html";
// A pseudo-header to be indexed.
@@ -672,7 +672,7 @@
// caller must crumble null-delimited values.
return;
}
- SpdyHeaderBlock headers;
+ Http2HeaderBlock headers;
// A header field to be crumbled: "spam: foo\0bar".
headers["spam"] = std::string("foo\0bar", 7);
@@ -690,7 +690,7 @@
ExpectHeaderTableSizeUpdate(1024);
ExpectIndexedLiteral("key3", "value3");
- SpdyHeaderBlock headers;
+ Http2HeaderBlock headers;
headers["key3"] = "value3";
CompareWithExpectedEncoding(headers);
@@ -709,7 +709,7 @@
ExpectHeaderTableSizeUpdate(starting_size - 1);
ExpectIndexedLiteral("key3", "value3");
- SpdyHeaderBlock headers;
+ Http2HeaderBlock headers;
headers["key3"] = "value3";
CompareWithExpectedEncoding(headers);
@@ -723,7 +723,7 @@
// No encoded size update.
ExpectIndexedLiteral("key3", "value3");
- SpdyHeaderBlock headers;
+ Http2HeaderBlock headers;
headers["key3"] = "value3";
CompareWithExpectedEncoding(headers);
@@ -740,7 +740,7 @@
ExpectHeaderTableSizeUpdate(starting_size + 2);
ExpectIndexedLiteral("key3", "value3");
- SpdyHeaderBlock headers;
+ Http2HeaderBlock headers;
headers["key3"] = "value3";
CompareWithExpectedEncoding(headers);
diff --git a/quiche/spdy/core/hpack/hpack_round_trip_test.cc b/quiche/spdy/core/hpack/hpack_round_trip_test.cc
index 27e1bcc..44a36d3 100644
--- a/quiche/spdy/core/hpack/hpack_round_trip_test.cc
+++ b/quiche/spdy/core/hpack/hpack_round_trip_test.cc
@@ -12,6 +12,7 @@
#include "quiche/spdy/core/hpack/hpack_constants.h"
#include "quiche/spdy/core/hpack/hpack_decoder_adapter.h"
#include "quiche/spdy/core/hpack/hpack_encoder.h"
+#include "quiche/spdy/core/http2_header_block.h"
#include "quiche/spdy/test_tools/spdy_test_utils.h"
namespace spdy {
@@ -31,7 +32,7 @@
decoder_.ApplyHeaderTableSizeSetting(256);
}
- bool RoundTrip(const SpdyHeaderBlock& header_set) {
+ bool RoundTrip(const Http2HeaderBlock& header_set) {
std::string encoded = encoder_.EncodeHeaderBlock(header_set);
bool success = true;
@@ -81,7 +82,7 @@
TEST_P(HpackRoundTripTest, ResponseFixtures) {
{
- SpdyHeaderBlock headers;
+ Http2HeaderBlock headers;
headers[":status"] = "302";
headers["cache-control"] = "private";
headers["date"] = "Mon, 21 Oct 2013 20:13:21 GMT";
@@ -89,7 +90,7 @@
EXPECT_TRUE(RoundTrip(headers));
}
{
- SpdyHeaderBlock headers;
+ Http2HeaderBlock headers;
headers[":status"] = "200";
headers["cache-control"] = "private";
headers["date"] = "Mon, 21 Oct 2013 20:13:21 GMT";
@@ -97,7 +98,7 @@
EXPECT_TRUE(RoundTrip(headers));
}
{
- SpdyHeaderBlock headers;
+ Http2HeaderBlock headers;
headers[":status"] = "200";
headers["cache-control"] = "private";
headers["content-encoding"] = "gzip";
@@ -113,7 +114,7 @@
TEST_P(HpackRoundTripTest, RequestFixtures) {
{
- SpdyHeaderBlock headers;
+ Http2HeaderBlock headers;
headers[":authority"] = "www.example.com";
headers[":method"] = "GET";
headers[":path"] = "/";
@@ -122,7 +123,7 @@
EXPECT_TRUE(RoundTrip(headers));
}
{
- SpdyHeaderBlock headers;
+ Http2HeaderBlock headers;
headers[":authority"] = "www.example.com";
headers[":method"] = "GET";
headers[":path"] = "/";
@@ -132,7 +133,7 @@
EXPECT_TRUE(RoundTrip(headers));
}
{
- SpdyHeaderBlock headers;
+ Http2HeaderBlock headers;
headers[":authority"] = "www.example.com";
headers[":method"] = "GET";
headers[":path"] = "/index.html";
@@ -166,7 +167,7 @@
values.push_back("baz=bing; fizzle=fazzle; garbage");
for (size_t i = 0; i != 2000; ++i) {
- SpdyHeaderBlock headers;
+ Http2HeaderBlock headers;
// Choose a random number of headers to add, and of these a random subset
// will be HTTP/2 pseudo headers.
diff --git a/quiche/spdy/core/http2_frame_decoder_adapter.cc b/quiche/spdy/core/http2_frame_decoder_adapter.cc
index fb48a7d..303f037 100644
--- a/quiche/spdy/core/http2_frame_decoder_adapter.cc
+++ b/quiche/spdy/core/http2_frame_decoder_adapter.cc
@@ -27,7 +27,6 @@
#include "quiche/spdy/core/hpack/hpack_decoder_adapter.h"
#include "quiche/spdy/core/hpack/hpack_header_table.h"
#include "quiche/spdy/core/spdy_alt_svc_wire_format.h"
-#include "quiche/spdy/core/spdy_header_block.h"
#include "quiche/spdy/core/spdy_headers_handler_interface.h"
#include "quiche/spdy/core/spdy_protocol.h"
diff --git a/quiche/spdy/core/http2_header_block_hpack_listener.h b/quiche/spdy/core/http2_header_block_hpack_listener.h
index 0c21632..598ec96 100644
--- a/quiche/spdy/core/http2_header_block_hpack_listener.h
+++ b/quiche/spdy/core/http2_header_block_hpack_listener.h
@@ -5,12 +5,12 @@
#include "quiche/http2/hpack/decoder/hpack_decoder_listener.h"
#include "quiche/common/platform/api/quiche_export.h"
#include "quiche/common/platform/api/quiche_logging.h"
-#include "quiche/spdy/core/spdy_header_block.h"
+#include "quiche/spdy/core/http2_header_block.h"
namespace spdy {
// This class simply gathers the key-value pairs emitted by an HpackDecoder in
-// a SpdyHeaderBlock.
+// a Http2HeaderBlock.
class QUICHE_EXPORT_PRIVATE Http2HeaderBlockHpackListener
: public http2::HpackDecoderListener {
public:
@@ -32,15 +32,15 @@
hpack_error_ = true;
}
- SpdyHeaderBlock release_header_block() {
- SpdyHeaderBlock block = std::move(header_block_);
+ Http2HeaderBlock release_header_block() {
+ Http2HeaderBlock block = std::move(header_block_);
header_block_ = {};
return block;
}
bool hpack_error() const { return hpack_error_; }
private:
- SpdyHeaderBlock header_block_;
+ Http2HeaderBlock header_block_;
bool hpack_error_ = false;
};
diff --git a/quiche/spdy/core/metadata_extension.h b/quiche/spdy/core/metadata_extension.h
index 12d817c..2b757b5 100644
--- a/quiche/spdy/core/metadata_extension.h
+++ b/quiche/spdy/core/metadata_extension.h
@@ -9,7 +9,7 @@
#include "quiche/common/platform/api/quiche_export.h"
#include "quiche/spdy/core/hpack/hpack_encoder.h"
#include "quiche/spdy/core/http2_frame_decoder_adapter.h"
-#include "quiche/spdy/core/spdy_header_block.h"
+#include "quiche/spdy/core/http2_header_block.h"
#include "quiche/spdy/core/spdy_protocol.h"
#include "quiche/spdy/core/zero_copy_output_buffer.h"
@@ -24,7 +24,7 @@
class QUICHE_EXPORT_PRIVATE MetadataVisitor
: public spdy::ExtensionVisitorInterface {
public:
- using MetadataPayload = spdy::SpdyHeaderBlock;
+ using MetadataPayload = spdy::Http2HeaderBlock;
static_assert(!std::is_copy_constructible<MetadataPayload>::value,
"MetadataPayload should be a move-only type!");
diff --git a/quiche/spdy/core/metadata_extension_test.cc b/quiche/spdy/core/metadata_extension_test.cc
index 628b7c4..dae1e7e 100644
--- a/quiche/spdy/core/metadata_extension_test.cc
+++ b/quiche/spdy/core/metadata_extension_test.cc
@@ -7,7 +7,6 @@
#include "quiche/common/platform/api/quiche_test.h"
#include "quiche/spdy/core/array_output_buffer.h"
#include "quiche/spdy/core/spdy_framer.h"
-#include "quiche/spdy/core/spdy_header_block.h"
#include "quiche/spdy/core/spdy_no_op_visitor.h"
#include "quiche/spdy/core/spdy_protocol.h"
#include "quiche/spdy/test_tools/mock_spdy_framer_visitor.h"
@@ -53,7 +52,7 @@
}
std::unique_ptr<MetadataVisitor> extension_;
- absl::flat_hash_map<spdy::SpdyStreamId, SpdyHeaderBlock>
+ absl::flat_hash_map<spdy::SpdyStreamId, Http2HeaderBlock>
received_payload_map_;
std::vector<bool> received_metadata_support_;
size_t received_count_ = 0;
@@ -83,7 +82,7 @@
TEST_F(MetadataExtensionTest, MetadataDeliveredToUnknownFrameCallbacks) {
const char kData[] = "some payload";
- SpdyHeaderBlock payload = PayloadForData(kData);
+ Http2HeaderBlock payload = PayloadForData(kData);
extension_->OnSetting(MetadataVisitor::kMetadataExtensionId, 1);
ASSERT_TRUE(extension_->PeerSupportsMetadata());
@@ -123,9 +122,9 @@
// This test verifies that the METADATA frame emitted by a MetadataExtension
// can be parsed by another SpdyFramer with a MetadataVisitor.
TEST_F(MetadataExtensionTest, MetadataPayloadEndToEnd) {
- SpdyHeaderBlock block1;
+ Http2HeaderBlock block1;
block1["foo"] = "Some metadata value.";
- SpdyHeaderBlock block2;
+ Http2HeaderBlock block2;
block2["bar"] =
"The color taupe truly represents a triumph of the human spirit over "
"adversity.";
@@ -135,7 +134,7 @@
const absl::string_view binary_payload{"binary\0payload", 14};
block2["qux"] = binary_payload;
EXPECT_EQ(binary_payload, block2["qux"]);
- for (const SpdyHeaderBlock& payload_block :
+ for (const Http2HeaderBlock& payload_block :
{std::move(block1), std::move(block2)}) {
extension_->OnSetting(MetadataVisitor::kMetadataExtensionId, 1);
ASSERT_TRUE(extension_->PeerSupportsMetadata());
@@ -173,8 +172,8 @@
TEST_F(MetadataExtensionTest, MetadataPayloadInterleaved) {
const std::string kData1 = std::string(65 * 1024, 'a');
const std::string kData2 = std::string(65 * 1024, 'b');
- const SpdyHeaderBlock payload1 = PayloadForData(kData1);
- const SpdyHeaderBlock payload2 = PayloadForData(kData2);
+ const Http2HeaderBlock payload1 = PayloadForData(kData1);
+ const Http2HeaderBlock payload2 = PayloadForData(kData2);
extension_->OnSetting(MetadataVisitor::kMetadataExtensionId, 1);
ASSERT_TRUE(extension_->PeerSupportsMetadata());
diff --git a/quiche/spdy/core/recording_headers_handler.h b/quiche/spdy/core/recording_headers_handler.h
index a2c06ec..a605944 100644
--- a/quiche/spdy/core/recording_headers_handler.h
+++ b/quiche/spdy/core/recording_headers_handler.h
@@ -11,7 +11,7 @@
#include "absl/strings/string_view.h"
#include "quiche/common/platform/api/quiche_export.h"
-#include "quiche/spdy/core/spdy_header_block.h"
+#include "quiche/spdy/core/http2_header_block.h"
#include "quiche/spdy/core/spdy_headers_handler_interface.h"
namespace spdy {
diff --git a/quiche/spdy/core/spdy_framer.cc b/quiche/spdy/core/spdy_framer.cc
index a127c1b..8b7d69e 100644
--- a/quiche/spdy/core/spdy_framer.cc
+++ b/quiche/spdy/core/spdy_framer.cc
@@ -90,7 +90,7 @@
}
// Serializes a HEADERS frame from the given SpdyHeadersIR and encoded header
-// block. Does not need or use the SpdyHeaderBlock inside SpdyHeadersIR.
+// block. Does not need or use the Http2HeaderBlock inside SpdyHeadersIR.
// Return false if the serialization fails. |encoding| should not be empty.
bool SerializeHeadersGivenEncoding(const SpdyHeadersIR& headers,
const std::string& encoding,
@@ -133,7 +133,7 @@
}
// Serializes a PUSH_PROMISE frame from the given SpdyPushPromiseIR and
-// encoded header block. Does not need or use the SpdyHeaderBlock inside
+// encoded header block. Does not need or use the Http2HeaderBlock inside
// SpdyPushPromiseIR.
bool SerializePushPromiseGivenEncoding(const SpdyPushPromiseIR& push_promise,
const std::string& encoding,
diff --git a/quiche/spdy/core/spdy_framer.h b/quiche/spdy/core/spdy_framer.h
index 8af13f5..db8a64a 100644
--- a/quiche/spdy/core/spdy_framer.h
+++ b/quiche/spdy/core/spdy_framer.h
@@ -16,8 +16,8 @@
#include "absl/strings/string_view.h"
#include "quiche/common/platform/api/quiche_export.h"
#include "quiche/spdy/core/hpack/hpack_encoder.h"
+#include "quiche/spdy/core/http2_header_block.h"
#include "quiche/spdy/core/spdy_alt_svc_wire_format.h"
-#include "quiche/spdy/core/spdy_header_block.h"
#include "quiche/spdy/core/spdy_headers_handler_interface.h"
#include "quiche/spdy/core/spdy_protocol.h"
#include "quiche/spdy/core/zero_copy_output_buffer.h"
@@ -293,7 +293,7 @@
};
// Iteratively converts a SpdyHeadersIR (with a possibly huge
- // SpdyHeaderBlock) into an appropriate sequence of SpdySerializedFrames, and
+ // Http2HeaderBlock) into an appropriate sequence of SpdySerializedFrames, and
// write to the output.
class QUICHE_EXPORT_PRIVATE SpdyHeaderFrameIterator
: public SpdyFrameIterator {
@@ -314,7 +314,7 @@
};
// Iteratively converts a SpdyPushPromiseIR (with a possibly huge
- // SpdyHeaderBlock) into an appropriate sequence of SpdySerializedFrames, and
+ // Http2HeaderBlock) into an appropriate sequence of SpdySerializedFrames, and
// write to the output.
class QUICHE_EXPORT_PRIVATE SpdyPushPromiseFrameIterator
: public SpdyFrameIterator {
diff --git a/quiche/spdy/core/spdy_framer_test.cc b/quiche/spdy/core/spdy_framer_test.cc
index 1fbb650..dbc6073 100644
--- a/quiche/spdy/core/spdy_framer_test.cc
+++ b/quiche/spdy/core/spdy_framer_test.cc
@@ -629,7 +629,7 @@
INSTANTIATE_TEST_SUITE_P(SpdyFramerTests, SpdyFramerTest,
::testing::Values(USE, NOT_USE));
-// Test that we can encode and decode a SpdyHeaderBlock in serialized form.
+// Test that we can encode and decode a Http2HeaderBlock in serialized form.
TEST_P(SpdyFramerTest, HeaderBlockInBuffer) {
SpdyFramer framer(SpdyFramer::DISABLE_COMPRESSION);
diff --git a/quiche/spdy/core/spdy_protocol.h b/quiche/spdy/core/spdy_protocol.h
index 81db503..1166125 100644
--- a/quiche/spdy/core/spdy_protocol.h
+++ b/quiche/spdy/core/spdy_protocol.h
@@ -22,9 +22,9 @@
#include "absl/strings/string_view.h"
#include "quiche/common/platform/api/quiche_export.h"
#include "quiche/common/platform/api/quiche_logging.h"
+#include "quiche/spdy/core/http2_header_block.h"
#include "quiche/spdy/core/spdy_alt_svc_wire_format.h"
#include "quiche/spdy/core/spdy_bitmasks.h"
-#include "quiche/spdy/core/spdy_header_block.h"
namespace spdy {
diff --git a/quiche/spdy/test_tools/spdy_test_utils.h b/quiche/spdy/test_tools/spdy_test_utils.h
index ccbba8c..366f249 100644
--- a/quiche/spdy/test_tools/spdy_test_utils.h
+++ b/quiche/spdy/test_tools/spdy_test_utils.h
@@ -10,7 +10,7 @@
#include <string>
#include "absl/strings/string_view.h"
-#include "quiche/spdy/core/spdy_header_block.h"
+#include "quiche/spdy/core/http2_header_block.h"
#include "quiche/spdy/core/spdy_protocol.h"
namespace spdy {