Remove Http2String wrapper for std::string. gfe-relnote: n/a, no functional change. PiperOrigin-RevId: 263816460 Change-Id: I4f365540414e6a3d78fd00ce6b39a4cdd4c14140
diff --git a/http2/decoder/decode_http2_structures_test.cc b/http2/decoder/decode_http2_structures_test.cc index 91b3ef7..48b79bd 100644 --- a/http2/decoder/decode_http2_structures_test.cc +++ b/http2/decoder/decode_http2_structures_test.cc
@@ -9,13 +9,14 @@ #include <stddef.h> +#include <string> + #include "testing/gtest/include/gtest/gtest.h" #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/http2_constants.h" #include "net/third_party/quiche/src/http2/http2_structures_test_util.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_piece.h" #include "net/third_party/quiche/src/http2/test_tools/http2_random.h" #include "net/third_party/quiche/src/http2/tools/http2_frame_builder.h" @@ -32,7 +33,7 @@ } template <class S> -Http2String SerializeStructure(const S& s) { +std::string SerializeStructure(const S& s) { Http2FrameBuilder fb; fb.Append(s); EXPECT_EQ(S::EncodedSize(), fb.size()); @@ -70,7 +71,7 @@ // Encode the structure |in_s| into bytes, then decode the bytes // and validate that the decoder produced the same field values. void EncodeThenDecode(const S& in_s) { - Http2String bytes = SerializeStructure(in_s); + std::string bytes = SerializeStructure(in_s); EXPECT_EQ(S::EncodedSize(), bytes.size()); DecodeLeadingStructure(&in_s, bytes); }
diff --git a/http2/decoder/http2_frame_decoder_test.cc b/http2/decoder/http2_frame_decoder_test.cc index 50e75ed..7ed67f3 100644 --- a/http2/decoder/http2_frame_decoder_test.cc +++ b/http2/decoder/http2_frame_decoder_test.cc
@@ -6,13 +6,13 @@ // Tests of Http2FrameDecoder. +#include <string> #include <vector> #include "testing/gtest/include/gtest/gtest.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_reconstruct_object.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_test_helpers.h" #include "net/third_party/quiche/src/http2/test_tools/frame_parts.h" @@ -84,7 +84,7 @@ // The decoder will discard the remaining bytes, but not go beyond that, // which these conditions verify. size_t extra = 10; - Http2String junk(remaining + extra, '0'); + std::string junk(remaining + extra, '0'); DecodeBuffer tmp(junk); EXPECT_EQ(DecodeStatus::kDecodeDone, decoder_.DecodeFrame(&tmp)); EXPECT_EQ(remaining, tmp.Offset()); @@ -147,8 +147,8 @@ VERIFY_GT(slow_decode_count_, 0u); // Repeat with more input; it should stop without reading that input. - Http2String next_frame = Random().RandString(10); - Http2String input(payload.data(), payload.size()); + std::string next_frame = Random().RandString(10); + std::string input(payload.data(), payload.size()); input += next_frame; ResetDecodeSpeedCounters();
diff --git a/http2/decoder/http2_structure_decoder_test.cc b/http2/decoder/http2_structure_decoder_test.cc index 7b9afc5..2545109 100644 --- a/http2/decoder/http2_structure_decoder_test.cc +++ b/http2/decoder/http2_structure_decoder_test.cc
@@ -21,6 +21,7 @@ #include <stddef.h> #include <cstdint> +#include <string> #include "testing/gtest/include/gtest/gtest.h" #include "net/third_party/quiche/src/http2/decoder/decode_buffer.h" @@ -29,7 +30,6 @@ #include "net/third_party/quiche/src/http2/http2_structures_test_util.h" #include "net/third_party/quiche/src/http2/platform/api/http2_logging.h" #include "net/third_party/quiche/src/http2/platform/api/http2_reconstruct_object.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_test_helpers.h" #include "net/third_party/quiche/src/http2/tools/http2_frame_builder.h" @@ -159,7 +159,7 @@ // Encode the structure |in_s| into bytes, then decode the bytes // and validate that the decoder produced the same field values. AssertionResult EncodeThenDecode(const S& in_s) { - Http2String bytes = SerializeStructure(in_s); + std::string bytes = SerializeStructure(in_s); VERIFY_EQ(S::EncodedSize(), bytes.size()); VERIFY_AND_RETURN_SUCCESS(DecodeLeadingStructure(&in_s, bytes)); }
diff --git a/http2/decoder/payload_decoders/altsvc_payload_decoder_test.cc b/http2/decoder/payload_decoders/altsvc_payload_decoder_test.cc index 6a4bee5..354fdae 100644 --- a/http2/decoder/payload_decoders/altsvc_payload_decoder_test.cc +++ b/http2/decoder/payload_decoders/altsvc_payload_decoder_test.cc
@@ -6,13 +6,14 @@ #include <stddef.h> +#include <string> + #include "testing/gtest/include/gtest/gtest.h" #include "net/third_party/quiche/src/http2/decoder/http2_frame_decoder_listener.h" #include "net/third_party/quiche/src/http2/decoder/payload_decoders/payload_decoder_base_test_util.h" #include "net/third_party/quiche/src/http2/http2_constants.h" #include "net/third_party/quiche/src/http2/http2_structures_test_util.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/test_tools/frame_parts.h" #include "net/third_party/quiche/src/http2/test_tools/frame_parts_collector.h" #include "net/third_party/quiche/src/http2/test_tools/http2_random.h" @@ -103,8 +104,8 @@ ::testing::Values(0, 1, 3, 65537))); TEST_P(AltSvcPayloadLengthTests, ValidOriginAndValueLength) { - Http2String origin = Random().RandString(origin_length_); - Http2String value = Random().RandString(value_length_); + std::string origin = Random().RandString(origin_length_); + std::string value = Random().RandString(value_length_); Http2FrameBuilder fb; fb.Append(Http2AltSvcFields{origin_length_}); fb.Append(origin);
diff --git a/http2/decoder/payload_decoders/continuation_payload_decoder_test.cc b/http2/decoder/payload_decoders/continuation_payload_decoder_test.cc index 35479a1..125e16f 100644 --- a/http2/decoder/payload_decoders/continuation_payload_decoder_test.cc +++ b/http2/decoder/payload_decoders/continuation_payload_decoder_test.cc
@@ -6,6 +6,7 @@ #include <stddef.h> +#include <string> #include <type_traits> #include "testing/gtest/include/gtest/gtest.h" @@ -14,7 +15,6 @@ #include "net/third_party/quiche/src/http2/http2_constants.h" #include "net/third_party/quiche/src/http2/http2_structures.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/test_tools/frame_parts.h" #include "net/third_party/quiche/src/http2/test_tools/frame_parts_collector.h" #include "net/third_party/quiche/src/http2/tools/random_decoder_test.h" @@ -73,7 +73,7 @@ ::testing::Values(0, 1, 2, 3, 4, 5, 6)); TEST_P(ContinuationPayloadDecoderTest, ValidLength) { - Http2String hpack_payload = Random().RandString(length_); + std::string hpack_payload = Random().RandString(length_); Http2FrameHeader frame_header(length_, Http2FrameType::CONTINUATION, RandFlags(), RandStreamId()); set_frame_header(frame_header);
diff --git a/http2/decoder/payload_decoders/data_payload_decoder_test.cc b/http2/decoder/payload_decoders/data_payload_decoder_test.cc index 1cae714..f1dc017 100644 --- a/http2/decoder/payload_decoders/data_payload_decoder_test.cc +++ b/http2/decoder/payload_decoders/data_payload_decoder_test.cc
@@ -6,6 +6,8 @@ #include <stddef.h> +#include <string> + #include "testing/gtest/include/gtest/gtest.h" #include "net/third_party/quiche/src/http2/decoder/http2_frame_decoder_listener.h" #include "net/third_party/quiche/src/http2/decoder/payload_decoders/payload_decoder_base_test_util.h" @@ -13,7 +15,6 @@ #include "net/third_party/quiche/src/http2/http2_structures.h" #include "net/third_party/quiche/src/http2/http2_structures_test_util.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/frame_parts.h" #include "net/third_party/quiche/src/http2/test_tools/frame_parts_collector.h" @@ -84,7 +85,7 @@ Reset(); uint8_t flags = RandFlags(); - Http2String data_payload = Random().RandString(data_size); + std::string data_payload = Random().RandString(data_size); frame_builder_.Append(data_payload); MaybeAppendTrailingPadding();
diff --git a/http2/decoder/payload_decoders/goaway_payload_decoder_test.cc b/http2/decoder/payload_decoders/goaway_payload_decoder_test.cc index 5ea533a..b2d96fb 100644 --- a/http2/decoder/payload_decoders/goaway_payload_decoder_test.cc +++ b/http2/decoder/payload_decoders/goaway_payload_decoder_test.cc
@@ -6,13 +6,14 @@ #include <stddef.h> +#include <string> + #include "testing/gtest/include/gtest/gtest.h" #include "net/third_party/quiche/src/http2/decoder/http2_frame_decoder_listener.h" #include "net/third_party/quiche/src/http2/decoder/payload_decoders/payload_decoder_base_test_util.h" #include "net/third_party/quiche/src/http2/http2_constants.h" #include "net/third_party/quiche/src/http2/http2_structures_test_util.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/test_tools/frame_parts.h" #include "net/third_party/quiche/src/http2/test_tools/frame_parts_collector.h" #include "net/third_party/quiche/src/http2/test_tools/http2_random.h" @@ -92,7 +93,7 @@ TEST_P(GoAwayOpaqueDataLengthTests, ValidLength) { Http2GoAwayFields goaway; Randomize(&goaway, RandomPtr()); - Http2String opaque_data = Random().RandString(length_); + std::string opaque_data = Random().RandString(length_); Http2FrameBuilder fb; fb.Append(goaway); fb.Append(opaque_data);
diff --git a/http2/decoder/payload_decoders/headers_payload_decoder_test.cc b/http2/decoder/payload_decoders/headers_payload_decoder_test.cc index a7a90bf..4e0f2e3 100644 --- a/http2/decoder/payload_decoders/headers_payload_decoder_test.cc +++ b/http2/decoder/payload_decoders/headers_payload_decoder_test.cc
@@ -6,13 +6,14 @@ #include <stddef.h> +#include <string> + #include "testing/gtest/include/gtest/gtest.h" #include "net/third_party/quiche/src/http2/decoder/http2_frame_decoder_listener.h" #include "net/third_party/quiche/src/http2/decoder/payload_decoders/payload_decoder_base_test_util.h" #include "net/third_party/quiche/src/http2/http2_constants.h" #include "net/third_party/quiche/src/http2/http2_structures_test_util.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/test_tools/frame_parts.h" #include "net/third_party/quiche/src/http2/test_tools/frame_parts_collector.h" #include "net/third_party/quiche/src/http2/test_tools/http2_random.h" @@ -116,7 +117,7 @@ frame_builder_.Append(priority); } - Http2String hpack_payload = Random().RandString(hpack_size); + std::string hpack_payload = Random().RandString(hpack_size); frame_builder_.Append(hpack_payload); MaybeAppendTrailingPadding();
diff --git a/http2/decoder/payload_decoders/payload_decoder_base_test_util.h b/http2/decoder/payload_decoders/payload_decoder_base_test_util.h index 66dd88a..5de0d1b 100644 --- a/http2/decoder/payload_decoders/payload_decoder_base_test_util.h +++ b/http2/decoder/payload_decoders/payload_decoder_base_test_util.h
@@ -9,6 +9,8 @@ #include <stddef.h> +#include <string> + #include "testing/gtest/include/gtest/gtest.h" #include "net/third_party/quiche/src/http2/decoder/decode_buffer.h" #include "net/third_party/quiche/src/http2/decoder/decode_status.h" @@ -19,7 +21,6 @@ #include "net/third_party/quiche/src/http2/http2_structures.h" #include "net/third_party/quiche/src/http2/platform/api/http2_logging.h" #include "net/third_party/quiche/src/http2/platform/api/http2_reconstruct_object.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/frame_parts.h" #include "net/third_party/quiche/src/http2/tools/http2_frame_builder.h" @@ -429,7 +430,7 @@ } HTTP2_VLOG(1) << "payload_length=" << payload_length; - Http2String payload = fb.buffer().substr(0, payload_length); + std::string payload = fb.buffer().substr(0, payload_length); // The missing length is the amount we cut off the end, unless // payload_length is zero, in which case the decoder knows only that 1
diff --git a/http2/decoder/payload_decoders/push_promise_payload_decoder_test.cc b/http2/decoder/payload_decoders/push_promise_payload_decoder_test.cc index 64dd935..0561aa4 100644 --- a/http2/decoder/payload_decoders/push_promise_payload_decoder_test.cc +++ b/http2/decoder/payload_decoders/push_promise_payload_decoder_test.cc
@@ -6,13 +6,14 @@ #include <stddef.h> +#include <string> + #include "testing/gtest/include/gtest/gtest.h" #include "net/third_party/quiche/src/http2/decoder/http2_frame_decoder_listener.h" #include "net/third_party/quiche/src/http2/decoder/payload_decoders/payload_decoder_base_test_util.h" #include "net/third_party/quiche/src/http2/http2_constants.h" #include "net/third_party/quiche/src/http2/http2_structures_test_util.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/test_tools/frame_parts.h" #include "net/third_party/quiche/src/http2/test_tools/frame_parts_collector.h" #include "net/third_party/quiche/src/http2/test_tools/http2_random.h" @@ -98,7 +99,7 @@ HTTP2_LOG(INFO) << "########### hpack_size = " << hpack_size << " ###########"; Reset(); - Http2String hpack_payload = Random().RandString(hpack_size); + std::string hpack_payload = Random().RandString(hpack_size); Http2PushPromiseFields push_promise{RandStreamId()}; frame_builder_.Append(push_promise); frame_builder_.Append(hpack_payload);
diff --git a/http2/decoder/payload_decoders/unknown_payload_decoder_test.cc b/http2/decoder/payload_decoders/unknown_payload_decoder_test.cc index 018bd82..1075932 100644 --- a/http2/decoder/payload_decoders/unknown_payload_decoder_test.cc +++ b/http2/decoder/payload_decoders/unknown_payload_decoder_test.cc
@@ -6,6 +6,7 @@ #include <stddef.h> +#include <string> #include <type_traits> #include "testing/gtest/include/gtest/gtest.h" @@ -14,7 +15,6 @@ #include "net/third_party/quiche/src/http2/http2_constants.h" #include "net/third_party/quiche/src/http2/http2_structures.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/test_tools/frame_parts.h" #include "net/third_party/quiche/src/http2/test_tools/frame_parts_collector.h" #include "net/third_party/quiche/src/http2/test_tools/http2_random.h" @@ -83,7 +83,7 @@ ::testing::Values(0, 1, 2, 3, 255, 256)); TEST_P(UnknownPayloadDecoderTest, ValidLength) { - Http2String unknown_payload = Random().RandString(length_); + std::string unknown_payload = Random().RandString(length_); Http2FrameHeader frame_header(length_, g_unknown_frame_type, Random().Rand8(), RandStreamId()); set_frame_header(frame_header);
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); }
diff --git a/http2/http2_constants.cc b/http2/http2_constants.cc index ad15b69..38f8ab5 100644 --- a/http2/http2_constants.cc +++ b/http2/http2_constants.cc
@@ -10,7 +10,7 @@ namespace http2 { -Http2String Http2FrameTypeToString(Http2FrameType v) { +std::string Http2FrameTypeToString(Http2FrameType v) { switch (v) { case Http2FrameType::DATA: return "DATA"; @@ -38,13 +38,13 @@ return Http2StrCat("UnknownFrameType(", static_cast<int>(v), ")"); } -Http2String Http2FrameTypeToString(uint8_t v) { +std::string Http2FrameTypeToString(uint8_t v) { return Http2FrameTypeToString(static_cast<Http2FrameType>(v)); } -Http2String Http2FrameFlagsToString(Http2FrameType type, uint8_t flags) { - Http2String s; - // Closure to append flag name |v| to the Http2String |s|, +std::string Http2FrameFlagsToString(Http2FrameType type, uint8_t flags) { + std::string s; + // Closure to append flag name |v| to the std::string |s|, // and to clear |bit| from |flags|. auto append_and_clear = [&s, &flags](Http2StringPiece v, uint8_t bit) { if (!s.empty()) { @@ -85,11 +85,11 @@ DCHECK_EQ(0, flags); return s; } -Http2String Http2FrameFlagsToString(uint8_t type, uint8_t flags) { +std::string Http2FrameFlagsToString(uint8_t type, uint8_t flags) { return Http2FrameFlagsToString(static_cast<Http2FrameType>(type), flags); } -Http2String Http2ErrorCodeToString(uint32_t v) { +std::string Http2ErrorCodeToString(uint32_t v) { switch (v) { case 0x0: return "NO_ERROR"; @@ -122,11 +122,11 @@ } return Http2StrCat("UnknownErrorCode(0x", Http2Hex(v), ")"); } -Http2String Http2ErrorCodeToString(Http2ErrorCode v) { +std::string Http2ErrorCodeToString(Http2ErrorCode v) { return Http2ErrorCodeToString(static_cast<uint32_t>(v)); } -Http2String Http2SettingsParameterToString(uint32_t v) { +std::string Http2SettingsParameterToString(uint32_t v) { switch (v) { case 0x1: return "HEADER_TABLE_SIZE"; @@ -143,7 +143,7 @@ } return Http2StrCat("UnknownSettingsParameter(0x", Http2Hex(v), ")"); } -Http2String Http2SettingsParameterToString(Http2SettingsParameter v) { +std::string Http2SettingsParameterToString(Http2SettingsParameter v) { return Http2SettingsParameterToString(static_cast<uint32_t>(v)); }
diff --git a/http2/http2_constants.h b/http2/http2_constants.h index 9392006..75f294e 100644 --- a/http2/http2_constants.h +++ b/http2/http2_constants.h
@@ -10,9 +10,9 @@ #include <cstdint> #include <iosfwd> #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,12 +52,12 @@ return IsSupportedHttp2FrameType(static_cast<uint32_t>(v)); } -// The return type is 'Http2String' so that they can generate a unique string +// The return type is 'std::string' so that they can generate a unique string // for each unsupported value. Since these are just used for debugging/error // messages, that isn't a cost to we need to worry about. The same applies to // the functions later in this file. -HTTP2_EXPORT_PRIVATE Http2String Http2FrameTypeToString(Http2FrameType v); -HTTP2_EXPORT_PRIVATE Http2String Http2FrameTypeToString(uint8_t v); +HTTP2_EXPORT_PRIVATE std::string Http2FrameTypeToString(Http2FrameType v); +HTTP2_EXPORT_PRIVATE std::string Http2FrameTypeToString(uint8_t v); HTTP2_EXPORT_PRIVATE inline std::ostream& operator<<(std::ostream& out, Http2FrameType v) { return out << Http2FrameTypeToString(v); @@ -75,9 +75,9 @@ // Formats zero or more flags for the specified type of frame. Returns an // empty string if flags==0. -HTTP2_EXPORT_PRIVATE Http2String Http2FrameFlagsToString(Http2FrameType type, +HTTP2_EXPORT_PRIVATE std::string Http2FrameFlagsToString(Http2FrameType type, uint8_t flags); -HTTP2_EXPORT_PRIVATE Http2String Http2FrameFlagsToString(uint8_t type, +HTTP2_EXPORT_PRIVATE std::string Http2FrameFlagsToString(uint8_t type, uint8_t flags); // Error codes for GOAWAY and RST_STREAM frames. @@ -142,8 +142,8 @@ } // Format the specified error code. -HTTP2_EXPORT_PRIVATE Http2String Http2ErrorCodeToString(uint32_t v); -HTTP2_EXPORT_PRIVATE Http2String Http2ErrorCodeToString(Http2ErrorCode v); +HTTP2_EXPORT_PRIVATE std::string Http2ErrorCodeToString(uint32_t v); +HTTP2_EXPORT_PRIVATE std::string Http2ErrorCodeToString(Http2ErrorCode v); HTTP2_EXPORT_PRIVATE inline std::ostream& operator<<(std::ostream& out, Http2ErrorCode v) { return out << Http2ErrorCodeToString(v); @@ -222,9 +222,9 @@ } // Format the specified settings parameter. -HTTP2_EXPORT_PRIVATE Http2String Http2SettingsParameterToString(uint32_t v); -HTTP2_EXPORT_PRIVATE Http2String -Http2SettingsParameterToString(Http2SettingsParameter v); +HTTP2_EXPORT_PRIVATE std::string Http2SettingsParameterToString(uint32_t v); +HTTP2_EXPORT_PRIVATE std::string Http2SettingsParameterToString( + Http2SettingsParameter v); inline std::ostream& operator<<(std::ostream& out, Http2SettingsParameter v) { return out << Http2SettingsParameterToString(v); }
diff --git a/http2/http2_structures.cc b/http2/http2_structures.cc index 7dbaf30..7b00db4 100644 --- a/http2/http2_structures.cc +++ b/http2/http2_structures.cc
@@ -19,13 +19,13 @@ flags == '/'); // "/" } -Http2String Http2FrameHeader::ToString() const { +std::string Http2FrameHeader::ToString() const { return Http2StrCat("length=", payload_length, ", type=", Http2FrameTypeToString(type), ", flags=", FlagsToString(), ", stream=", stream_id); } -Http2String Http2FrameHeader::FlagsToString() const { +std::string Http2FrameHeader::FlagsToString() const { return Http2FrameFlagsToString(type, flags); } @@ -44,7 +44,7 @@ return a.stream_dependency == b.stream_dependency && a.weight == b.weight; } -Http2String Http2PriorityFields::ToString() const { +std::string Http2PriorityFields::ToString() const { std::stringstream ss; ss << "E=" << (is_exclusive ? "true" : "false") << ", stream=" << stream_dependency
diff --git a/http2/http2_structures.h b/http2/http2_structures.h index f236cfb..f73e109 100644 --- a/http2/http2_structures.h +++ b/http2/http2_structures.h
@@ -29,11 +29,11 @@ #include <cstdint> #include <ostream> +#include <string> #include "net/third_party/quiche/src/http2/http2_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 { @@ -106,8 +106,8 @@ bool IsProbableHttpResponse() const; // Produce strings useful for debugging/logging messages. - Http2String ToString() const; - Http2String FlagsToString() const; + std::string ToString() const; + std::string FlagsToString() const; // 24 bit length of the payload after the header, including any padding. // First field in encoding. @@ -158,7 +158,7 @@ static constexpr size_t EncodedSize() { return 5; } // Produce strings useful for debugging/logging messages. - Http2String ToString() const; + std::string ToString() const; // A 31-bit stream identifier for the stream that this stream depends on. uint32_t stream_dependency;
diff --git a/http2/http2_structures_test.cc b/http2/http2_structures_test.cc index 9e38248..4903226 100644 --- a/http2/http2_structures_test.cc +++ b/http2/http2_structures_test.cc
@@ -14,6 +14,7 @@ #include <memory> #include <ostream> #include <sstream> +#include <string> #include <tuple> #include <type_traits> #include <vector> @@ -171,7 +172,7 @@ TEST_P(IsEndStreamTest, IsEndStream) { const bool is_set = (flags_ & Http2FrameFlag::END_STREAM) == Http2FrameFlag::END_STREAM; - Http2String flags_string; + std::string flags_string; Http2FrameHeader v(0, type_, flags_, 0); switch (type_) { case Http2FrameType::DATA: @@ -208,7 +209,7 @@ Values(~Http2FrameFlag::ACK, 0xff))); TEST_P(IsACKTest, IsAck) { const bool is_set = (flags_ & Http2FrameFlag::ACK) == Http2FrameFlag::ACK; - Http2String flags_string; + std::string flags_string; Http2FrameHeader v(0, type_, flags_, 0); switch (type_) { case Http2FrameType::SETTINGS: @@ -246,7 +247,7 @@ TEST_P(IsEndHeadersTest, IsEndHeaders) { const bool is_set = (flags_ & Http2FrameFlag::END_HEADERS) == Http2FrameFlag::END_HEADERS; - Http2String flags_string; + std::string flags_string; Http2FrameHeader v(0, type_, flags_, 0); switch (type_) { case Http2FrameType::HEADERS: @@ -287,7 +288,7 @@ TEST_P(IsPaddedTest, IsPadded) { const bool is_set = (flags_ & Http2FrameFlag::PADDED) == Http2FrameFlag::PADDED; - Http2String flags_string; + std::string flags_string; Http2FrameHeader v(0, type_, flags_, 0); switch (type_) { case Http2FrameType::DATA: @@ -326,7 +327,7 @@ TEST_P(HasPriorityTest, HasPriority) { const bool is_set = (flags_ & Http2FrameFlag::PRIORITY) == Http2FrameFlag::PRIORITY; - Http2String flags_string; + std::string flags_string; Http2FrameHeader v(0, type_, flags_, 0); switch (type_) { case Http2FrameType::HEADERS:
diff --git a/http2/http2_structures_test_util.h b/http2/http2_structures_test_util.h index 86fbf3f..77127a1 100644 --- a/http2/http2_structures_test_util.h +++ b/http2/http2_structures_test_util.h
@@ -5,9 +5,10 @@ #ifndef QUICHE_HTTP2_HTTP2_STRUCTURES_TEST_UTIL_H_ #define QUICHE_HTTP2_HTTP2_STRUCTURES_TEST_UTIL_H_ +#include <string> + #include "testing/gtest/include/gtest/gtest.h" #include "net/third_party/quiche/src/http2/http2_structures.h" -#include "net/third_party/quiche/src/http2/platform/api/http2_string.h" #include "net/third_party/quiche/src/http2/test_tools/http2_random.h" #include "net/third_party/quiche/src/http2/tools/http2_frame_builder.h" @@ -15,7 +16,7 @@ namespace test { template <class S> -Http2String SerializeStructure(const S& s) { +std::string SerializeStructure(const S& s) { Http2FrameBuilder fb; fb.Append(s); EXPECT_EQ(S::EncodedSize(), fb.size());
diff --git a/http2/platform/api/http2_string.h b/http2/platform/api/http2_string.h deleted file mode 100644 index 25f9e59..0000000 --- a/http2/platform/api/http2_string.h +++ /dev/null
@@ -1,16 +0,0 @@ -// Copyright (c) 2017 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef QUICHE_HTTP2_PLATFORM_API_HTTP2_STRING_H_ -#define QUICHE_HTTP2_PLATFORM_API_HTTP2_STRING_H_ - -#include "net/http2/platform/impl/http2_string_impl.h" - -namespace http2 { - -using Http2String = Http2StringImpl; - -} // namespace http2 - -#endif // QUICHE_HTTP2_PLATFORM_API_HTTP2_STRING_H_
diff --git a/http2/platform/api/http2_string_utils.h b/http2/platform/api/http2_string_utils.h index ba40560..1db9d66 100644 --- a/http2/platform/api/http2_string_utils.h +++ b/http2/platform/api/http2_string_utils.h
@@ -5,48 +5,48 @@ #ifndef QUICHE_HTTP2_PLATFORM_API_HTTP2_STRING_UTILS_H_ #define QUICHE_HTTP2_PLATFORM_API_HTTP2_STRING_UTILS_H_ +#include <string> #include <type_traits> #include <utility> -#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/http2/platform/impl/http2_string_utils_impl.h" namespace http2 { template <typename... Args> -inline Http2String Http2StrCat(const Args&... args) { +inline std::string Http2StrCat(const Args&... args) { return Http2StrCatImpl(std::forward<const Args&>(args)...); } template <typename... Args> -inline void Http2StrAppend(Http2String* output, const Args&... args) { +inline void Http2StrAppend(std::string* output, const Args&... args) { Http2StrAppendImpl(output, std::forward<const Args&>(args)...); } template <typename... Args> -inline Http2String Http2StringPrintf(const Args&... args) { +inline std::string Http2StringPrintf(const Args&... args) { return Http2StringPrintfImpl(std::forward<const Args&>(args)...); } -inline Http2String Http2HexEncode(const void* bytes, size_t size) { +inline std::string Http2HexEncode(const void* bytes, size_t size) { return Http2HexEncodeImpl(bytes, size); } -inline Http2String Http2HexDecode(Http2StringPiece data) { +inline std::string Http2HexDecode(Http2StringPiece data) { return Http2HexDecodeImpl(data); } -inline Http2String Http2HexDump(Http2StringPiece data) { +inline std::string Http2HexDump(Http2StringPiece data) { return Http2HexDumpImpl(data); } -inline Http2String Http2HexEscape(Http2StringPiece data) { +inline std::string Http2HexEscape(Http2StringPiece data) { return Http2HexEscapeImpl(data); } template <typename Number> -inline Http2String Http2Hex(Number number) { +inline std::string Http2Hex(Number number) { static_assert(std::is_integral<Number>::value, "Number has to be an int"); return Http2HexImpl(number); }
diff --git a/http2/platform/api/http2_string_utils_test.cc b/http2/platform/api/http2_string_utils_test.cc index 254f9d7..6ffc4b4 100644 --- a/http2/platform/api/http2_string_utils_test.cc +++ b/http2/platform/api/http2_string_utils_test.cc
@@ -19,7 +19,7 @@ // Single string-like argument. const char kFoo[] = "foo"; - const Http2String string_foo(kFoo); + const std::string string_foo(kFoo); const Http2StringPiece stringpiece_foo(string_foo); EXPECT_EQ("foo", Http2StrCat(kFoo)); EXPECT_EQ("foo", Http2StrCat(string_foo)); @@ -28,7 +28,7 @@ // Two string-like arguments. const char kBar[] = "bar"; const Http2StringPiece stringpiece_bar(kBar); - const Http2String string_bar(kBar); + const std::string string_bar(kBar); EXPECT_EQ("foobar", Http2StrCat(kFoo, kBar)); EXPECT_EQ("foobar", Http2StrCat(kFoo, string_bar)); EXPECT_EQ("foobar", Http2StrCat(kFoo, stringpiece_bar)); @@ -72,13 +72,13 @@ TEST(Http2StringUtilsTest, Http2StrAppend) { // No arguments on empty string. - Http2String output; + std::string output; Http2StrAppend(&output); EXPECT_TRUE(output.empty()); // Single string-like argument. const char kFoo[] = "foo"; - const Http2String string_foo(kFoo); + const std::string string_foo(kFoo); const Http2StringPiece stringpiece_foo(string_foo); Http2StrAppend(&output, kFoo); EXPECT_EQ("foo", output); @@ -96,7 +96,7 @@ // Two string-like arguments. const char kBar[] = "bar"; const Http2StringPiece stringpiece_bar(kBar); - const Http2String string_bar(kBar); + const std::string string_bar(kBar); Http2StrAppend(&output, kFoo, kBar); EXPECT_EQ("foobar", output); Http2StrAppend(&output, kFoo, string_bar);
diff --git a/http2/test_tools/frame_parts.cc b/http2/test_tools/frame_parts.cc index d550788..d9dffa1 100644 --- a/http2/test_tools/frame_parts.cc +++ b/http2/test_tools/frame_parts.cc
@@ -507,7 +507,7 @@ } AssertionResult FrameParts::AppendString(Http2StringPiece source, - Http2String* target, + std::string* target, Http2Optional<size_t>* opt_length) { target->append(source.data(), source.size()); if (opt_length != nullptr) {
diff --git a/http2/test_tools/frame_parts.h b/http2/test_tools/frame_parts.h index 5a7d872..598a687 100644 --- a/http2/test_tools/frame_parts.h +++ b/http2/test_tools/frame_parts.h
@@ -13,6 +13,7 @@ #include <stddef.h> #include <cstdint> +#include <string> #include <vector> #include "testing/gtest/include/gtest/gtest.h" @@ -21,7 +22,6 @@ #include "net/third_party/quiche/src/http2/http2_structures.h" #include "net/third_party/quiche/src/http2/platform/api/http2_logging.h" #include "net/third_party/quiche/src/http2/platform/api/http2_optional.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 { @@ -208,15 +208,15 @@ // the optional has a value (i.e. that the necessary On*Start method has been // called), and that target is not longer than opt_length->value(). ::testing::AssertionResult AppendString(Http2StringPiece source, - Http2String* target, + std::string* target, Http2Optional<size_t>* opt_length); const Http2FrameHeader frame_header_; - Http2String payload_; - Http2String padding_; - Http2String altsvc_origin_; - Http2String altsvc_value_; + std::string payload_; + std::string padding_; + std::string altsvc_origin_; + std::string altsvc_value_; Http2Optional<Http2PriorityFields> opt_priority_; Http2Optional<Http2ErrorCode> opt_rst_stream_error_code_;
diff --git a/http2/test_tools/http2_random.cc b/http2/test_tools/http2_random.cc index 81c0366..6b61a58 100644 --- a/http2/test_tools/http2_random.cc +++ b/http2/test_tools/http2_random.cc
@@ -17,12 +17,12 @@ } Http2Random::Http2Random(Http2StringPiece key) { - Http2String decoded_key = Http2HexDecode(key); + std::string decoded_key = Http2HexDecode(key); CHECK_EQ(sizeof(key_), decoded_key.size()); memcpy(key_, decoded_key.data(), sizeof(key_)); } -Http2String Http2Random::Key() const { +std::string Http2Random::Key() const { return Http2HexEncode(key_, sizeof(key_)); } @@ -33,8 +33,8 @@ counter_++); } -Http2String Http2Random::RandString(int length) { - Http2String result; +std::string Http2Random::RandString(int length) { + std::string result; result.resize(length); FillRandom(&result[0], length); return result; @@ -58,9 +58,9 @@ return value.f - 1.0; } -Http2String Http2Random::RandStringWithAlphabet(int length, +std::string Http2Random::RandStringWithAlphabet(int length, Http2StringPiece alphabet) { - Http2String result; + std::string result; result.resize(length); for (int i = 0; i < length; i++) { result[i] = alphabet[Uniform(alphabet.size())];
diff --git a/http2/test_tools/http2_random.h b/http2/test_tools/http2_random.h index def60f8..774212c 100644 --- a/http2/test_tools/http2_random.h +++ b/http2/test_tools/http2_random.h
@@ -9,8 +9,8 @@ #include <cstdint> #include <limits> #include <random> +#include <string> -#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,10 +29,10 @@ // Reproducible random number generation: by using the same key, the same // sequence of results is obtained. explicit Http2Random(Http2StringPiece key); - Http2String Key() const; + std::string Key() const; void FillRandom(void* buffer, size_t buffer_size); - Http2String RandString(int length); + std::string RandString(int length); // Returns a random 64-bit value. uint64_t Rand64(); @@ -67,7 +67,7 @@ // Return a random string consisting of the characters from the specified // alphabet. - Http2String RandStringWithAlphabet(int length, Http2StringPiece alphabet); + std::string RandStringWithAlphabet(int length, Http2StringPiece alphabet); // STL UniformRandomNumberGenerator implementation. using result_type = uint64_t;
diff --git a/http2/test_tools/http2_random_test.cc b/http2/test_tools/http2_random_test.cc index a1b74f6..c9490bd 100644 --- a/http2/test_tools/http2_random_test.cc +++ b/http2/test_tools/http2_random_test.cc
@@ -43,9 +43,9 @@ TEST(Http2RandomTest, STLShuffle) { Http2Random random; - const Http2String original = "abcdefghijklmonpqrsuvwxyz"; + const std::string original = "abcdefghijklmonpqrsuvwxyz"; - Http2String shuffled = original; + std::string shuffled = original; std::shuffle(shuffled.begin(), shuffled.end(), random); EXPECT_NE(original, shuffled); } @@ -61,7 +61,7 @@ TEST(Http2RandomTest, RandStringWithAlphabet) { Http2Random random; - Http2String str = random.RandStringWithAlphabet(1000, "xyz"); + std::string str = random.RandStringWithAlphabet(1000, "xyz"); EXPECT_EQ(1000u, str.size()); std::set<char> characters(str.begin(), str.end());
diff --git a/http2/tools/http2_frame_builder.h b/http2/tools/http2_frame_builder.h index c36cb56..70d5f44 100644 --- a/http2/tools/http2_frame_builder.h +++ b/http2/tools/http2_frame_builder.h
@@ -16,10 +16,10 @@ #include <stddef.h> // for size_t #include <cstdint> +#include <string> #include "net/third_party/quiche/src/http2/http2_constants.h" #include "net/third_party/quiche/src/http2/http2_structures.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 @@ ~Http2FrameBuilder() {} size_t size() const { return buffer_.size(); } - const Http2String& buffer() const { return buffer_; } + const std::string& buffer() const { return buffer_; } //---------------------------------------------------------------------------- // Methods for appending to the end of the buffer. @@ -92,7 +92,7 @@ size_t SetPayloadLength(); private: - Http2String buffer_; + std::string buffer_; }; } // namespace test
diff --git a/http2/tools/random_decoder_test.h b/http2/tools/random_decoder_test.h index f162ad7..ef31d01 100644 --- a/http2/tools/random_decoder_test.h +++ b/http2/tools/random_decoder_test.h
@@ -21,7 +21,6 @@ #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_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_piece.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"
diff --git a/http2/tools/random_util.cc b/http2/tools/random_util.cc index 82c3edd..a7d95c4 100644 --- a/http2/tools/random_util.cc +++ b/http2/tools/random_util.cc
@@ -11,7 +11,7 @@ // Here "word" means something that starts with a lower-case letter, and has // zero or more additional characters that are numbers or lower-case letters. -Http2String GenerateHttp2HeaderName(size_t len, Http2Random* rng) { +std::string GenerateHttp2HeaderName(size_t len, Http2Random* rng) { Http2StringPiece alpha_lc = "abcdefghijklmnopqrstuvwxyz"; // If the name is short, just make it one word. if (len < 8) { @@ -25,13 +25,13 @@ rng->RandStringWithAlphabet(len - 4, alphanumdash_lc); } -Http2String GenerateWebSafeString(size_t len, Http2Random* rng) { +std::string GenerateWebSafeString(size_t len, Http2Random* rng) { static const char* kWebsafe64 = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ-_"; return rng->RandStringWithAlphabet(len, kWebsafe64); } -Http2String GenerateWebSafeString(size_t lo, size_t hi, Http2Random* rng) { +std::string GenerateWebSafeString(size_t lo, size_t hi, Http2Random* rng) { return GenerateWebSafeString(rng->UniformInRange(lo, hi), rng); }
diff --git a/http2/tools/random_util.h b/http2/tools/random_util.h index a2107b7..6e72189 100644 --- a/http2/tools/random_util.h +++ b/http2/tools/random_util.h
@@ -7,7 +7,8 @@ #include <stddef.h> -#include "net/third_party/quiche/src/http2/platform/api/http2_string.h" +#include <string> + #include "net/third_party/quiche/src/http2/test_tools/http2_random.h" namespace http2 { @@ -15,13 +16,13 @@ // Generate a string with the allowed character set for HTTP/2 / HPACK header // names. -Http2String GenerateHttp2HeaderName(size_t len, Http2Random* rng); +std::string GenerateHttp2HeaderName(size_t len, Http2Random* rng); // Generate a string with the web-safe string character set of specified len. -Http2String GenerateWebSafeString(size_t len, Http2Random* rng); +std::string GenerateWebSafeString(size_t len, Http2Random* rng); // Generate a string with the web-safe string character set of length [lo, hi). -Http2String GenerateWebSafeString(size_t lo, size_t hi, Http2Random* rng); +std::string GenerateWebSafeString(size_t lo, size_t hi, Http2Random* rng); } // namespace test } // namespace http2