Remove Http2String wrapper for std::string.
gfe-relnote: n/a, no functional change.
PiperOrigin-RevId: 263816460
Change-Id: I4f365540414e6a3d78fd00ce6b39a4cdd4c14140
diff --git a/http2/hpack/decoder/hpack_block_collector.cc b/http2/hpack/decoder/hpack_block_collector.cc
index 1137be5..3490ca7 100644
--- a/http2/hpack/decoder/hpack_block_collector.cc
+++ b/http2/hpack/decoder/hpack_block_collector.cc
@@ -77,14 +77,14 @@
HpackEntryType type,
size_t index,
bool value_huffman,
- const Http2String& value) {
+ const std::string& value) {
entries_.push_back(HpackEntryCollector(type, index, value_huffman, value));
}
void HpackBlockCollector::ExpectLiteralNameAndValue(HpackEntryType type,
bool name_huffman,
- const Http2String& name,
+ const std::string& name,
bool value_huffman,
- const Http2String& value) {
+ const std::string& value) {
entries_.push_back(
HpackEntryCollector(type, name_huffman, name, value_huffman, value));
}
diff --git a/http2/hpack/decoder/hpack_block_collector.h b/http2/hpack/decoder/hpack_block_collector.h
index 6ad1405..0d8f811 100644
--- a/http2/hpack/decoder/hpack_block_collector.h
+++ b/http2/hpack/decoder/hpack_block_collector.h
@@ -15,6 +15,7 @@
#include <stddef.h>
+#include <string>
#include <vector>
#include "testing/gtest/include/gtest/gtest.h"
@@ -22,7 +23,6 @@
#include "net/third_party/quiche/src/http2/hpack/decoder/hpack_entry_decoder_listener.h"
#include "net/third_party/quiche/src/http2/hpack/http2_hpack_constants.h"
#include "net/third_party/quiche/src/http2/hpack/tools/hpack_block_builder.h"
-#include "net/third_party/quiche/src/http2/platform/api/http2_string.h"
#include "net/third_party/quiche/src/http2/platform/api/http2_string_piece.h"
#include "net/third_party/quiche/src/http2/test_tools/http2_random.h"
@@ -66,14 +66,14 @@
void ExpectNameIndexAndLiteralValue(HpackEntryType type,
size_t index,
bool value_huffman,
- const Http2String& value);
+ const std::string& value);
// Add an HPACK entry for a header entry with a literal name and value.
void ExpectLiteralNameAndValue(HpackEntryType type,
bool name_huffman,
- const Http2String& name,
+ const std::string& name,
bool value_huffman,
- const Http2String& value);
+ const std::string& value);
// Shuffle the entries, in support of generating an HPACK block of entries
// in some random order.
diff --git a/http2/hpack/decoder/hpack_block_decoder.cc b/http2/hpack/decoder/hpack_block_decoder.cc
index 656f8e9..bb86597 100644
--- a/http2/hpack/decoder/hpack_block_decoder.cc
+++ b/http2/hpack/decoder/hpack_block_decoder.cc
@@ -48,7 +48,7 @@
return DecodeStatus::kDecodeDone;
}
-Http2String HpackBlockDecoder::DebugString() const {
+std::string HpackBlockDecoder::DebugString() const {
return Http2StrCat("HpackBlockDecoder(", entry_decoder_.DebugString(),
", listener@",
Http2Hex(reinterpret_cast<intptr_t>(listener_)),
diff --git a/http2/hpack/decoder/hpack_block_decoder.h b/http2/hpack/decoder/hpack_block_decoder.h
index a17664f..fb44c3f 100644
--- a/http2/hpack/decoder/hpack_block_decoder.h
+++ b/http2/hpack/decoder/hpack_block_decoder.h
@@ -10,13 +10,14 @@
// or dynamic table support, so table indices remain indices at this level.
// Reports the entries to an HpackEntryDecoderListener.
+#include <string>
+
#include "net/third_party/quiche/src/http2/decoder/decode_buffer.h"
#include "net/third_party/quiche/src/http2/decoder/decode_status.h"
#include "net/third_party/quiche/src/http2/hpack/decoder/hpack_entry_decoder.h"
#include "net/third_party/quiche/src/http2/hpack/decoder/hpack_entry_decoder_listener.h"
#include "net/third_party/quiche/src/http2/platform/api/http2_export.h"
#include "net/third_party/quiche/src/http2/platform/api/http2_logging.h"
-#include "net/third_party/quiche/src/http2/platform/api/http2_string.h"
namespace http2 {
@@ -48,7 +49,7 @@
// first byte of a new HPACK entry)?
bool before_entry() const { return before_entry_; }
- Http2String DebugString() const;
+ std::string DebugString() const;
private:
HpackEntryDecoder entry_decoder_;
diff --git a/http2/hpack/decoder/hpack_block_decoder_test.cc b/http2/hpack/decoder/hpack_block_decoder_test.cc
index fce45b2..4988b5c 100644
--- a/http2/hpack/decoder/hpack_block_decoder_test.cc
+++ b/http2/hpack/decoder/hpack_block_decoder_test.cc
@@ -7,6 +7,7 @@
// Tests of HpackBlockDecoder.
#include <cstdint>
+#include <string>
#include "testing/gtest/include/gtest/gtest.h"
#include "net/third_party/quiche/src/http2/decoder/decode_buffer.h"
@@ -67,14 +68,14 @@
AssertionResult DecodeHpackExampleAndValidateSeveralWays(
Http2StringPiece hpack_example,
Validator validator) {
- Http2String input = HpackExampleToStringOrDie(hpack_example);
+ std::string input = HpackExampleToStringOrDie(hpack_example);
DecodeBuffer db(input);
return DecodeAndValidateSeveralWays(&db, validator);
}
uint8_t Rand8() { return Random().Rand8(); }
- Http2String Rand8String() { return Random().RandString(Rand8()); }
+ std::string Rand8String() { return Random().RandString(Rand8()); }
HpackBlockCollector collector_;
HpackEntryDecoderVLoggingListener listener_;
@@ -157,7 +158,7 @@
}
// http://httpwg.org/specs/rfc7541.html#rfc.section.C.3.1
TEST_F(HpackBlockDecoderTest, SpecExample_C_3_1) {
- Http2String example = R"(
+ std::string example = R"(
82 | == Indexed - Add ==
| idx = 2
| -> :method: GET
@@ -191,7 +192,7 @@
// http://httpwg.org/specs/rfc7541.html#rfc.section.C.5.1
TEST_F(HpackBlockDecoderTest, SpecExample_C_5_1) {
- Http2String example = R"(
+ std::string example = R"(
48 | == Literal indexed ==
| Indexed name (idx = 8)
| :status
diff --git a/http2/hpack/decoder/hpack_decoder_string_buffer.cc b/http2/hpack/decoder/hpack_decoder_string_buffer.cc
index 76431a6..6a20008 100644
--- a/http2/hpack/decoder/hpack_decoder_string_buffer.cc
+++ b/http2/hpack/decoder/hpack_decoder_string_buffer.cc
@@ -9,7 +9,6 @@
#include "net/third_party/quiche/src/http2/platform/api/http2_bug_tracker.h"
#include "net/third_party/quiche/src/http2/platform/api/http2_estimate_memory_usage.h"
#include "net/third_party/quiche/src/http2/platform/api/http2_logging.h"
-#include "net/third_party/quiche/src/http2/platform/api/http2_string.h"
namespace http2 {
@@ -168,7 +167,7 @@
<< state_ << ", backing=" << backing_;
if (state_ != State::RESET && backing_ == Backing::UNBUFFERED) {
HTTP2_DVLOG(2)
- << "HpackDecoderStringBuffer buffering Http2String of length "
+ << "HpackDecoderStringBuffer buffering std::string of length "
<< value_.size();
buffer_.assign(value_.data(), value_.size());
if (state_ == State::COMPLETE) {
@@ -194,7 +193,7 @@
return value_;
}
-Http2String HpackDecoderStringBuffer::ReleaseString() {
+std::string HpackDecoderStringBuffer::ReleaseString() {
HTTP2_DVLOG(3) << "HpackDecoderStringBuffer::ReleaseString";
DCHECK_EQ(state_, State::COMPLETE);
DCHECK_EQ(backing_, Backing::BUFFERED);
@@ -203,7 +202,7 @@
if (backing_ == Backing::BUFFERED) {
return std::move(buffer_);
} else {
- return Http2String(value_);
+ return std::string(value_);
}
}
return "";
diff --git a/http2/hpack/decoder/hpack_decoder_string_buffer.h b/http2/hpack/decoder/hpack_decoder_string_buffer.h
index 8a810b2..d8dce6c 100644
--- a/http2/hpack/decoder/hpack_decoder_string_buffer.h
+++ b/http2/hpack/decoder/hpack_decoder_string_buffer.h
@@ -12,10 +12,10 @@
#include <stddef.h>
#include <ostream>
+#include <string>
#include "net/third_party/quiche/src/http2/hpack/huffman/hpack_huffman_decoder.h"
#include "net/third_party/quiche/src/http2/platform/api/http2_export.h"
-#include "net/third_party/quiche/src/http2/platform/api/http2_string.h"
#include "net/third_party/quiche/src/http2/platform/api/http2_string_piece.h"
namespace http2 {
@@ -58,7 +58,7 @@
// unless the string has been buffered (to avoid forcing a potentially
// unnecessary copy). ReleaseString() also resets the instance so that it can
// be used to collect another string.
- Http2String ReleaseString();
+ std::string ReleaseString();
State state_for_testing() const { return state_; }
Backing backing_for_testing() const { return backing_; }
@@ -70,7 +70,7 @@
private:
// Storage for the string being buffered, if buffering is necessary
// (e.g. if Huffman encoded, buffer_ is storage for the decoded string).
- Http2String buffer_;
+ std::string buffer_;
// The Http2StringPiece to be returned by HpackDecoderStringBuffer::str(). If
// a string has been collected, but not buffered, value_ points to that
diff --git a/http2/hpack/decoder/hpack_decoder_string_buffer_test.cc b/http2/hpack/decoder/hpack_decoder_string_buffer_test.cc
index 11b0d97..ec807c8 100644
--- a/http2/hpack/decoder/hpack_decoder_string_buffer_test.cc
+++ b/http2/hpack/decoder/hpack_decoder_string_buffer_test.cc
@@ -11,7 +11,6 @@
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "net/third_party/quiche/src/http2/platform/api/http2_logging.h"
-#include "net/third_party/quiche/src/http2/platform/api/http2_string.h"
#include "net/third_party/quiche/src/http2/platform/api/http2_string_utils.h"
#include "net/third_party/quiche/src/http2/platform/api/http2_test_helpers.h"
@@ -33,11 +32,11 @@
// We want to know that HTTP2_LOG(x) << buf_ will work in production should
// that be needed, so we test that it outputs the expected values.
- AssertionResult VerifyLogHasSubstrs(std::initializer_list<Http2String> strs) {
+ AssertionResult VerifyLogHasSubstrs(std::initializer_list<std::string> strs) {
HTTP2_VLOG(1) << buf_;
std::ostringstream ss;
buf_.OutputDebugStringTo(ss);
- Http2String dbg_str(ss.str());
+ std::string dbg_str(ss.str());
for (const auto& expected : strs) {
VERIFY_THAT(dbg_str, HasSubstr(expected));
}
@@ -153,7 +152,7 @@
}
TEST_F(HpackDecoderStringBufferTest, HuffmanWhole) {
- Http2String encoded = Http2HexDecode("f1e3c2e5f23a6ba0ab90f4ff");
+ std::string encoded = Http2HexDecode("f1e3c2e5f23a6ba0ab90f4ff");
Http2StringPiece decoded("www.example.com");
EXPECT_EQ(state(), State::RESET);
@@ -172,15 +171,15 @@
EXPECT_TRUE(VerifyLogHasSubstrs(
{"{state=COMPLETE", "backing=BUFFERED", "buffer: www.example.com}"}));
- Http2String s = buf_.ReleaseString();
+ std::string s = buf_.ReleaseString();
EXPECT_EQ(s, decoded);
EXPECT_EQ(state(), State::RESET);
}
TEST_F(HpackDecoderStringBufferTest, HuffmanSplit) {
- Http2String encoded = Http2HexDecode("f1e3c2e5f23a6ba0ab90f4ff");
- Http2String part1 = encoded.substr(0, 5);
- Http2String part2 = encoded.substr(5);
+ std::string encoded = Http2HexDecode("f1e3c2e5f23a6ba0ab90f4ff");
+ std::string part1 = encoded.substr(0, 5);
+ std::string part2 = encoded.substr(5);
Http2StringPiece decoded("www.example.com");
EXPECT_EQ(state(), State::RESET);
@@ -217,7 +216,7 @@
TEST_F(HpackDecoderStringBufferTest, InvalidHuffmanOnData) {
// Explicitly encode the End-of-String symbol, a no-no.
- Http2String encoded = Http2HexDecode("ffffffff");
+ std::string encoded = Http2HexDecode("ffffffff");
buf_.OnStart(/*huffman_encoded*/ true, encoded.size());
EXPECT_EQ(state(), State::COLLECTING);
@@ -231,7 +230,7 @@
TEST_F(HpackDecoderStringBufferTest, InvalidHuffmanOnEnd) {
// Last byte of string doesn't end with prefix of End-of-String symbol.
- Http2String encoded = Http2HexDecode("00");
+ std::string encoded = Http2HexDecode("00");
buf_.OnStart(/*huffman_encoded*/ true, encoded.size());
EXPECT_EQ(state(), State::COLLECTING);
diff --git a/http2/hpack/decoder/hpack_decoder_tables_test.cc b/http2/hpack/decoder/hpack_decoder_tables_test.cc
index 592ce56..db4ada1 100644
--- a/http2/hpack/decoder/hpack_decoder_tables_test.cc
+++ b/http2/hpack/decoder/hpack_decoder_tables_test.cc
@@ -5,6 +5,7 @@
#include "net/third_party/quiche/src/http2/hpack/decoder/hpack_decoder_tables.h"
#include <algorithm>
+#include <string>
#include <tuple>
#include <vector>
@@ -12,7 +13,6 @@
#include "testing/gtest/include/gtest/gtest.h"
#include "net/third_party/quiche/src/http2/hpack/http2_hpack_constants.h"
#include "net/third_party/quiche/src/http2/platform/api/http2_logging.h"
-#include "net/third_party/quiche/src/http2/platform/api/http2_string.h"
#include "net/third_party/quiche/src/http2/platform/api/http2_test_helpers.h"
#include "net/third_party/quiche/src/http2/test_tools/http2_random.h"
#include "net/third_party/quiche/src/http2/tools/random_util.h"
@@ -96,7 +96,7 @@
EXPECT_TRUE(VerifyStaticTableContents());
}
-size_t Size(const Http2String& name, const Http2String& value) {
+size_t Size(const std::string& name, const std::string& value) {
return name.size() + value.size() + 32;
}
@@ -105,11 +105,11 @@
// dynamic table containing FakeHpackEntry instances. We can thus compare the
// contents of the actual table with those in fake_dynamic_table_.
-typedef std::tuple<Http2String, Http2String, size_t> FakeHpackEntry;
-const Http2String& Name(const FakeHpackEntry& entry) {
+typedef std::tuple<std::string, std::string, size_t> FakeHpackEntry;
+const std::string& Name(const FakeHpackEntry& entry) {
return std::get<0>(entry);
}
-const Http2String& Value(const FakeHpackEntry& entry) {
+const std::string& Value(const FakeHpackEntry& entry) {
return std::get<1>(entry);
}
size_t Size(const FakeHpackEntry& entry) {
@@ -133,7 +133,7 @@
}
// Insert the name and value into fake_dynamic_table_.
- void FakeInsert(const Http2String& name, const Http2String& value) {
+ void FakeInsert(const std::string& name, const std::string& value) {
FakeHpackEntry entry(name, value, Size(name, value));
fake_dynamic_table_.insert(fake_dynamic_table_.begin(), entry);
}
@@ -204,7 +204,7 @@
// Insert an entry into the dynamic table, confirming that trimming of entries
// occurs if the total size is greater than the limit, and that older entries
// move up by 1 index.
- AssertionResult Insert(const Http2String& name, const Http2String& value) {
+ AssertionResult Insert(const std::string& name, const std::string& value) {
size_t old_count = num_dynamic_entries();
if (tables_.Insert(HpackString(name), HpackString(value))) {
VERIFY_GT(current_dynamic_size(), 0u);
@@ -251,9 +251,9 @@
for (size_t limit : table_sizes) {
ASSERT_TRUE(DynamicTableSizeUpdate(limit));
for (int insert_count = 0; insert_count < 100; ++insert_count) {
- Http2String name =
+ std::string name =
GenerateHttp2HeaderName(random_.UniformInRange(2, 40), RandomPtr());
- Http2String value =
+ std::string value =
GenerateWebSafeString(random_.UniformInRange(2, 600), RandomPtr());
ASSERT_TRUE(Insert(name, value));
}
diff --git a/http2/hpack/decoder/hpack_decoder_test.cc b/http2/hpack/decoder/hpack_decoder_test.cc
index bf2cee5..9734bdd 100644
--- a/http2/hpack/decoder/hpack_decoder_test.cc
+++ b/http2/hpack/decoder/hpack_decoder_test.cc
@@ -6,6 +6,7 @@
// Tests of HpackDecoder.
+#include <string>
#include <tuple>
#include <utility>
#include <vector>
@@ -22,7 +23,6 @@
#include "net/third_party/quiche/src/http2/hpack/tools/hpack_example.h"
#include "net/third_party/quiche/src/http2/http2_constants.h"
#include "net/third_party/quiche/src/http2/platform/api/http2_logging.h"
-#include "net/third_party/quiche/src/http2/platform/api/http2_string.h"
#include "net/third_party/quiche/src/http2/platform/api/http2_test_helpers.h"
#include "net/third_party/quiche/src/http2/test_tools/http2_random.h"
#include "net/third_party/quiche/src/http2/tools/random_util.h"
@@ -57,7 +57,7 @@
namespace {
-typedef std::tuple<HpackEntryType, Http2String, Http2String> HpackHeaderEntry;
+typedef std::tuple<HpackEntryType, std::string, std::string> HpackHeaderEntry;
typedef std::vector<HpackHeaderEntry> HpackHeaderEntries;
// TODO(jamessynge): Create a ...test_utils.h file with the mock listener
@@ -121,7 +121,7 @@
// error_message may be used in a GOAWAY frame as the Opaque Data.
void OnHeaderErrorDetected(Http2StringPiece error_message) override {
ASSERT_TRUE(saw_start_);
- error_messages_.push_back(Http2String(error_message));
+ error_messages_.push_back(std::string(error_message));
// No further callbacks should be made at this point, so replace 'this' as
// the listener with mock_listener_, which is a strict mock, so will
// generate an error for any calls.
@@ -219,7 +219,7 @@
HpackDecoder decoder_;
testing::StrictMock<MockHpackDecoderListener> mock_listener_;
HpackHeaderEntries header_entries_;
- std::vector<Http2String> error_messages_;
+ std::vector<std::string> error_messages_;
bool fragment_the_hpack_block_;
bool saw_start_ = false;
bool saw_end_ = false;
@@ -232,7 +232,7 @@
// http://httpwg.org/specs/rfc7541.html#rfc.section.C.3
TEST_P(HpackDecoderTest, C3_RequestExamples) {
// C.3.1 First Request
- Http2String hpack_block = HpackExampleToStringOrDie(R"(
+ std::string hpack_block = HpackExampleToStringOrDie(R"(
82 | == Indexed - Add ==
| idx = 2
| -> :method: GET
@@ -367,7 +367,7 @@
// http://httpwg.org/specs/rfc7541.html#rfc.section.C.4
TEST_P(HpackDecoderTest, C4_RequestExamplesWithHuffmanEncoding) {
// C.4.1 First Request
- Http2String hpack_block = HpackExampleToStringOrDie(R"(
+ std::string hpack_block = HpackExampleToStringOrDie(R"(
82 | == Indexed - Add ==
| idx = 2
| -> :method: GET
@@ -526,7 +526,7 @@
// date: Mon, 21 Oct 2013 20:13:21 GMT
// location: https://www.example.com
- Http2String hpack_block = HpackExampleToStringOrDie(R"(
+ std::string hpack_block = HpackExampleToStringOrDie(R"(
48 | == Literal indexed ==
| Indexed name (idx = 8)
| :status
@@ -751,7 +751,7 @@
// cache-control: private
// date: Mon, 21 Oct 2013 20:13:21 GMT
// location: https://www.example.com
- Http2String hpack_block = HpackExampleToStringOrDie(R"(
+ std::string hpack_block = HpackExampleToStringOrDie(R"(
48 | == Literal indexed ==
| Indexed name (idx = 8)
| :status
diff --git a/http2/hpack/decoder/hpack_entry_collector.cc b/http2/hpack/decoder/hpack_entry_collector.cc
index 327075d..7706bd6 100644
--- a/http2/hpack/decoder/hpack_entry_collector.cc
+++ b/http2/hpack/decoder/hpack_entry_collector.cc
@@ -35,7 +35,7 @@
HpackEntryCollector::HpackEntryCollector(HpackEntryType type,
size_t index,
bool value_huffman,
- const Http2String& value)
+ const std::string& value)
: header_type_(type),
index_(index),
value_(value, value_huffman),
@@ -43,9 +43,9 @@
ended_(true) {}
HpackEntryCollector::HpackEntryCollector(HpackEntryType type,
bool name_huffman,
- const Http2String& name,
+ const std::string& name,
bool value_huffman,
- const Http2String& value)
+ const std::string& value)
: header_type_(type),
index_(0),
name_(name, name_huffman),
@@ -232,8 +232,8 @@
}
}
-Http2String HpackEntryCollector::ToString() const {
- Http2String result("Type=");
+std::string HpackEntryCollector::ToString() const {
+ std::string result("Type=");
switch (header_type_) {
case HpackEntryType::kIndexedHeader:
result += "IndexedHeader";
diff --git a/http2/hpack/decoder/hpack_entry_collector.h b/http2/hpack/decoder/hpack_entry_collector.h
index c2c5fe5..6b27b7b 100644
--- a/http2/hpack/decoder/hpack_entry_collector.h
+++ b/http2/hpack/decoder/hpack_entry_collector.h
@@ -13,13 +13,13 @@
#include <stddef.h>
#include <iosfwd>
+#include <string>
#include "testing/gtest/include/gtest/gtest.h"
#include "net/third_party/quiche/src/http2/hpack/decoder/hpack_entry_decoder_listener.h"
#include "net/third_party/quiche/src/http2/hpack/decoder/hpack_string_collector.h"
#include "net/third_party/quiche/src/http2/hpack/http2_hpack_constants.h"
#include "net/third_party/quiche/src/http2/hpack/tools/hpack_block_builder.h"
-#include "net/third_party/quiche/src/http2/platform/api/http2_string.h"
#include "net/third_party/quiche/src/http2/platform/api/http2_string_piece.h"
namespace http2 {
@@ -37,12 +37,12 @@
HpackEntryCollector(HpackEntryType type,
size_t index,
bool value_huffman,
- const Http2String& value);
+ const std::string& value);
HpackEntryCollector(HpackEntryType type,
bool name_huffman,
- const Http2String& name,
+ const std::string& name,
bool value_huffman,
- const Http2String& value);
+ const std::string& value);
~HpackEntryCollector() override;
@@ -122,7 +122,7 @@
void AppendToHpackBlockBuilder(HpackBlockBuilder* hbb) const;
// Returns a debug string.
- Http2String ToString() const;
+ std::string ToString() const;
private:
void Init(HpackEntryType type, size_t maybe_index);
diff --git a/http2/hpack/decoder/hpack_entry_decoder.cc b/http2/hpack/decoder/hpack_entry_decoder.cc
index 5e1bd8c..97af6f9 100644
--- a/http2/hpack/decoder/hpack_entry_decoder.cc
+++ b/http2/hpack/decoder/hpack_entry_decoder.cc
@@ -237,7 +237,7 @@
<< ", " << string_decoder_ << ")";
}
-Http2String HpackEntryDecoder::DebugString() const {
+std::string HpackEntryDecoder::DebugString() const {
std::stringstream s;
s << *this;
return s.str();
diff --git a/http2/hpack/decoder/hpack_entry_decoder.h b/http2/hpack/decoder/hpack_entry_decoder.h
index 5858c1e..1848fb6 100644
--- a/http2/hpack/decoder/hpack_entry_decoder.h
+++ b/http2/hpack/decoder/hpack_entry_decoder.h
@@ -10,6 +10,8 @@
// must provide a non-empty decode buffer. Continue with calls to Resume() if
// Start, and any subsequent calls to Resume, returns kDecodeInProgress.
+#include <string>
+
#include "net/third_party/quiche/src/http2/decoder/decode_buffer.h"
#include "net/third_party/quiche/src/http2/decoder/decode_status.h"
#include "net/third_party/quiche/src/http2/hpack/decoder/hpack_entry_decoder_listener.h"
@@ -18,7 +20,6 @@
#include "net/third_party/quiche/src/http2/hpack/http2_hpack_constants.h"
#include "net/third_party/quiche/src/http2/platform/api/http2_export.h"
#include "net/third_party/quiche/src/http2/platform/api/http2_logging.h"
-#include "net/third_party/quiche/src/http2/platform/api/http2_string.h"
namespace http2 {
@@ -62,7 +63,7 @@
// in decoding the entry type and its varint.
DecodeStatus Resume(DecodeBuffer* db, HpackEntryDecoderListener* listener);
- Http2String DebugString() const;
+ std::string DebugString() const;
void OutputDebugString(std::ostream& out) const;
private:
diff --git a/http2/hpack/decoder/hpack_entry_decoder_test.cc b/http2/hpack/decoder/hpack_entry_decoder_test.cc
index b447e82..d4113f8 100644
--- a/http2/hpack/decoder/hpack_entry_decoder_test.cc
+++ b/http2/hpack/decoder/hpack_entry_decoder_test.cc
@@ -167,7 +167,7 @@
for (int n = 0; n < 10; n++) {
const uint32_t ndx = 1 + Random().Rand8();
const bool value_is_huffman_encoded = (n % 2) == 0;
- const Http2String value = Random().RandString(Random().Rand8());
+ const std::string value = Random().RandString(Random().Rand8());
HpackBlockBuilder hbb;
hbb.AppendNameIndexAndLiteralValue(entry_type_, ndx,
value_is_huffman_encoded, value);
@@ -186,10 +186,10 @@
for (int n = 0; n < 10; n++) {
const bool name_is_huffman_encoded = (n & 1) == 0;
const int name_len = 1 + Random().Rand8();
- const Http2String name = Random().RandString(name_len);
+ const std::string name = Random().RandString(name_len);
const bool value_is_huffman_encoded = (n & 2) == 0;
const int value_len = Random().Skewed(10);
- const Http2String value = Random().RandString(value_len);
+ const std::string value = Random().RandString(value_len);
HpackBlockBuilder hbb;
hbb.AppendLiteralNameAndValue(entry_type_, name_is_huffman_encoded, name,
value_is_huffman_encoded, value);
diff --git a/http2/hpack/decoder/hpack_entry_type_decoder.cc b/http2/hpack/decoder/hpack_entry_type_decoder.cc
index 7519f5a..ce91978 100644
--- a/http2/hpack/decoder/hpack_entry_type_decoder.cc
+++ b/http2/hpack/decoder/hpack_entry_type_decoder.cc
@@ -10,7 +10,7 @@
namespace http2 {
-Http2String HpackEntryTypeDecoder::DebugString() const {
+std::string HpackEntryTypeDecoder::DebugString() const {
return Http2StrCat(
"HpackEntryTypeDecoder(varint_decoder=", varint_decoder_.DebugString(),
", entry_type=", entry_type_, ")");
diff --git a/http2/hpack/decoder/hpack_entry_type_decoder.h b/http2/hpack/decoder/hpack_entry_type_decoder.h
index 092a844..bf13cf9 100644
--- a/http2/hpack/decoder/hpack_entry_type_decoder.h
+++ b/http2/hpack/decoder/hpack_entry_type_decoder.h
@@ -11,6 +11,7 @@
// zero, or is the new size limit of the dynamic table.
#include <cstdint>
+#include <string>
#include "net/third_party/quiche/src/http2/decoder/decode_buffer.h"
#include "net/third_party/quiche/src/http2/decoder/decode_status.h"
@@ -18,7 +19,6 @@
#include "net/third_party/quiche/src/http2/hpack/varint/hpack_varint_decoder.h"
#include "net/third_party/quiche/src/http2/platform/api/http2_export.h"
#include "net/third_party/quiche/src/http2/platform/api/http2_logging.h"
-#include "net/third_party/quiche/src/http2/platform/api/http2_string.h"
namespace http2 {
@@ -40,7 +40,7 @@
// preceding call to Start or Resume returned kDecodeDone.
uint64_t varint() const { return varint_decoder_.value(); }
- Http2String DebugString() const;
+ std::string DebugString() const;
private:
HpackVarintDecoder varint_decoder_;
diff --git a/http2/hpack/decoder/hpack_string_collector.cc b/http2/hpack/decoder/hpack_string_collector.cc
index 247ce9c..e903755 100644
--- a/http2/hpack/decoder/hpack_string_collector.cc
+++ b/http2/hpack/decoder/hpack_string_collector.cc
@@ -36,7 +36,7 @@
Clear();
}
-HpackStringCollector::HpackStringCollector(const Http2String& str, bool huffman)
+HpackStringCollector::HpackStringCollector(const std::string& str, bool huffman)
: s(str), len(str.size()), huffman_encoded(huffman), state(kEnded) {}
void HpackStringCollector::Clear() {
@@ -89,7 +89,7 @@
return ::testing::AssertionSuccess();
}
-Http2String HpackStringCollector::ToString() const {
+std::string HpackStringCollector::ToString() const {
std::stringstream ss;
ss << *this;
return ss.str();
diff --git a/http2/hpack/decoder/hpack_string_collector.h b/http2/hpack/decoder/hpack_string_collector.h
index 76be13b..d56abee 100644
--- a/http2/hpack/decoder/hpack_string_collector.h
+++ b/http2/hpack/decoder/hpack_string_collector.h
@@ -10,10 +10,10 @@
#include <stddef.h>
#include <iosfwd>
+#include <string>
#include "testing/gtest/include/gtest/gtest.h"
#include "net/third_party/quiche/src/http2/hpack/decoder/hpack_string_decoder_listener.h"
-#include "net/third_party/quiche/src/http2/platform/api/http2_string.h"
#include "net/third_party/quiche/src/http2/platform/api/http2_string_piece.h"
namespace http2 {
@@ -29,7 +29,7 @@
};
HpackStringCollector();
- HpackStringCollector(const Http2String& str, bool huffman);
+ HpackStringCollector(const std::string& str, bool huffman);
void Clear();
bool IsClear() const;
@@ -43,9 +43,9 @@
::testing::AssertionResult Collected(Http2StringPiece str,
bool is_huffman_encoded) const;
- Http2String ToString() const;
+ std::string ToString() const;
- Http2String s;
+ std::string s;
size_t len;
bool huffman_encoded;
CollectorState state;
diff --git a/http2/hpack/decoder/hpack_string_decoder.cc b/http2/hpack/decoder/hpack_string_decoder.cc
index 0b9eb59..f74e536 100644
--- a/http2/hpack/decoder/hpack_string_decoder.cc
+++ b/http2/hpack/decoder/hpack_string_decoder.cc
@@ -8,7 +8,7 @@
namespace http2 {
-Http2String HpackStringDecoder::DebugString() const {
+std::string HpackStringDecoder::DebugString() const {
return Http2StrCat("HpackStringDecoder(state=", StateToString(state_),
", length=", length_decoder_.DebugString(),
", remaining=", remaining_,
@@ -16,7 +16,7 @@
}
// static
-Http2String HpackStringDecoder::StateToString(StringDecoderState v) {
+std::string HpackStringDecoder::StateToString(StringDecoderState v) {
switch (v) {
case kStartDecodingLength:
return "kStartDecodingLength";
diff --git a/http2/hpack/decoder/hpack_string_decoder.h b/http2/hpack/decoder/hpack_string_decoder.h
index e30b36d..0cd1742 100644
--- a/http2/hpack/decoder/hpack_string_decoder.h
+++ b/http2/hpack/decoder/hpack_string_decoder.h
@@ -13,6 +13,7 @@
#include <algorithm>
#include <cstdint>
+#include <string>
#include "net/third_party/quiche/src/http2/decoder/decode_buffer.h"
#include "net/third_party/quiche/src/http2/decoder/decode_status.h"
@@ -20,7 +21,6 @@
#include "net/third_party/quiche/src/http2/platform/api/http2_export.h"
#include "net/third_party/quiche/src/http2/platform/api/http2_logging.h"
#include "net/third_party/quiche/src/http2/platform/api/http2_macros.h"
-#include "net/third_party/quiche/src/http2/platform/api/http2_string.h"
namespace http2 {
@@ -113,10 +113,10 @@
}
}
- Http2String DebugString() const;
+ std::string DebugString() const;
private:
- static Http2String StateToString(StringDecoderState v);
+ static std::string StateToString(StringDecoderState v);
// Returns true if the length is fully decoded and the listener wants the
// decoding to continue, false otherwise; status is set to the status from
diff --git a/http2/hpack/decoder/hpack_string_decoder_test.cc b/http2/hpack/decoder/hpack_string_decoder_test.cc
index 5346999..ceeebca 100644
--- a/http2/hpack/decoder/hpack_string_decoder_test.cc
+++ b/http2/hpack/decoder/hpack_string_decoder_test.cc
@@ -48,10 +48,10 @@
return collector_.Collected(s, huffman_encoded);
}
- // expected_str is a Http2String rather than a const Http2String& or
+ // expected_str is a std::string rather than a const std::string& or
// Http2StringPiece so that the lambda makes a copy of the string, and thus
// the string to be passed to Collected outlives the call to MakeValidator.
- Validator MakeValidator(const Http2String& expected_str,
+ Validator MakeValidator(const std::string& expected_str,
bool expected_huffman) {
return
[expected_str, expected_huffman, this](
@@ -119,8 +119,8 @@
}
TEST_F(HpackStringDecoderTest, DecodeLongStrings) {
- Http2String name = Random().RandString(1024);
- Http2String value = Random().RandString(65536);
+ std::string name = Random().RandString(1024);
+ std::string value = Random().RandString(65536);
HpackBlockBuilder hbb;
hbb.AppendString(false, name);
diff --git a/http2/hpack/hpack_string.cc b/http2/hpack/hpack_string.cc
index 957cffa..85ba812 100644
--- a/http2/hpack/hpack_string.cc
+++ b/http2/hpack/hpack_string.cc
@@ -12,8 +12,8 @@
namespace http2 {
HpackString::HpackString(const char* data) : str_(data) {}
-HpackString::HpackString(Http2StringPiece str) : str_(Http2String(str)) {}
-HpackString::HpackString(Http2String str) : str_(std::move(str)) {}
+HpackString::HpackString(Http2StringPiece str) : str_(std::string(str)) {}
+HpackString::HpackString(std::string str) : str_(std::move(str)) {}
HpackString::HpackString(const HpackString& other) = default;
HpackString::~HpackString() = default;
@@ -59,7 +59,7 @@
HTTP2_DVLOG(3) << DebugString() << " dtor";
}
-Http2String HpackStringPair::DebugString() const {
+std::string HpackStringPair::DebugString() const {
return Http2StrCat("HpackStringPair(name=", name.ToString(),
", value=", value.ToString(), ")");
}
diff --git a/http2/hpack/hpack_string.h b/http2/hpack/hpack_string.h
index b1c499c..e1535f7 100644
--- a/http2/hpack/hpack_string.h
+++ b/http2/hpack/hpack_string.h
@@ -13,9 +13,9 @@
#include <stddef.h>
#include <iosfwd>
+#include <string>
#include "net/third_party/quiche/src/http2/platform/api/http2_export.h"
-#include "net/third_party/quiche/src/http2/platform/api/http2_string.h"
#include "net/third_party/quiche/src/http2/platform/api/http2_string_piece.h"
namespace http2 {
@@ -24,7 +24,7 @@
public:
explicit HpackString(const char* data);
explicit HpackString(Http2StringPiece str);
- explicit HpackString(Http2String str);
+ explicit HpackString(std::string str);
HpackString(const HpackString& other);
// Not sure yet whether this move ctor is required/sensible.
@@ -33,7 +33,7 @@
~HpackString();
size_t size() const { return str_.size(); }
- const Http2String& ToString() const { return str_; }
+ const std::string& ToString() const { return str_; }
Http2StringPiece ToStringPiece() const;
bool operator==(const HpackString& other) const;
@@ -41,7 +41,7 @@
bool operator==(Http2StringPiece str) const;
private:
- Http2String str_;
+ std::string str_;
};
HTTP2_EXPORT_PRIVATE bool operator==(Http2StringPiece a, const HpackString& b);
@@ -61,7 +61,7 @@
// http://httpwg.org/specs/rfc7541.html#calculating.table.size
size_t size() const { return 32 + name.size() + value.size(); }
- Http2String DebugString() const;
+ std::string DebugString() const;
const HpackString name;
const HpackString value;
diff --git a/http2/hpack/hpack_string_test.cc b/http2/hpack/hpack_string_test.cc
index 898ef8d..9230ecc 100644
--- a/http2/hpack/hpack_string_test.cc
+++ b/http2/hpack/hpack_string_test.cc
@@ -26,7 +26,7 @@
class HpackStringTest : public ::testing::Test {
protected:
AssertionResult VerifyNotEqual(HpackString* actual,
- const Http2String& not_expected_str) {
+ const std::string& not_expected_str) {
const char* not_expected_ptr = not_expected_str.c_str();
Http2StringPiece not_expected_sp(not_expected_str);
@@ -52,7 +52,7 @@
}
AssertionResult VerifyEqual(HpackString* actual,
- const Http2String& expected_str) {
+ const std::string& expected_str) {
VERIFY_EQ(actual->size(), expected_str.size());
const char* expected_ptr = expected_str.c_str();
@@ -103,12 +103,12 @@
}
TEST_F(HpackStringTest, MoveStringConstructor) {
- Http2String str0(kStr0);
+ std::string str0(kStr0);
HpackString hs0(str0);
EXPECT_TRUE(VerifyEqual(&hs0, kStr0));
EXPECT_TRUE(VerifyNotEqual(&hs0, kStr1));
- Http2String str1(kStr1);
+ std::string str1(kStr1);
HpackString hs1(str1);
EXPECT_TRUE(VerifyEqual(&hs1, kStr1));
EXPECT_TRUE(VerifyNotEqual(&hs1, kStr0));
diff --git a/http2/hpack/http2_hpack_constants.cc b/http2/hpack/http2_hpack_constants.cc
index f258ab9..d697db0 100644
--- a/http2/hpack/http2_hpack_constants.cc
+++ b/http2/hpack/http2_hpack_constants.cc
@@ -8,7 +8,7 @@
namespace http2 {
-Http2String HpackEntryTypeToString(HpackEntryType v) {
+std::string HpackEntryTypeToString(HpackEntryType v) {
switch (v) {
case HpackEntryType::kIndexedHeader:
return "kIndexedHeader";
diff --git a/http2/hpack/http2_hpack_constants.h b/http2/hpack/http2_hpack_constants.h
index de0d685..c973774 100644
--- a/http2/hpack/http2_hpack_constants.h
+++ b/http2/hpack/http2_hpack_constants.h
@@ -11,9 +11,9 @@
// https://http2.github.io/http2-spec/compression.html#rfc.section.6
#include <ostream>
+#include <string>
#include "net/third_party/quiche/src/http2/platform/api/http2_export.h"
-#include "net/third_party/quiche/src/http2/platform/api/http2_string.h"
namespace http2 {
@@ -52,7 +52,7 @@
};
// Returns the name of the enum member.
-HTTP2_EXPORT_PRIVATE Http2String HpackEntryTypeToString(HpackEntryType v);
+HTTP2_EXPORT_PRIVATE std::string HpackEntryTypeToString(HpackEntryType v);
// Inserts the name of the enum member into |out|.
HTTP2_EXPORT_PRIVATE std::ostream& operator<<(std::ostream& out,
diff --git a/http2/hpack/huffman/hpack_huffman_decoder.cc b/http2/hpack/huffman/hpack_huffman_decoder.cc
index e74ca14..71ce855 100644
--- a/http2/hpack/huffman/hpack_huffman_decoder.cc
+++ b/http2/hpack/huffman/hpack_huffman_decoder.cc
@@ -403,7 +403,7 @@
return false;
}
-Http2String HuffmanBitBuffer::DebugString() const {
+std::string HuffmanBitBuffer::DebugString() const {
std::stringstream ss;
ss << "{accumulator: " << HuffmanAccumulatorBitSet(accumulator_)
<< "; count: " << count_ << "}";
@@ -414,7 +414,7 @@
HpackHuffmanDecoder::~HpackHuffmanDecoder() = default;
-bool HpackHuffmanDecoder::Decode(Http2StringPiece input, Http2String* output) {
+bool HpackHuffmanDecoder::Decode(Http2StringPiece input, std::string* output) {
HTTP2_DVLOG(1) << "HpackHuffmanDecoder::Decode";
// Fill bit_buffer_ from input.
@@ -480,7 +480,7 @@
}
}
-Http2String HpackHuffmanDecoder::DebugString() const {
+std::string HpackHuffmanDecoder::DebugString() const {
return bit_buffer_.DebugString();
}
diff --git a/http2/hpack/huffman/hpack_huffman_decoder.h b/http2/hpack/huffman/hpack_huffman_decoder.h
index 8e511d6..065fe85 100644
--- a/http2/hpack/huffman/hpack_huffman_decoder.h
+++ b/http2/hpack/huffman/hpack_huffman_decoder.h
@@ -16,9 +16,9 @@
#include <cstdint>
#include <iosfwd>
+#include <string>
#include "net/third_party/quiche/src/http2/platform/api/http2_export.h"
-#include "net/third_party/quiche/src/http2/platform/api/http2_string.h"
#include "net/third_party/quiche/src/http2/platform/api/http2_string_piece.h"
namespace http2 {
@@ -74,7 +74,7 @@
// of them 1. Otherwise returns false.
bool InputProperlyTerminated() const;
- Http2String DebugString() const;
+ std::string DebugString() const;
private:
HuffmanAccumulator accumulator_;
@@ -109,7 +109,7 @@
// will contain the leading bits of the code for that symbol, but not the
// final bits of that code.
// Note that output should be empty, but that it is not cleared by Decode().
- bool Decode(Http2StringPiece input, Http2String* output);
+ bool Decode(Http2StringPiece input, std::string* output);
// Is what remains in the bit_buffer_ valid at the end of an encoded string?
// Call after passing the the final portion of a Huffman string to Decode,
@@ -118,7 +118,7 @@
return bit_buffer_.InputProperlyTerminated();
}
- Http2String DebugString() const;
+ std::string DebugString() const;
private:
HuffmanBitBuffer bit_buffer_;
diff --git a/http2/hpack/huffman/hpack_huffman_decoder_test.cc b/http2/hpack/huffman/hpack_huffman_decoder_test.cc
index 30b586f..f1bed3c 100644
--- a/http2/hpack/huffman/hpack_huffman_decoder_test.cc
+++ b/http2/hpack/huffman/hpack_huffman_decoder_test.cc
@@ -32,7 +32,7 @@
}
TEST(HuffmanBitBufferTest, AppendBytesAligned) {
- Http2String s;
+ std::string s;
s.push_back('\x11');
s.push_back('\x22');
s.push_back('\x33');
@@ -81,7 +81,7 @@
}
TEST(HuffmanBitBufferTest, ConsumeBits) {
- Http2String s;
+ std::string s;
s.push_back('\x11');
s.push_back('\x22');
s.push_back('\x33');
@@ -103,7 +103,7 @@
}
TEST(HuffmanBitBufferTest, AppendBytesUnaligned) {
- Http2String s;
+ std::string s;
s.push_back('\x11');
s.push_back('\x22');
s.push_back('\x33');
@@ -180,14 +180,14 @@
}
HpackHuffmanDecoder decoder_;
- Http2String output_buffer_;
+ std::string output_buffer_;
size_t input_bytes_seen_;
size_t input_bytes_expected_;
};
TEST_F(HpackHuffmanDecoderTest, SpecRequestExamples) {
HpackHuffmanDecoder decoder;
- Http2String test_table[] = {
+ std::string test_table[] = {
Http2HexDecode("f1e3c2e5f23a6ba0ab90f4ff"),
"www.example.com",
Http2HexDecode("a8eb10649cbf"),
@@ -198,9 +198,9 @@
"custom-value",
};
for (size_t i = 0; i != HTTP2_ARRAYSIZE(test_table); i += 2) {
- const Http2String& huffman_encoded(test_table[i]);
- const Http2String& plain_string(test_table[i + 1]);
- Http2String buffer;
+ const std::string& huffman_encoded(test_table[i]);
+ const std::string& plain_string(test_table[i + 1]);
+ std::string buffer;
decoder.Reset();
EXPECT_TRUE(decoder.Decode(huffman_encoded, &buffer)) << decoder;
EXPECT_TRUE(decoder.InputProperlyTerminated()) << decoder;
@@ -211,7 +211,7 @@
TEST_F(HpackHuffmanDecoderTest, SpecResponseExamples) {
HpackHuffmanDecoder decoder;
// clang-format off
- Http2String test_table[] = {
+ std::string test_table[] = {
Http2HexDecode("6402"),
"302",
Http2HexDecode("aec3771a4b"),
@@ -229,9 +229,9 @@
};
// clang-format on
for (size_t i = 0; i != HTTP2_ARRAYSIZE(test_table); i += 2) {
- const Http2String& huffman_encoded(test_table[i]);
- const Http2String& plain_string(test_table[i + 1]);
- Http2String buffer;
+ const std::string& huffman_encoded(test_table[i]);
+ const std::string& plain_string(test_table[i + 1]);
+ std::string buffer;
decoder.Reset();
EXPECT_TRUE(decoder.Decode(huffman_encoded, &buffer)) << decoder;
EXPECT_TRUE(decoder.InputProperlyTerminated()) << decoder;
diff --git a/http2/hpack/huffman/hpack_huffman_encoder.cc b/http2/hpack/huffman/hpack_huffman_encoder.cc
index a92a4c0..8a5dee9 100644
--- a/http2/hpack/huffman/hpack_huffman_encoder.cc
+++ b/http2/hpack/huffman/hpack_huffman_encoder.cc
@@ -61,7 +61,7 @@
return (bits + 7) / 8;
}
-void HuffmanEncode(Http2StringPiece plain, Http2String* huffman) {
+void HuffmanEncode(Http2StringPiece plain, std::string* huffman) {
DCHECK(huffman != nullptr);
huffman->clear(); // Note that this doesn't release memory.
uint64_t bit_buffer = 0; // High-bit is next bit to output. Not clear if that
diff --git a/http2/hpack/huffman/hpack_huffman_encoder.h b/http2/hpack/huffman/hpack_huffman_encoder.h
index bf6b1b2..247aaff 100644
--- a/http2/hpack/huffman/hpack_huffman_encoder.h
+++ b/http2/hpack/huffman/hpack_huffman_encoder.h
@@ -9,9 +9,9 @@
// table.
#include <cstddef> // For size_t
+#include <string>
#include "net/third_party/quiche/src/http2/platform/api/http2_export.h"
-#include "net/third_party/quiche/src/http2/platform/api/http2_string.h"
#include "net/third_party/quiche/src/http2/platform/api/http2_string_piece.h"
namespace http2 {
@@ -33,7 +33,7 @@
// the beginning of this function. This allows reusing the same string object
// across multiple invocations.
HTTP2_EXPORT_PRIVATE void HuffmanEncode(Http2StringPiece plain,
- Http2String* huffman);
+ std::string* huffman);
} // namespace http2
diff --git a/http2/hpack/huffman/hpack_huffman_encoder_test.cc b/http2/hpack/huffman/hpack_huffman_encoder_test.cc
index 2a8999f..24d3cf1 100644
--- a/http2/hpack/huffman/hpack_huffman_encoder_test.cc
+++ b/http2/hpack/huffman/hpack_huffman_encoder_test.cc
@@ -12,7 +12,7 @@
namespace {
TEST(HuffmanEncoderTest, SpecRequestExamples) {
- Http2String test_table[] = {
+ std::string test_table[] = {
Http2HexDecode("f1e3c2e5f23a6ba0ab90f4ff"),
"www.example.com",
Http2HexDecode("a8eb10649cbf"),
@@ -23,11 +23,11 @@
"custom-value",
};
for (size_t i = 0; i != HTTP2_ARRAYSIZE(test_table); i += 2) {
- const Http2String& huffman_encoded(test_table[i]);
- const Http2String& plain_string(test_table[i + 1]);
+ const std::string& huffman_encoded(test_table[i]);
+ const std::string& plain_string(test_table[i + 1]);
EXPECT_EQ(ExactHuffmanSize(plain_string), huffman_encoded.size());
EXPECT_EQ(BoundedHuffmanSize(plain_string), huffman_encoded.size());
- Http2String buffer;
+ std::string buffer;
buffer.reserve();
HuffmanEncode(plain_string, &buffer);
EXPECT_EQ(buffer, huffman_encoded) << "Error encoding " << plain_string;
@@ -36,7 +36,7 @@
TEST(HuffmanEncoderTest, SpecResponseExamples) {
// clang-format off
- Http2String test_table[] = {
+ std::string test_table[] = {
Http2HexDecode("6402"),
"302",
Http2HexDecode("aec3771a4b"),
@@ -54,11 +54,11 @@
};
// clang-format on
for (size_t i = 0; i != HTTP2_ARRAYSIZE(test_table); i += 2) {
- const Http2String& huffman_encoded(test_table[i]);
- const Http2String& plain_string(test_table[i + 1]);
+ const std::string& huffman_encoded(test_table[i]);
+ const std::string& plain_string(test_table[i + 1]);
EXPECT_EQ(ExactHuffmanSize(plain_string), huffman_encoded.size());
EXPECT_EQ(BoundedHuffmanSize(plain_string), huffman_encoded.size());
- Http2String buffer;
+ std::string buffer;
buffer.reserve(huffman_encoded.size());
const size_t capacity = buffer.capacity();
HuffmanEncode(plain_string, &buffer);
@@ -68,14 +68,14 @@
}
TEST(HuffmanEncoderTest, EncodedSizeAgreesWithEncodeString) {
- Http2String test_table[] = {
+ std::string test_table[] = {
"",
"Mon, 21 Oct 2013 20:13:21 GMT",
"https://www.example.com",
"foo=ASDJKHQKBZXOQWEOPIUAXQWEOIU; max-age=3600; version=1",
- Http2String(1, '\0'),
- Http2String("foo\0bar", 7),
- Http2String(256, '\0'),
+ std::string(1, '\0'),
+ std::string("foo\0bar", 7),
+ std::string(256, '\0'),
};
// Modify last |test_table| entry to cover all codes.
for (size_t i = 0; i != 256; ++i) {
@@ -83,8 +83,8 @@
}
for (size_t i = 0; i != HTTP2_ARRAYSIZE(test_table); ++i) {
- const Http2String& plain_string = test_table[i];
- Http2String huffman_encoded;
+ const std::string& plain_string = test_table[i];
+ std::string huffman_encoded;
HuffmanEncode(plain_string, &huffman_encoded);
EXPECT_EQ(huffman_encoded.size(), ExactHuffmanSize(plain_string));
EXPECT_LE(BoundedHuffmanSize(plain_string), plain_string.size());
diff --git a/http2/hpack/huffman/hpack_huffman_transcoder_test.cc b/http2/hpack/huffman/hpack_huffman_transcoder_test.cc
index 2791d6a..9781094 100644
--- a/http2/hpack/huffman/hpack_huffman_transcoder_test.cc
+++ b/http2/hpack/huffman/hpack_huffman_transcoder_test.cc
@@ -11,7 +11,6 @@
#include "net/third_party/quiche/src/http2/decoder/decode_status.h"
#include "net/third_party/quiche/src/http2/hpack/huffman/hpack_huffman_decoder.h"
#include "net/third_party/quiche/src/http2/hpack/huffman/hpack_huffman_encoder.h"
-#include "net/third_party/quiche/src/http2/platform/api/http2_string.h"
#include "net/third_party/quiche/src/http2/platform/api/http2_string_piece.h"
#include "net/third_party/quiche/src/http2/platform/api/http2_string_utils.h"
#include "net/third_party/quiche/src/http2/tools/random_decoder_test.h"
@@ -24,8 +23,8 @@
namespace test {
namespace {
-Http2String GenAsciiNonControlSet() {
- Http2String s;
+std::string GenAsciiNonControlSet() {
+ std::string s;
const char space = ' '; // First character after the control characters: 0x20
const char del = 127; // First character after the non-control characters.
for (char c = space; c < del; ++c) {
@@ -74,7 +73,7 @@
AssertionResult TranscodeAndValidateSeveralWays(
Http2StringPiece plain,
Http2StringPiece expected_huffman) {
- Http2String encoded;
+ std::string encoded;
HuffmanEncode(plain, &encoded);
if (expected_huffman.size() > 0 || plain.empty()) {
VERIFY_EQ(encoded, expected_huffman);
@@ -95,22 +94,22 @@
return TranscodeAndValidateSeveralWays(plain, "");
}
- Http2String RandomAsciiNonControlString(int length) {
+ std::string RandomAsciiNonControlString(int length) {
return Random().RandStringWithAlphabet(length, ascii_non_control_set_);
}
- Http2String RandomBytes(int length) { return Random().RandString(length); }
+ std::string RandomBytes(int length) { return Random().RandString(length); }
- const Http2String ascii_non_control_set_;
+ const std::string ascii_non_control_set_;
HpackHuffmanDecoder decoder_;
- Http2String output_buffer_;
+ std::string output_buffer_;
size_t input_bytes_seen_;
size_t input_bytes_expected_;
};
TEST_F(HpackHuffmanTranscoderTest, RoundTripRandomAsciiNonControlString) {
for (size_t length = 0; length != 20; length++) {
- const Http2String s = RandomAsciiNonControlString(length);
+ const std::string s = RandomAsciiNonControlString(length);
ASSERT_TRUE(TranscodeAndValidateSeveralWays(s))
<< "Unable to decode:\n\n"
<< Http2HexDump(s) << "\n\noutput_buffer_:\n"
@@ -120,7 +119,7 @@
TEST_F(HpackHuffmanTranscoderTest, RoundTripRandomBytes) {
for (size_t length = 0; length != 20; length++) {
- const Http2String s = RandomBytes(length);
+ const std::string s = RandomBytes(length);
ASSERT_TRUE(TranscodeAndValidateSeveralWays(s))
<< "Unable to decode:\n\n"
<< Http2HexDump(s) << "\n\noutput_buffer_:\n"
@@ -145,7 +144,7 @@
// Test c_ adjacent to every other character, both before and after.
TEST_P(HpackHuffmanTranscoderAdjacentCharTest, RoundTripAdjacentChar) {
- Http2String s;
+ std::string s;
for (int a = 0; a < 256; ++a) {
s.push_back(static_cast<char>(a));
s.push_back(c_);
@@ -162,7 +161,7 @@
HpackHuffmanTranscoderRepeatedCharTest()
: c_(static_cast<char>(::testing::get<0>(GetParam()))),
length_(::testing::get<1>(GetParam())) {}
- Http2String MakeString() { return Http2String(length_, c_); }
+ std::string MakeString() { return std::string(length_, c_); }
private:
const char c_;
diff --git a/http2/hpack/tools/hpack_block_builder.h b/http2/hpack/tools/hpack_block_builder.h
index 560953c..59c3805 100644
--- a/http2/hpack/tools/hpack_block_builder.h
+++ b/http2/hpack/tools/hpack_block_builder.h
@@ -18,10 +18,10 @@
#include <stddef.h>
#include <cstdint>
+#include <string>
#include "testing/gtest/include/gtest/gtest.h"
#include "net/third_party/quiche/src/http2/hpack/http2_hpack_constants.h"
-#include "net/third_party/quiche/src/http2/platform/api/http2_string.h"
#include "net/third_party/quiche/src/http2/platform/api/http2_string_piece.h"
namespace http2 {
@@ -35,7 +35,7 @@
~HpackBlockBuilder() {}
size_t size() const { return buffer_.size(); }
- const Http2String& buffer() const { return buffer_; }
+ const std::string& buffer() const { return buffer_; }
//----------------------------------------------------------------------------
// Methods for appending a valid HPACK entry.
@@ -87,7 +87,7 @@
void AppendString(bool is_huffman_encoded, Http2StringPiece str);
private:
- Http2String buffer_;
+ std::string buffer_;
};
} // namespace test
diff --git a/http2/hpack/tools/hpack_block_builder_test.cc b/http2/hpack/tools/hpack_block_builder_test.cc
index a7b8064..bba363f 100644
--- a/http2/hpack/tools/hpack_block_builder_test.cc
+++ b/http2/hpack/tools/hpack_block_builder_test.cc
@@ -96,7 +96,7 @@
// 0x0000: 8286 8441 0f77 7777 2e65 7861 6d70 6c65 ...A.www.example
// 0x0010: 2e63 6f6d .com
- const Http2String expected =
+ const std::string expected =
Http2HexDecode("828684410f7777772e6578616d706c652e636f6d");
EXPECT_EQ(expected, b.buffer());
}
@@ -127,7 +127,7 @@
// 0x0000: 8286 8441 8cf1 e3c2 e5f2 3a6b a0ab 90f4 ...A......:k....
// 0x0010: ff .
- const Http2String expected =
+ const std::string expected =
Http2HexDecode("828684418cf1e3c2e5f23a6ba0ab90f4ff");
EXPECT_EQ(expected, b.buffer());
}
diff --git a/http2/hpack/tools/hpack_example.cc b/http2/hpack/tools/hpack_example.cc
index d7b8c7c..52d84f9 100644
--- a/http2/hpack/tools/hpack_example.cc
+++ b/http2/hpack/tools/hpack_example.cc
@@ -14,7 +14,7 @@
namespace test {
namespace {
-void HpackExampleToStringOrDie(Http2StringPiece example, Http2String* output) {
+void HpackExampleToStringOrDie(Http2StringPiece example, std::string* output) {
while (!example.empty()) {
const char c0 = example[0];
if (isxdigit(c0)) {
@@ -48,8 +48,8 @@
} // namespace
-Http2String HpackExampleToStringOrDie(Http2StringPiece example) {
- Http2String output;
+std::string HpackExampleToStringOrDie(Http2StringPiece example) {
+ std::string output;
HpackExampleToStringOrDie(example, &output);
return output;
}
diff --git a/http2/hpack/tools/hpack_example.h b/http2/hpack/tools/hpack_example.h
index ddb22a3..0371e17 100644
--- a/http2/hpack/tools/hpack_example.h
+++ b/http2/hpack/tools/hpack_example.h
@@ -5,7 +5,8 @@
#ifndef QUICHE_HTTP2_HPACK_TOOLS_HPACK_EXAMPLE_H_
#define QUICHE_HTTP2_HPACK_TOOLS_HPACK_EXAMPLE_H_
-#include "net/third_party/quiche/src/http2/platform/api/http2_string.h"
+#include <string>
+
#include "net/third_party/quiche/src/http2/platform/api/http2_string_piece.h"
// Parses HPACK examples in the format seen in the HPACK specification,
@@ -23,7 +24,7 @@
namespace http2 {
namespace test {
-Http2String HpackExampleToStringOrDie(Http2StringPiece example);
+std::string HpackExampleToStringOrDie(Http2StringPiece example);
} // namespace test
} // namespace http2
diff --git a/http2/hpack/varint/hpack_varint_decoder.cc b/http2/hpack/varint/hpack_varint_decoder.cc
index 9741a23..e7e2c9c 100644
--- a/http2/hpack/varint/hpack_varint_decoder.cc
+++ b/http2/hpack/varint/hpack_varint_decoder.cc
@@ -120,7 +120,7 @@
value_ = v;
}
-Http2String HpackVarintDecoder::DebugString() const {
+std::string HpackVarintDecoder::DebugString() const {
return Http2StrCat("HpackVarintDecoder(value=", value_, ", offset=", offset_,
")");
}
diff --git a/http2/hpack/varint/hpack_varint_decoder.h b/http2/hpack/varint/hpack_varint_decoder.h
index 855ced4..4576446 100644
--- a/http2/hpack/varint/hpack_varint_decoder.h
+++ b/http2/hpack/varint/hpack_varint_decoder.h
@@ -29,12 +29,12 @@
#include <cstdint>
#include <limits>
+#include <string>
#include "net/third_party/quiche/src/http2/decoder/decode_buffer.h"
#include "net/third_party/quiche/src/http2/decoder/decode_status.h"
#include "net/third_party/quiche/src/http2/platform/api/http2_export.h"
#include "net/third_party/quiche/src/http2/platform/api/http2_logging.h"
-#include "net/third_party/quiche/src/http2/platform/api/http2_string.h"
namespace http2 {
@@ -83,7 +83,7 @@
// All the public methods below are for supporting assertions and tests.
- Http2String DebugString() const;
+ std::string DebugString() const;
// For benchmarking, these methods ensure the decoder
// is NOT inlined into the caller.
diff --git a/http2/hpack/varint/hpack_varint_decoder_test.cc b/http2/hpack/varint/hpack_varint_decoder_test.cc
index 1610126..07cb51b 100644
--- a/http2/hpack/varint/hpack_varint_decoder_test.cc
+++ b/http2/hpack/varint/hpack_varint_decoder_test.cc
@@ -69,7 +69,7 @@
prefix_length_ = prefix_length;
// Copy |data| so that it can be modified.
- Http2String data_copy(data);
+ std::string data_copy(data);
// Bits of the first byte not part of the prefix should be ignored.
uint8_t high_bits_mask = 0b11111111 << prefix_length_;
@@ -101,7 +101,7 @@
// Bits of the first byte not part of the prefix.
const uint8_t high_bits_;
// Extra bytes appended to the input.
- const Http2String suffix_;
+ const std::string suffix_;
HpackVarintDecoder decoder_;
uint8_t prefix_length_;
diff --git a/http2/hpack/varint/hpack_varint_encoder.cc b/http2/hpack/varint/hpack_varint_encoder.cc
index 63cf289..11ebf6a 100644
--- a/http2/hpack/varint/hpack_varint_encoder.cc
+++ b/http2/hpack/varint/hpack_varint_encoder.cc
@@ -14,7 +14,7 @@
void HpackVarintEncoder::Encode(uint8_t high_bits,
uint8_t prefix_length,
uint64_t varint,
- Http2String* output) {
+ std::string* output) {
DCHECK_LE(1u, prefix_length);
DCHECK_LE(prefix_length, 8u);
diff --git a/http2/hpack/varint/hpack_varint_encoder.h b/http2/hpack/varint/hpack_varint_encoder.h
index 745222e..014380d 100644
--- a/http2/hpack/varint/hpack_varint_encoder.h
+++ b/http2/hpack/varint/hpack_varint_encoder.h
@@ -7,9 +7,9 @@
#include <cstddef>
#include <cstdint>
+#include <string>
#include "net/third_party/quiche/src/http2/platform/api/http2_export.h"
-#include "net/third_party/quiche/src/http2/platform/api/http2_string.h"
namespace http2 {
@@ -23,7 +23,7 @@
static void Encode(uint8_t high_bits,
uint8_t prefix_length,
uint64_t varint,
- Http2String* output);
+ std::string* output);
};
} // namespace http2
diff --git a/http2/hpack/varint/hpack_varint_encoder_test.cc b/http2/hpack/varint/hpack_varint_encoder_test.cc
index 94f9a9e..23c19c4 100644
--- a/http2/hpack/varint/hpack_varint_encoder_test.cc
+++ b/http2/hpack/varint/hpack_varint_encoder_test.cc
@@ -31,7 +31,7 @@
// Encode integers that fit in the prefix.
TEST(HpackVarintEncoderTest, Short) {
for (size_t i = 0; i < HTTP2_ARRAYSIZE(kShortTestData); ++i) {
- Http2String output;
+ std::string output;
HpackVarintEncoder::Encode(kShortTestData[i].high_bits,
kShortTestData[i].prefix_length,
kShortTestData[i].value, &output);
@@ -104,10 +104,10 @@
// Test encoding byte by byte, also test encoding in
// a single ResumeEncoding() call.
for (size_t i = 0; i < HTTP2_ARRAYSIZE(kLongTestData); ++i) {
- Http2String expected_encoding =
+ std::string expected_encoding =
Http2HexDecode(kLongTestData[i].expected_encoding);
- Http2String output;
+ std::string output;
HpackVarintEncoder::Encode(kLongTestData[i].high_bits,
kLongTestData[i].prefix_length,
kLongTestData[i].value, &output);
@@ -131,7 +131,7 @@
// happens exactly when encoding the value 2^prefix_length - 1.
TEST(HpackVarintEncoderTest, LastByteIsZero) {
for (size_t i = 0; i < HTTP2_ARRAYSIZE(kLastByteIsZeroTestData); ++i) {
- Http2String output;
+ std::string output;
HpackVarintEncoder::Encode(kLastByteIsZeroTestData[i].high_bits,
kLastByteIsZeroTestData[i].prefix_length,
kLastByteIsZeroTestData[i].value, &output);
@@ -144,7 +144,7 @@
// Test that encoder appends correctly to non-empty string.
TEST(HpackVarintEncoderTest, Append) {
- Http2String output("foo");
+ std::string output("foo");
EXPECT_EQ(Http2HexDecode("666f6f"), output);
HpackVarintEncoder::Encode(0b10011000, 3, 103, &output);
diff --git a/http2/hpack/varint/hpack_varint_round_trip_test.cc b/http2/hpack/varint/hpack_varint_round_trip_test.cc
index 594317b..a5318fb 100644
--- a/http2/hpack/varint/hpack_varint_round_trip_test.cc
+++ b/http2/hpack/varint/hpack_varint_round_trip_test.cc
@@ -161,7 +161,7 @@
for (const uint64_t value : values) {
Encode(value, prefix_length); // Sets buffer_.
- Http2String msg = Http2StrCat("value=", value, " (0x", Http2Hex(value),
+ std::string msg = Http2StrCat("value=", value, " (0x", Http2Hex(value),
"), prefix_length=", prefix_length,
", expected_bytes=", expected_bytes, "\n",
Http2HexDump(buffer_));
@@ -241,7 +241,7 @@
}
HpackVarintDecoder decoder_;
- Http2String buffer_;
+ std::string buffer_;
uint8_t prefix_length_;
};
@@ -283,7 +283,7 @@
for (uint64_t value : values) {
EncodeNoRandom(value, prefix_length);
- Http2String dump = Http2HexDump(buffer_);
+ std::string dump = Http2HexDump(buffer_);
HTTP2_LOG(INFO) << Http2StringPrintf("%10llu %0#18x ", value, value)
<< Http2HexDump(buffer_).substr(7);
}