Replace QuicString with std::string, pass 1 This replaces QuicString with std::string in all of the "QUIC proper". I will delete QuicString once all code using it is gone. gfe-relnote: n/a (no functional change) PiperOrigin-RevId: 237872023 Change-Id: I82de62c9855516b15039734d05155917e68ff4ee
diff --git a/quic/core/chlo_extractor_test.cc b/quic/core/chlo_extractor_test.cc index 1e0b6f5..cb5fd59 100644 --- a/quic/core/chlo_extractor_test.cc +++ b/quic/core/chlo_extractor_test.cc
@@ -35,12 +35,12 @@ QuicConnectionId connection_id() const { return connection_id_; } QuicTransportVersion transport_version() const { return version_; } - const QuicString& chlo() const { return chlo_; } + const std::string& chlo() const { return chlo_; } private: QuicConnectionId connection_id_; QuicTransportVersion version_; - QuicString chlo_; + std::string chlo_; }; class ChloExtractorTest : public QuicTest { @@ -105,7 +105,7 @@ CryptoHandshakeMessage client_hello; client_hello.set_tag(kCHLO); - QuicString client_hello_str(client_hello.GetSerialized().AsStringPiece()); + std::string client_hello_str(client_hello.GetSerialized().AsStringPiece()); // Construct a CHLO with each supported version for (ParsedQuicVersion version : AllSupportedVersions()) { SCOPED_TRACE(version); @@ -135,7 +135,7 @@ CryptoHandshakeMessage client_hello; client_hello.set_tag(kCHLO); - QuicString client_hello_str(client_hello.GetSerialized().AsStringPiece()); + std::string client_hello_str(client_hello.GetSerialized().AsStringPiece()); MakePacket(AllSupportedVersions()[0], client_hello_str, /*munge_offset*/ false, /*munge_stream_id*/ true); EXPECT_FALSE(ChloExtractor::Extract(*packet_, AllSupportedVersions(), {}, @@ -147,7 +147,7 @@ CryptoHandshakeMessage client_hello; client_hello.set_tag(kCHLO); - QuicString client_hello_str(client_hello.GetSerialized().AsStringPiece()); + std::string client_hello_str(client_hello.GetSerialized().AsStringPiece()); MakePacket(AllSupportedVersions()[0], client_hello_str, /*munge_offset*/ true, /*munge_stream_id*/ false); EXPECT_FALSE(ChloExtractor::Extract(*packet_, AllSupportedVersions(), {},
diff --git a/quic/core/congestion_control/bbr_sender.cc b/quic/core/congestion_control/bbr_sender.cc index 6a7fe2b..c119135 100644 --- a/quic/core/congestion_control/bbr_sender.cc +++ b/quic/core/congestion_control/bbr_sender.cc
@@ -851,7 +851,7 @@ recovery_window_ = std::max(min_congestion_window_, recovery_window_); } -QuicString BbrSender::GetDebugState() const { +std::string BbrSender::GetDebugState() const { std::ostringstream stream; stream << ExportDebugState(); return stream.str(); @@ -875,7 +875,7 @@ return DebugState(*this); } -static QuicString ModeToString(BbrSender::Mode mode) { +static std::string ModeToString(BbrSender::Mode mode) { switch (mode) { case BbrSender::STARTUP: return "STARTUP";
diff --git a/quic/core/congestion_control/bbr_sender.h b/quic/core/congestion_control/bbr_sender.h index 37e2695..efde0e5 100644 --- a/quic/core/congestion_control/bbr_sender.h +++ b/quic/core/congestion_control/bbr_sender.h
@@ -129,7 +129,7 @@ QuicByteCount GetCongestionWindow() const override; QuicByteCount GetSlowStartThreshold() const override; CongestionControlType GetCongestionControlType() const override; - QuicString GetDebugState() const override; + std::string GetDebugState() const override; void OnApplicationLimited(QuicByteCount bytes_in_flight) override; // End implementation of SendAlgorithmInterface.
diff --git a/quic/core/congestion_control/send_algorithm_interface.h b/quic/core/congestion_control/send_algorithm_interface.h index 5df9a93..333a085 100644 --- a/quic/core/congestion_control/send_algorithm_interface.h +++ b/quic/core/congestion_control/send_algorithm_interface.h
@@ -124,7 +124,7 @@ // Retrieves debugging information about the current state of the // send algorithm. - virtual QuicString GetDebugState() const = 0; + virtual std::string GetDebugState() const = 0; // Called when the connection has no outstanding data to send. Specifically, // this means that none of the data streams are write-blocked, there are no
diff --git a/quic/core/congestion_control/send_algorithm_test.cc b/quic/core/congestion_control/send_algorithm_test.cc index d7bfd85..3b93696 100644 --- a/quic/core/congestion_control/send_algorithm_test.cc +++ b/quic/core/congestion_control/send_algorithm_test.cc
@@ -132,7 +132,8 @@ const CongestionControlType congestion_control_type; }; -QuicString TestParamToString(const testing::TestParamInfo<TestParams>& params) { +std::string TestParamToString( + const testing::TestParamInfo<TestParams>& params) { return QuicStrCat( CongestionControlTypeToString(params.param.congestion_control_type), "_"); } @@ -268,7 +269,8 @@ SendAlgorithmInterface* sender_; }; -INSTANTIATE_TEST_SUITE_P(SendAlgorithmTests, SendAlgorithmTest, +INSTANTIATE_TEST_SUITE_P(SendAlgorithmTests, + SendAlgorithmTest, ::testing::ValuesIn(GetTestParams()), TestParamToString);
diff --git a/quic/core/congestion_control/tcp_cubic_sender_bytes.cc b/quic/core/congestion_control/tcp_cubic_sender_bytes.cc index 5b843eb..4eefb46 100644 --- a/quic/core/congestion_control/tcp_cubic_sender_bytes.cc +++ b/quic/core/congestion_control/tcp_cubic_sender_bytes.cc
@@ -260,7 +260,7 @@ HandleRetransmissionTimeout(); } -QuicString TcpCubicSenderBytes::GetDebugState() const { +std::string TcpCubicSenderBytes::GetDebugState() const { return ""; }
diff --git a/quic/core/congestion_control/tcp_cubic_sender_bytes.h b/quic/core/congestion_control/tcp_cubic_sender_bytes.h index 0ecb6f4..080a92d 100644 --- a/quic/core/congestion_control/tcp_cubic_sender_bytes.h +++ b/quic/core/congestion_control/tcp_cubic_sender_bytes.h
@@ -73,7 +73,7 @@ bool InSlowStart() const override; bool InRecovery() const override; bool ShouldSendProbingPacket() const override; - QuicString GetDebugState() const override; + std::string GetDebugState() const override; void OnApplicationLimited(QuicByteCount bytes_in_flight) override; // End implementation of SendAlgorithmInterface.
diff --git a/quic/core/crypto/aead_base_decrypter.cc b/quic/core/crypto/aead_base_decrypter.cc index 53bd0f0..474c443 100644 --- a/quic/core/crypto/aead_base_decrypter.cc +++ b/quic/core/crypto/aead_base_decrypter.cc
@@ -125,7 +125,7 @@ return true; } - QuicString key, nonce_prefix; + std::string key, nonce_prefix; size_t prefix_size = nonce_size_ - sizeof(QuicPacketNumber); DiversifyPreliminaryKey( QuicStringPiece(reinterpret_cast<const char*>(key_), key_size_),
diff --git a/quic/core/crypto/aes_128_gcm_12_decrypter_test.cc b/quic/core/crypto/aes_128_gcm_12_decrypter_test.cc index 6513e45..d9b2e8d 100644 --- a/quic/core/crypto/aes_128_gcm_12_decrypter_test.cc +++ b/quic/core/crypto/aes_128_gcm_12_decrypter_test.cc
@@ -232,12 +232,12 @@ bool has_pt = test_vectors[j].pt; // Decode the test vector. - QuicString key = QuicTextUtils::HexDecode(test_vectors[j].key); - QuicString iv = QuicTextUtils::HexDecode(test_vectors[j].iv); - QuicString ct = QuicTextUtils::HexDecode(test_vectors[j].ct); - QuicString aad = QuicTextUtils::HexDecode(test_vectors[j].aad); - QuicString tag = QuicTextUtils::HexDecode(test_vectors[j].tag); - QuicString pt; + std::string key = QuicTextUtils::HexDecode(test_vectors[j].key); + std::string iv = QuicTextUtils::HexDecode(test_vectors[j].iv); + std::string ct = QuicTextUtils::HexDecode(test_vectors[j].ct); + std::string aad = QuicTextUtils::HexDecode(test_vectors[j].aad); + std::string tag = QuicTextUtils::HexDecode(test_vectors[j].tag); + std::string pt; if (has_pt) { pt = QuicTextUtils::HexDecode(test_vectors[j].pt); } @@ -258,7 +258,7 @@ ASSERT_LE(static_cast<size_t>(Aes128Gcm12Decrypter::kAuthTagSize), tag.length()); tag.resize(Aes128Gcm12Decrypter::kAuthTagSize); - QuicString ciphertext = ct + tag; + std::string ciphertext = ct + tag; Aes128Gcm12Decrypter decrypter; ASSERT_TRUE(decrypter.SetKey(key));
diff --git a/quic/core/crypto/aes_128_gcm_12_encrypter_test.cc b/quic/core/crypto/aes_128_gcm_12_encrypter_test.cc index 67660cf..7aa1cf9 100644 --- a/quic/core/crypto/aes_128_gcm_12_encrypter_test.cc +++ b/quic/core/crypto/aes_128_gcm_12_encrypter_test.cc
@@ -181,12 +181,12 @@ const TestGroupInfo& test_info = test_group_info[i]; for (size_t j = 0; test_vectors[j].key != nullptr; j++) { // Decode the test vector. - QuicString key = QuicTextUtils::HexDecode(test_vectors[j].key); - QuicString iv = QuicTextUtils::HexDecode(test_vectors[j].iv); - QuicString pt = QuicTextUtils::HexDecode(test_vectors[j].pt); - QuicString aad = QuicTextUtils::HexDecode(test_vectors[j].aad); - QuicString ct = QuicTextUtils::HexDecode(test_vectors[j].ct); - QuicString tag = QuicTextUtils::HexDecode(test_vectors[j].tag); + std::string key = QuicTextUtils::HexDecode(test_vectors[j].key); + std::string iv = QuicTextUtils::HexDecode(test_vectors[j].iv); + std::string pt = QuicTextUtils::HexDecode(test_vectors[j].pt); + std::string aad = QuicTextUtils::HexDecode(test_vectors[j].aad); + std::string ct = QuicTextUtils::HexDecode(test_vectors[j].ct); + std::string tag = QuicTextUtils::HexDecode(test_vectors[j].tag); // The test vector's lengths should look sane. Note that the lengths // in |test_info| are in bits.
diff --git a/quic/core/crypto/aes_128_gcm_decrypter_test.cc b/quic/core/crypto/aes_128_gcm_decrypter_test.cc index 300e8a2..1ef986f 100644 --- a/quic/core/crypto/aes_128_gcm_decrypter_test.cc +++ b/quic/core/crypto/aes_128_gcm_decrypter_test.cc
@@ -227,12 +227,12 @@ bool has_pt = test_vectors[j].pt; // Decode the test vector. - QuicString key = QuicTextUtils::HexDecode(test_vectors[j].key); - QuicString iv = QuicTextUtils::HexDecode(test_vectors[j].iv); - QuicString ct = QuicTextUtils::HexDecode(test_vectors[j].ct); - QuicString aad = QuicTextUtils::HexDecode(test_vectors[j].aad); - QuicString tag = QuicTextUtils::HexDecode(test_vectors[j].tag); - QuicString pt; + std::string key = QuicTextUtils::HexDecode(test_vectors[j].key); + std::string iv = QuicTextUtils::HexDecode(test_vectors[j].iv); + std::string ct = QuicTextUtils::HexDecode(test_vectors[j].ct); + std::string aad = QuicTextUtils::HexDecode(test_vectors[j].aad); + std::string tag = QuicTextUtils::HexDecode(test_vectors[j].tag); + std::string pt; if (has_pt) { pt = QuicTextUtils::HexDecode(test_vectors[j].pt); } @@ -247,7 +247,7 @@ if (has_pt) { EXPECT_EQ(test_info.pt_len, pt.length() * 8); } - QuicString ciphertext = ct + tag; + std::string ciphertext = ct + tag; Aes128GcmDecrypter decrypter; ASSERT_TRUE(decrypter.SetKey(key));
diff --git a/quic/core/crypto/aes_128_gcm_encrypter_test.cc b/quic/core/crypto/aes_128_gcm_encrypter_test.cc index 959cb9d..e2e425e 100644 --- a/quic/core/crypto/aes_128_gcm_encrypter_test.cc +++ b/quic/core/crypto/aes_128_gcm_encrypter_test.cc
@@ -181,12 +181,12 @@ const TestGroupInfo& test_info = test_group_info[i]; for (size_t j = 0; test_vectors[j].key != nullptr; j++) { // Decode the test vector. - QuicString key = QuicTextUtils::HexDecode(test_vectors[j].key); - QuicString iv = QuicTextUtils::HexDecode(test_vectors[j].iv); - QuicString pt = QuicTextUtils::HexDecode(test_vectors[j].pt); - QuicString aad = QuicTextUtils::HexDecode(test_vectors[j].aad); - QuicString ct = QuicTextUtils::HexDecode(test_vectors[j].ct); - QuicString tag = QuicTextUtils::HexDecode(test_vectors[j].tag); + std::string key = QuicTextUtils::HexDecode(test_vectors[j].key); + std::string iv = QuicTextUtils::HexDecode(test_vectors[j].iv); + std::string pt = QuicTextUtils::HexDecode(test_vectors[j].pt); + std::string aad = QuicTextUtils::HexDecode(test_vectors[j].aad); + std::string ct = QuicTextUtils::HexDecode(test_vectors[j].ct); + std::string tag = QuicTextUtils::HexDecode(test_vectors[j].tag); // The test vector's lengths should look sane. Note that the lengths // in |test_info| are in bits. @@ -218,13 +218,14 @@ } TEST_F(Aes128GcmEncrypterTest, EncryptPacket) { - QuicString key = QuicTextUtils::HexDecode("d95a145250826c25a77b6a84fd4d34fc"); - QuicString iv = QuicTextUtils::HexDecode("50c4431ebb18283448e276e2"); + std::string key = + QuicTextUtils::HexDecode("d95a145250826c25a77b6a84fd4d34fc"); + std::string iv = QuicTextUtils::HexDecode("50c4431ebb18283448e276e2"); uint64_t packet_num = 0x13278f44; - QuicString aad = + std::string aad = QuicTextUtils::HexDecode("875d49f64a70c9cbe713278f44ff000005"); - QuicString pt = QuicTextUtils::HexDecode("aa0003a250bd000000000001"); - QuicString ct = QuicTextUtils::HexDecode( + std::string pt = QuicTextUtils::HexDecode("aa0003a250bd000000000001"); + std::string ct = QuicTextUtils::HexDecode( "7dd4708b989ee7d38a013e3656e9b37beefd05808fe1ab41e3b4f2c0"); std::vector<char> out(ct.size());
diff --git a/quic/core/crypto/aes_256_gcm_decrypter_test.cc b/quic/core/crypto/aes_256_gcm_decrypter_test.cc index cb5f702..16e2428 100644 --- a/quic/core/crypto/aes_256_gcm_decrypter_test.cc +++ b/quic/core/crypto/aes_256_gcm_decrypter_test.cc
@@ -231,12 +231,12 @@ bool has_pt = test_vectors[j].pt; // Decode the test vector. - QuicString key = QuicTextUtils::HexDecode(test_vectors[j].key); - QuicString iv = QuicTextUtils::HexDecode(test_vectors[j].iv); - QuicString ct = QuicTextUtils::HexDecode(test_vectors[j].ct); - QuicString aad = QuicTextUtils::HexDecode(test_vectors[j].aad); - QuicString tag = QuicTextUtils::HexDecode(test_vectors[j].tag); - QuicString pt; + std::string key = QuicTextUtils::HexDecode(test_vectors[j].key); + std::string iv = QuicTextUtils::HexDecode(test_vectors[j].iv); + std::string ct = QuicTextUtils::HexDecode(test_vectors[j].ct); + std::string aad = QuicTextUtils::HexDecode(test_vectors[j].aad); + std::string tag = QuicTextUtils::HexDecode(test_vectors[j].tag); + std::string pt; if (has_pt) { pt = QuicTextUtils::HexDecode(test_vectors[j].pt); } @@ -251,7 +251,7 @@ if (has_pt) { EXPECT_EQ(test_info.pt_len, pt.length() * 8); } - QuicString ciphertext = ct + tag; + std::string ciphertext = ct + tag; Aes256GcmDecrypter decrypter; ASSERT_TRUE(decrypter.SetKey(key));
diff --git a/quic/core/crypto/aes_256_gcm_encrypter_test.cc b/quic/core/crypto/aes_256_gcm_encrypter_test.cc index 0472986..f70edbc 100644 --- a/quic/core/crypto/aes_256_gcm_encrypter_test.cc +++ b/quic/core/crypto/aes_256_gcm_encrypter_test.cc
@@ -188,12 +188,12 @@ const TestGroupInfo& test_info = test_group_info[i]; for (size_t j = 0; test_vectors[j].key != nullptr; j++) { // Decode the test vector. - QuicString key = QuicTextUtils::HexDecode(test_vectors[j].key); - QuicString iv = QuicTextUtils::HexDecode(test_vectors[j].iv); - QuicString pt = QuicTextUtils::HexDecode(test_vectors[j].pt); - QuicString aad = QuicTextUtils::HexDecode(test_vectors[j].aad); - QuicString ct = QuicTextUtils::HexDecode(test_vectors[j].ct); - QuicString tag = QuicTextUtils::HexDecode(test_vectors[j].tag); + std::string key = QuicTextUtils::HexDecode(test_vectors[j].key); + std::string iv = QuicTextUtils::HexDecode(test_vectors[j].iv); + std::string pt = QuicTextUtils::HexDecode(test_vectors[j].pt); + std::string aad = QuicTextUtils::HexDecode(test_vectors[j].aad); + std::string ct = QuicTextUtils::HexDecode(test_vectors[j].ct); + std::string tag = QuicTextUtils::HexDecode(test_vectors[j].tag); // The test vector's lengths should look sane. Note that the lengths // in |test_info| are in bits.
diff --git a/quic/core/crypto/cert_compressor.cc b/quic/core/crypto/cert_compressor.cc index 204539b..53c6117 100644 --- a/quic/core/crypto/cert_compressor.cc +++ b/quic/core/crypto/cert_compressor.cc
@@ -174,7 +174,7 @@ // efficiently represent |certs| to a peer who has the common sets identified // by |client_common_set_hashes| and who has cached the certificates with the // 64-bit, FNV-1a hashes in |client_cached_cert_hashes|. -std::vector<CertEntry> MatchCerts(const std::vector<QuicString>& certs, +std::vector<CertEntry> MatchCerts(const std::vector<std::string>& certs, QuicStringPiece client_common_set_hashes, QuicStringPiece client_cached_cert_hashes, const CommonCertSets* common_sets) { @@ -281,9 +281,9 @@ // dictionary to use in order to decompress a zlib block following |entries|. // |certs| is one-to-one with |entries| and contains the certificates for those // entries that are CACHED or COMMON. -QuicString ZlibDictForEntries(const std::vector<CertEntry>& entries, - const std::vector<QuicString>& certs) { - QuicString zlib_dict; +std::string ZlibDictForEntries(const std::vector<CertEntry>& entries, + const std::vector<std::string>& certs) { + std::string zlib_dict; // The dictionary starts with the common and cached certs in reverse order. size_t zlib_dict_size = 0; @@ -304,8 +304,8 @@ } } - zlib_dict += QuicString(reinterpret_cast<const char*>(kCommonCertSubstrings), - sizeof(kCommonCertSubstrings)); + zlib_dict += std::string(reinterpret_cast<const char*>(kCommonCertSubstrings), + sizeof(kCommonCertSubstrings)); DCHECK_EQ(zlib_dict.size(), zlib_dict_size); @@ -313,7 +313,7 @@ } // HashCerts returns the FNV-1a hashes of |certs|. -std::vector<uint64_t> HashCerts(const std::vector<QuicString>& certs) { +std::vector<uint64_t> HashCerts(const std::vector<std::string>& certs) { std::vector<uint64_t> ret; ret.reserve(certs.size()); @@ -329,10 +329,10 @@ // resolved using |cached_certs| and |common_sets| and written to |out_certs|. // |in_out| is updated to contain the trailing data. bool ParseEntries(QuicStringPiece* in_out, - const std::vector<QuicString>& cached_certs, + const std::vector<std::string>& cached_certs, const CommonCertSets* common_sets, std::vector<CertEntry>* out_entries, - std::vector<QuicString>* out_certs) { + std::vector<std::string>* out_certs) { QuicStringPiece in = *in_out; std::vector<uint64_t> cached_hashes; @@ -355,7 +355,7 @@ switch (entry.type) { case CertEntry::COMPRESSED: - out_certs->push_back(QuicString()); + out_certs->push_back(std::string()); break; case CertEntry::CACHED: { if (in.size() < sizeof(uint64_t)) { @@ -397,7 +397,7 @@ if (cert.empty()) { return false; } - out_certs->push_back(QuicString(cert)); + out_certs->push_back(std::string(cert)); break; } default: @@ -448,8 +448,8 @@ } // anonymous namespace // static -QuicString CertCompressor::CompressChain( - const std::vector<QuicString>& certs, +std::string CertCompressor::CompressChain( + const std::vector<std::string>& certs, QuicStringPiece client_common_set_hashes, QuicStringPiece client_cached_cert_hashes, const CommonCertSets* common_sets) { @@ -477,7 +477,7 @@ } scoped_z.reset(&z); - QuicString zlib_dict = ZlibDictForEntries(entries, certs); + std::string zlib_dict = ZlibDictForEntries(entries, certs); rv = deflateSetDictionary( &z, reinterpret_cast<const uint8_t*>(&zlib_dict[0]), zlib_dict.size()); @@ -491,7 +491,7 @@ const size_t entries_size = CertEntriesSize(entries); - QuicString result; + std::string result; result.resize(entries_size + (uncompressed_size > 0 ? 4 : 0) + compressed_size); @@ -552,9 +552,9 @@ // static bool CertCompressor::DecompressChain( QuicStringPiece in, - const std::vector<QuicString>& cached_certs, + const std::vector<std::string>& cached_certs, const CommonCertSets* common_sets, - std::vector<QuicString>* out_certs) { + std::vector<std::string>* out_certs) { std::vector<CertEntry> entries; if (!ParseEntries(&in, cached_certs, common_sets, &entries, out_certs)) { return false; @@ -595,7 +595,7 @@ int rv = inflate(&z, Z_FINISH); if (rv == Z_NEED_DICT) { - QuicString zlib_dict = ZlibDictForEntries(entries, *out_certs); + std::string zlib_dict = ZlibDictForEntries(entries, *out_certs); const uint8_t* dict = reinterpret_cast<const uint8_t*>(zlib_dict.data()); if (Z_OK != inflateSetDictionary(&z, dict, zlib_dict.size())) { return false; @@ -623,7 +623,7 @@ if (uncompressed.size() < cert_len) { return false; } - (*out_certs)[i] = QuicString(uncompressed.substr(0, cert_len)); + (*out_certs)[i] = std::string(uncompressed.substr(0, cert_len)); uncompressed.remove_prefix(cert_len); break; case CertEntry::CACHED:
diff --git a/quic/core/crypto/cert_compressor.h b/quic/core/crypto/cert_compressor.h index 624ac71..fd73e6e 100644 --- a/quic/core/crypto/cert_compressor.h +++ b/quic/core/crypto/cert_compressor.h
@@ -37,19 +37,19 @@ // sets known locally and |client_common_set_hashes| contains the hashes of // the common sets known to the peer. |client_cached_cert_hashes| contains // 64-bit, FNV-1a hashes of certificates that the peer already possesses. - static QuicString CompressChain(const std::vector<QuicString>& certs, - QuicStringPiece client_common_set_hashes, - QuicStringPiece client_cached_cert_hashes, - const CommonCertSets* common_sets); + static std::string CompressChain(const std::vector<std::string>& certs, + QuicStringPiece client_common_set_hashes, + QuicStringPiece client_cached_cert_hashes, + const CommonCertSets* common_sets); // DecompressChain decompresses the result of |CompressChain|, given in |in|, // into a series of certificates that are written to |out_certs|. // |cached_certs| contains certificates that the peer may have omitted and // |common_sets| contains the common certificate sets known locally. static bool DecompressChain(QuicStringPiece in, - const std::vector<QuicString>& cached_certs, + const std::vector<std::string>& cached_certs, const CommonCertSets* common_sets, - std::vector<QuicString>* out_certs); + std::vector<std::string>* out_certs); }; } // namespace quic
diff --git a/quic/core/crypto/cert_compressor_test.cc b/quic/core/crypto/cert_compressor_test.cc index 87b330a..e3ac2f1 100644 --- a/quic/core/crypto/cert_compressor_test.cc +++ b/quic/core/crypto/cert_compressor_test.cc
@@ -18,26 +18,26 @@ class CertCompressorTest : public QuicTest {}; TEST_F(CertCompressorTest, EmptyChain) { - std::vector<QuicString> chain; - const QuicString compressed = CertCompressor::CompressChain( + std::vector<std::string> chain; + const std::string compressed = CertCompressor::CompressChain( chain, QuicStringPiece(), QuicStringPiece(), nullptr); EXPECT_EQ("00", QuicTextUtils::HexEncode(compressed)); - std::vector<QuicString> chain2, cached_certs; + std::vector<std::string> chain2, cached_certs; ASSERT_TRUE(CertCompressor::DecompressChain(compressed, cached_certs, nullptr, &chain2)); EXPECT_EQ(chain.size(), chain2.size()); } TEST_F(CertCompressorTest, Compressed) { - std::vector<QuicString> chain; + std::vector<std::string> chain; chain.push_back("testcert"); - const QuicString compressed = CertCompressor::CompressChain( + const std::string compressed = CertCompressor::CompressChain( chain, QuicStringPiece(), QuicStringPiece(), nullptr); ASSERT_GE(compressed.size(), 2u); EXPECT_EQ("0100", QuicTextUtils::HexEncode(compressed.substr(0, 2))); - std::vector<QuicString> chain2, cached_certs; + std::vector<std::string> chain2, cached_certs; ASSERT_TRUE(CertCompressor::DecompressChain(compressed, cached_certs, nullptr, &chain2)); EXPECT_EQ(chain.size(), chain2.size()); @@ -45,12 +45,12 @@ } TEST_F(CertCompressorTest, Common) { - std::vector<QuicString> chain; + std::vector<std::string> chain; chain.push_back("testcert"); static const uint64_t set_hash = 42; std::unique_ptr<CommonCertSets> common_sets( crypto_test_utils::MockCommonCertSets(chain[0], set_hash, 1)); - const QuicString compressed = CertCompressor::CompressChain( + const std::string compressed = CertCompressor::CompressChain( chain, QuicStringPiece(reinterpret_cast<const char*>(&set_hash), sizeof(set_hash)), @@ -62,7 +62,7 @@ "00" /* end of list */, QuicTextUtils::HexEncode(compressed)); - std::vector<QuicString> chain2, cached_certs; + std::vector<std::string> chain2, cached_certs; ASSERT_TRUE(CertCompressor::DecompressChain(compressed, cached_certs, common_sets.get(), &chain2)); EXPECT_EQ(chain.size(), chain2.size()); @@ -70,18 +70,18 @@ } TEST_F(CertCompressorTest, Cached) { - std::vector<QuicString> chain; + std::vector<std::string> chain; chain.push_back("testcert"); uint64_t hash = QuicUtils::FNV1a_64_Hash(chain[0]); QuicStringPiece hash_bytes(reinterpret_cast<char*>(&hash), sizeof(hash)); - const QuicString compressed = CertCompressor::CompressChain( + const std::string compressed = CertCompressor::CompressChain( chain, QuicStringPiece(), hash_bytes, nullptr); EXPECT_EQ("02" /* cached */ + QuicTextUtils::HexEncode(hash_bytes) + "00" /* end of list */, QuicTextUtils::HexEncode(compressed)); - std::vector<QuicString> cached_certs, chain2; + std::vector<std::string> cached_certs, chain2; cached_certs.push_back(chain[0]); ASSERT_TRUE(CertCompressor::DecompressChain(compressed, cached_certs, nullptr, &chain2)); @@ -90,7 +90,7 @@ } TEST_F(CertCompressorTest, BadInputs) { - std::vector<QuicString> cached_certs, chain; + std::vector<std::string> cached_certs, chain; EXPECT_FALSE(CertCompressor::DecompressChain( QuicTextUtils::HexEncode("04") /* bad entry type */, cached_certs,
diff --git a/quic/core/crypto/chacha20_poly1305_decrypter_test.cc b/quic/core/crypto/chacha20_poly1305_decrypter_test.cc index 5f5ae01..d1c8d74 100644 --- a/quic/core/crypto/chacha20_poly1305_decrypter_test.cc +++ b/quic/core/crypto/chacha20_poly1305_decrypter_test.cc
@@ -141,12 +141,12 @@ bool has_pt = test_vectors[i].pt; // Decode the test vector. - QuicString key = QuicTextUtils::HexDecode(test_vectors[i].key); - QuicString iv = QuicTextUtils::HexDecode(test_vectors[i].iv); - QuicString fixed = QuicTextUtils::HexDecode(test_vectors[i].fixed); - QuicString aad = QuicTextUtils::HexDecode(test_vectors[i].aad); - QuicString ct = QuicTextUtils::HexDecode(test_vectors[i].ct); - QuicString pt; + std::string key = QuicTextUtils::HexDecode(test_vectors[i].key); + std::string iv = QuicTextUtils::HexDecode(test_vectors[i].iv); + std::string fixed = QuicTextUtils::HexDecode(test_vectors[i].fixed); + std::string aad = QuicTextUtils::HexDecode(test_vectors[i].aad); + std::string ct = QuicTextUtils::HexDecode(test_vectors[i].ct); + std::string pt; if (has_pt) { pt = QuicTextUtils::HexDecode(test_vectors[i].pt); }
diff --git a/quic/core/crypto/chacha20_poly1305_encrypter_test.cc b/quic/core/crypto/chacha20_poly1305_encrypter_test.cc index d8c27bf..05f8274 100644 --- a/quic/core/crypto/chacha20_poly1305_encrypter_test.cc +++ b/quic/core/crypto/chacha20_poly1305_encrypter_test.cc
@@ -90,15 +90,15 @@ ChaCha20Poly1305Encrypter encrypter; ChaCha20Poly1305Decrypter decrypter; - QuicString key = QuicTextUtils::HexDecode(test_vectors[0].key); + std::string key = QuicTextUtils::HexDecode(test_vectors[0].key); ASSERT_TRUE(encrypter.SetKey(key)); ASSERT_TRUE(decrypter.SetKey(key)); ASSERT_TRUE(encrypter.SetNoncePrefix("abcd")); ASSERT_TRUE(decrypter.SetNoncePrefix("abcd")); uint64_t packet_number = UINT64_C(0x123456789ABC); - QuicString associated_data = "associated_data"; - QuicString plaintext = "plaintext"; + std::string associated_data = "associated_data"; + std::string plaintext = "plaintext"; char encrypted[1024]; size_t len; ASSERT_TRUE(encrypter.EncryptPacket(packet_number, associated_data, plaintext, @@ -114,12 +114,12 @@ TEST_F(ChaCha20Poly1305EncrypterTest, Encrypt) { for (size_t i = 0; test_vectors[i].key != nullptr; i++) { // Decode the test vector. - QuicString key = QuicTextUtils::HexDecode(test_vectors[i].key); - QuicString pt = QuicTextUtils::HexDecode(test_vectors[i].pt); - QuicString iv = QuicTextUtils::HexDecode(test_vectors[i].iv); - QuicString fixed = QuicTextUtils::HexDecode(test_vectors[i].fixed); - QuicString aad = QuicTextUtils::HexDecode(test_vectors[i].aad); - QuicString ct = QuicTextUtils::HexDecode(test_vectors[i].ct); + std::string key = QuicTextUtils::HexDecode(test_vectors[i].key); + std::string pt = QuicTextUtils::HexDecode(test_vectors[i].pt); + std::string iv = QuicTextUtils::HexDecode(test_vectors[i].iv); + std::string fixed = QuicTextUtils::HexDecode(test_vectors[i].fixed); + std::string aad = QuicTextUtils::HexDecode(test_vectors[i].aad); + std::string ct = QuicTextUtils::HexDecode(test_vectors[i].ct); ChaCha20Poly1305Encrypter encrypter; ASSERT_TRUE(encrypter.SetKey(key));
diff --git a/quic/core/crypto/chacha20_poly1305_tls_decrypter_test.cc b/quic/core/crypto/chacha20_poly1305_tls_decrypter_test.cc index dd74539..664abe2 100644 --- a/quic/core/crypto/chacha20_poly1305_tls_decrypter_test.cc +++ b/quic/core/crypto/chacha20_poly1305_tls_decrypter_test.cc
@@ -136,12 +136,12 @@ bool has_pt = test_vectors[i].pt; // Decode the test vector. - QuicString key = QuicTextUtils::HexDecode(test_vectors[i].key); - QuicString iv = QuicTextUtils::HexDecode(test_vectors[i].iv); - QuicString fixed = QuicTextUtils::HexDecode(test_vectors[i].fixed); - QuicString aad = QuicTextUtils::HexDecode(test_vectors[i].aad); - QuicString ct = QuicTextUtils::HexDecode(test_vectors[i].ct); - QuicString pt; + std::string key = QuicTextUtils::HexDecode(test_vectors[i].key); + std::string iv = QuicTextUtils::HexDecode(test_vectors[i].iv); + std::string fixed = QuicTextUtils::HexDecode(test_vectors[i].fixed); + std::string aad = QuicTextUtils::HexDecode(test_vectors[i].aad); + std::string ct = QuicTextUtils::HexDecode(test_vectors[i].ct); + std::string pt; if (has_pt) { pt = QuicTextUtils::HexDecode(test_vectors[i].pt); }
diff --git a/quic/core/crypto/chacha20_poly1305_tls_encrypter_test.cc b/quic/core/crypto/chacha20_poly1305_tls_encrypter_test.cc index 905472b..6ac4810 100644 --- a/quic/core/crypto/chacha20_poly1305_tls_encrypter_test.cc +++ b/quic/core/crypto/chacha20_poly1305_tls_encrypter_test.cc
@@ -89,15 +89,15 @@ ChaCha20Poly1305TlsEncrypter encrypter; ChaCha20Poly1305TlsDecrypter decrypter; - QuicString key = QuicTextUtils::HexDecode(test_vectors[0].key); + std::string key = QuicTextUtils::HexDecode(test_vectors[0].key); ASSERT_TRUE(encrypter.SetKey(key)); ASSERT_TRUE(decrypter.SetKey(key)); ASSERT_TRUE(encrypter.SetIV("abcdefghijkl")); ASSERT_TRUE(decrypter.SetIV("abcdefghijkl")); uint64_t packet_number = UINT64_C(0x123456789ABC); - QuicString associated_data = "associated_data"; - QuicString plaintext = "plaintext"; + std::string associated_data = "associated_data"; + std::string plaintext = "plaintext"; char encrypted[1024]; size_t len; ASSERT_TRUE(encrypter.EncryptPacket(packet_number, associated_data, plaintext, @@ -113,12 +113,12 @@ TEST_F(ChaCha20Poly1305TlsEncrypterTest, Encrypt) { for (size_t i = 0; test_vectors[i].key != nullptr; i++) { // Decode the test vector. - QuicString key = QuicTextUtils::HexDecode(test_vectors[i].key); - QuicString pt = QuicTextUtils::HexDecode(test_vectors[i].pt); - QuicString iv = QuicTextUtils::HexDecode(test_vectors[i].iv); - QuicString fixed = QuicTextUtils::HexDecode(test_vectors[i].fixed); - QuicString aad = QuicTextUtils::HexDecode(test_vectors[i].aad); - QuicString ct = QuicTextUtils::HexDecode(test_vectors[i].ct); + std::string key = QuicTextUtils::HexDecode(test_vectors[i].key); + std::string pt = QuicTextUtils::HexDecode(test_vectors[i].pt); + std::string iv = QuicTextUtils::HexDecode(test_vectors[i].iv); + std::string fixed = QuicTextUtils::HexDecode(test_vectors[i].fixed); + std::string aad = QuicTextUtils::HexDecode(test_vectors[i].aad); + std::string ct = QuicTextUtils::HexDecode(test_vectors[i].ct); ChaCha20Poly1305TlsEncrypter encrypter; ASSERT_TRUE(encrypter.SetKey(key));
diff --git a/quic/core/crypto/channel_id.h b/quic/core/crypto/channel_id.h index a6c8de5..d94293c 100644 --- a/quic/core/crypto/channel_id.h +++ b/quic/core/crypto/channel_id.h
@@ -24,10 +24,10 @@ // Sign signs |signed_data| using the ChannelID private key and puts the // signature into |out_signature|. It returns true on success. virtual bool Sign(QuicStringPiece signed_data, - QuicString* out_signature) const = 0; + std::string* out_signature) const = 0; // SerializeKey returns the serialized ChannelID public key. - virtual QuicString SerializeKey() const = 0; + virtual std::string SerializeKey() const = 0; }; // ChannelIDSourceCallback provides a generic mechanism for a ChannelIDSource @@ -58,7 +58,7 @@ // when complete. In this case, the ChannelIDSource will take ownership of // |callback|. virtual QuicAsyncStatus GetChannelIDKey( - const QuicString& hostname, + const std::string& hostname, std::unique_ptr<ChannelIDKey>* channel_id_key, ChannelIDSourceCallback* callback) = 0; };
diff --git a/quic/core/crypto/channel_id_test.cc b/quic/core/crypto/channel_id_test.cc index 3e03580..d904bcb 100644 --- a/quic/core/crypto/channel_id_test.cc +++ b/quic/core/crypto/channel_id_test.cc
@@ -286,17 +286,17 @@ std::unique_ptr<ChannelIDSource> source( crypto_test_utils::ChannelIDSourceForTesting()); - const QuicString signed_data = "signed data"; - const QuicString hostname = "foo.example.com"; + const std::string signed_data = "signed data"; + const std::string hostname = "foo.example.com"; std::unique_ptr<ChannelIDKey> channel_id_key; QuicAsyncStatus status = source->GetChannelIDKey(hostname, &channel_id_key, nullptr); ASSERT_EQ(QUIC_SUCCESS, status); - QuicString signature; + std::string signature; ASSERT_TRUE(channel_id_key->Sign(signed_data, &signature)); - QuicString key = channel_id_key->SerializeKey(); + std::string key = channel_id_key->SerializeKey(); EXPECT_TRUE(ChannelIDVerifier::Verify(key, signed_data, signature)); EXPECT_FALSE(ChannelIDVerifier::Verify("a" + key, signed_data, signature)); @@ -305,14 +305,14 @@ std::unique_ptr<char[]> bad_key(new char[key.size()]); memcpy(bad_key.get(), key.data(), key.size()); bad_key[1] ^= 0x80; - EXPECT_FALSE(ChannelIDVerifier::Verify(QuicString(bad_key.get(), key.size()), + EXPECT_FALSE(ChannelIDVerifier::Verify(std::string(bad_key.get(), key.size()), signed_data, signature)); std::unique_ptr<char[]> bad_signature(new char[signature.size()]); memcpy(bad_signature.get(), signature.data(), signature.size()); bad_signature[1] ^= 0x80; EXPECT_FALSE(ChannelIDVerifier::Verify( - key, signed_data, QuicString(bad_signature.get(), signature.size()))); + key, signed_data, std::string(bad_signature.get(), signature.size()))); EXPECT_FALSE(ChannelIDVerifier::Verify(key, "wrong signed data", signature)); }
diff --git a/quic/core/crypto/crypto_framer.cc b/quic/core/crypto/crypto_framer.cc index dfd9eab..d8a32bc 100644 --- a/quic/core/crypto/crypto_framer.cc +++ b/quic/core/crypto/crypto_framer.cc
@@ -75,7 +75,7 @@ return error_; } -const QuicString& CryptoFramer::error_detail() const { +const std::string& CryptoFramer::error_detail() const { return error_detail_; } @@ -329,7 +329,7 @@ break; } // Save any remaining data. - buffer_ = QuicString(reader.PeekRemainingPayload()); + buffer_ = std::string(reader.PeekRemainingPayload()); return QUIC_NO_ERROR; }
diff --git a/quic/core/crypto/crypto_framer.h b/quic/core/crypto/crypto_framer.h index e83e6a6..34234e2 100644 --- a/quic/core/crypto/crypto_framer.h +++ b/quic/core/crypto/crypto_framer.h
@@ -58,7 +58,7 @@ } QuicErrorCode error() const override; - const QuicString& error_detail() const override; + const std::string& error_detail() const override; // Processes input data, which must be delivered in order. Returns // false if there was an error, and true otherwise. ProcessInput optionally @@ -115,13 +115,13 @@ // Last error. QuicErrorCode error_; // Remaining unparsed data. - QuicString buffer_; + std::string buffer_; // Current state of the parsing. CryptoFramerState state_; // The message currently being parsed. CryptoHandshakeMessage message_; // The issue which caused |error_| - QuicString error_detail_; + std::string error_detail_; // Number of entires in the message currently being parsed. uint16_t num_entries_; // tags_and_lengths_ contains the tags that are currently being parsed and
diff --git a/quic/core/crypto/crypto_handshake.h b/quic/core/crypto/crypto_handshake.h index 9b148c8..1e3d668 100644 --- a/quic/core/crypto/crypto_handshake.h +++ b/quic/core/crypto/crypto_handshake.h
@@ -104,28 +104,28 @@ QuicTag key_exchange; QuicTag aead; - QuicString initial_premaster_secret; - QuicString forward_secure_premaster_secret; + std::string initial_premaster_secret; + std::string forward_secure_premaster_secret; // initial_subkey_secret is used as the PRK input to the HKDF used when // performing key extraction that needs to happen before forward-secure keys // are available. - QuicString initial_subkey_secret; + std::string initial_subkey_secret; // subkey_secret is used as the PRK input to the HKDF used for key extraction. - QuicString subkey_secret; + std::string subkey_secret; CrypterPair initial_crypters; CrypterPair forward_secure_crypters; // Normalized SNI: converted to lower case and trailing '.' removed. - QuicString sni; - QuicString client_nonce; - QuicString server_nonce; + std::string sni; + std::string client_nonce; + std::string server_nonce; // hkdf_input_suffix contains the HKDF input following the label: the // ConnectionId, client hello and server config. This is only populated in the // client because only the client needs to derive the forward secure keys at a // later time from the initial keys. - QuicString hkdf_input_suffix; + std::string hkdf_input_suffix; // cached_certs contains the cached certificates that a client used when // sending a client hello. - std::vector<QuicString> cached_certs; + std::vector<std::string> cached_certs; // client_key_exchange is used by clients to store the ephemeral KeyExchange // for the connection. std::unique_ptr<KeyExchange> client_key_exchange; @@ -133,14 +133,14 @@ // proves possession of the corresponding private key. It consists of 32 // bytes of x coordinate, followed by 32 bytes of y coordinate. Both values // are big-endian and the pair is a P-256 public key. - QuicString channel_id; + std::string channel_id; QuicTag token_binding_key_param; // Used when generating proof signature when sending server config updates. // Used to generate cert chain when sending server config updates. - QuicString client_common_set_hashes; - QuicString client_cached_cert_hashes; + std::string client_common_set_hashes; + std::string client_cached_cert_hashes; // Default to false; set to true if the client indicates that it supports sct // by sending CSCT tag with an empty value in client hello.
diff --git a/quic/core/crypto/crypto_handshake_message.cc b/quic/core/crypto/crypto_handshake_message.cc index a057254..46577b3 100644 --- a/quic/core/crypto/crypto_handshake_message.cc +++ b/quic/core/crypto/crypto_handshake_message.cc
@@ -85,7 +85,7 @@ void CryptoHandshakeMessage::SetStringPiece(QuicTag tag, QuicStringPiece value) { - tag_value_map_[tag] = QuicString(value); + tag_value_map_[tag] = std::string(value); } void CryptoHandshakeMessage::Erase(QuicTag tag) { @@ -236,7 +236,7 @@ return minimum_size_; } -QuicString CryptoHandshakeMessage::DebugString() const { +std::string CryptoHandshakeMessage::DebugString() const { return DebugStringInternal(0); } @@ -261,11 +261,12 @@ return ret; } -QuicString CryptoHandshakeMessage::DebugStringInternal(size_t indent) const { - QuicString ret = QuicString(2 * indent, ' ') + QuicTagToString(tag_) + "<\n"; +std::string CryptoHandshakeMessage::DebugStringInternal(size_t indent) const { + std::string ret = + std::string(2 * indent, ' ') + QuicTagToString(tag_) + "<\n"; ++indent; for (auto it = tag_value_map_.begin(); it != tag_value_map_.end(); ++it) { - ret += QuicString(2 * indent, ' ') + QuicTagToString(it->first) + ": "; + ret += std::string(2 * indent, ' ') + QuicTagToString(it->first) + ": "; bool done = false; switch (it->first) { @@ -371,7 +372,7 @@ ret += "\n"; } --indent; - ret += QuicString(2 * indent, ' ') + ">"; + ret += std::string(2 * indent, ' ') + ">"; return ret; }
diff --git a/quic/core/crypto/crypto_handshake_message.h b/quic/core/crypto/crypto_handshake_message.h index 1f6e8b6..8a75436 100644 --- a/quic/core/crypto/crypto_handshake_message.h +++ b/quic/core/crypto/crypto_handshake_message.h
@@ -45,7 +45,7 @@ template <class T> void SetValue(QuicTag tag, const T& v) { tag_value_map_[tag] = - QuicString(reinterpret_cast<const char*>(&v), sizeof(v)); + std::string(reinterpret_cast<const char*>(&v), sizeof(v)); } // SetVector sets an element with the given tag to the raw contents of an @@ -53,10 +53,10 @@ template <class T> void SetVector(QuicTag tag, const std::vector<T>& v) { if (v.empty()) { - tag_value_map_[tag] = QuicString(); + tag_value_map_[tag] = std::string(); } else { - tag_value_map_[tag] = QuicString(reinterpret_cast<const char*>(&v[0]), - v.size() * sizeof(T)); + tag_value_map_[tag] = std::string(reinterpret_cast<const char*>(&v[0]), + v.size() * sizeof(T)); } } @@ -126,7 +126,7 @@ // DebugString returns a multi-line, string representation of the message // suitable for including in debug output. - QuicString DebugString() const; + std::string DebugString() const; private: // GetPOD is a utility function for extracting a plain-old-data value. If @@ -138,7 +138,7 @@ // little-endian. QuicErrorCode GetPOD(QuicTag tag, void* out, size_t len) const; - QuicString DebugStringInternal(size_t indent) const; + std::string DebugStringInternal(size_t indent) const; QuicTag tag_; QuicTagValueMap tag_value_map_;
diff --git a/quic/core/crypto/crypto_message_parser.h b/quic/core/crypto/crypto_message_parser.h index 8b9fa4a..3c70e6e 100644 --- a/quic/core/crypto/crypto_message_parser.h +++ b/quic/core/crypto/crypto_message_parser.h
@@ -17,7 +17,7 @@ virtual ~CryptoMessageParser() {} virtual QuicErrorCode error() const = 0; - virtual const QuicString& error_detail() const = 0; + virtual const std::string& error_detail() const = 0; // Processes input data, which must be delivered in order. The input data // being processed was received at encryption level |level|. Returns
diff --git a/quic/core/crypto/crypto_message_printer_bin.cc b/quic/core/crypto/crypto_message_printer_bin.cc index f14abb0..66fa7e4 100644 --- a/quic/core/crypto/crypto_message_printer_bin.cc +++ b/quic/core/crypto/crypto_message_printer_bin.cc
@@ -16,7 +16,6 @@ #include "net/third_party/quiche/src/quic/platform/api/quic_text_utils.h" using quic::Perspective; -using quic::QuicString; using std::cerr; using std::cout; using std::endl; @@ -44,7 +43,7 @@ quic::CryptoFramer framer; framer.set_visitor(&printer); framer.set_process_truncated_messages(true); - QuicString input = quic::QuicTextUtils::HexDecode(argv[1]); + std::string input = quic::QuicTextUtils::HexDecode(argv[1]); if (!framer.ProcessInput(input)) { return 1; }
diff --git a/quic/core/crypto/crypto_protocol.h b/quic/core/crypto/crypto_protocol.h index e5a4048..d3304ba 100644 --- a/quic/core/crypto/crypto_protocol.h +++ b/quic/core/crypto/crypto_protocol.h
@@ -24,7 +24,7 @@ namespace quic { -typedef QuicString ServerConfigID; +typedef std::string ServerConfigID; // clang-format off const QuicTag kCHLO = TAG('C', 'H', 'L', 'O'); // Client hello
diff --git a/quic/core/crypto/crypto_secret_boxer.cc b/quic/core/crypto/crypto_secret_boxer.cc index ada12ad..16e9d0c 100644 --- a/quic/core/crypto/crypto_secret_boxer.cc +++ b/quic/core/crypto/crypto_secret_boxer.cc
@@ -43,12 +43,12 @@ // kAEAD is the AEAD used for boxing: AES-256-GCM-SIV. static const EVP_AEAD* (*const kAEAD)() = EVP_aead_aes_256_gcm_siv; -void CryptoSecretBoxer::SetKeys(const std::vector<QuicString>& keys) { +void CryptoSecretBoxer::SetKeys(const std::vector<std::string>& keys) { DCHECK(!keys.empty()); const EVP_AEAD* const aead = kAEAD(); std::unique_ptr<State> new_state(new State); - for (const QuicString& key : keys) { + for (const std::string& key : keys) { DCHECK_EQ(kBoxKeySize, key.size()); bssl::UniquePtr<EVP_AEAD_CTX> ctx( EVP_AEAD_CTX_new(aead, reinterpret_cast<const uint8_t*>(key.data()), @@ -66,8 +66,8 @@ state_ = std::move(new_state); } -QuicString CryptoSecretBoxer::Box(QuicRandom* rand, - QuicStringPiece plaintext) const { +std::string CryptoSecretBoxer::Box(QuicRandom* rand, + QuicStringPiece plaintext) const { // The box is formatted as: // 12 bytes of random nonce // n bytes of ciphertext @@ -75,7 +75,7 @@ size_t out_len = kSIVNonceSize + plaintext.size() + EVP_AEAD_max_overhead(kAEAD()); - QuicString ret; + std::string ret; ret.resize(out_len); uint8_t* out = reinterpret_cast<uint8_t*>(const_cast<char*>(ret.data())); @@ -104,7 +104,7 @@ } bool CryptoSecretBoxer::Unbox(QuicStringPiece in_ciphertext, - QuicString* out_storage, + std::string* out_storage, QuicStringPiece* out) const { if (in_ciphertext.size() < kSIVNonceSize) { return false;
diff --git a/quic/core/crypto/crypto_secret_boxer.h b/quic/core/crypto/crypto_secret_boxer.h index de470b1..13e0469 100644 --- a/quic/core/crypto/crypto_secret_boxer.h +++ b/quic/core/crypto/crypto_secret_boxer.h
@@ -36,13 +36,13 @@ // used by |Box|, but all supplied keys will be tried by |Unbox|, to handle // key skew across the fleet. This must be called before |Box| or |Unbox|. // Keys must be |GetKeySize()| bytes long. - void SetKeys(const std::vector<QuicString>& keys); + void SetKeys(const std::vector<std::string>& keys); // Box encrypts |plaintext| using a random nonce generated from |rand| and // returns the resulting ciphertext. Since an authenticator and nonce are // included, the result will be slightly larger than |plaintext|. The first // key in the vector supplied to |SetKeys| will be used. - QuicString Box(QuicRandom* rand, QuicStringPiece plaintext) const; + std::string Box(QuicRandom* rand, QuicStringPiece plaintext) const; // Unbox takes the result of a previous call to |Box| in |ciphertext| and // authenticates+decrypts it. If |ciphertext| cannot be decrypted with any of @@ -50,7 +50,7 @@ // used to store the result and |out| is set to point into |out_storage| and // contains the original plaintext. bool Unbox(QuicStringPiece ciphertext, - QuicString* out_storage, + std::string* out_storage, QuicStringPiece* out) const; private:
diff --git a/quic/core/crypto/crypto_secret_boxer_test.cc b/quic/core/crypto/crypto_secret_boxer_test.cc index d060051..8739977 100644 --- a/quic/core/crypto/crypto_secret_boxer_test.cc +++ b/quic/core/crypto/crypto_secret_boxer_test.cc
@@ -17,29 +17,30 @@ QuicStringPiece message("hello world"); CryptoSecretBoxer boxer; - boxer.SetKeys({QuicString(CryptoSecretBoxer::GetKeySize(), 0x11)}); + boxer.SetKeys({std::string(CryptoSecretBoxer::GetKeySize(), 0x11)}); - const QuicString box = boxer.Box(QuicRandom::GetInstance(), message); + const std::string box = boxer.Box(QuicRandom::GetInstance(), message); - QuicString storage; + std::string storage; QuicStringPiece result; EXPECT_TRUE(boxer.Unbox(box, &storage, &result)); EXPECT_EQ(result, message); - EXPECT_FALSE(boxer.Unbox(QuicString(1, 'X') + box, &storage, &result)); - EXPECT_FALSE(boxer.Unbox(box.substr(1, QuicString::npos), &storage, &result)); - EXPECT_FALSE(boxer.Unbox(QuicString(), &storage, &result)); + EXPECT_FALSE(boxer.Unbox(std::string(1, 'X') + box, &storage, &result)); + EXPECT_FALSE( + boxer.Unbox(box.substr(1, std::string::npos), &storage, &result)); + EXPECT_FALSE(boxer.Unbox(std::string(), &storage, &result)); EXPECT_FALSE(boxer.Unbox( - QuicString(1, box[0] ^ 0x80) + box.substr(1, QuicString::npos), &storage, - &result)); + std::string(1, box[0] ^ 0x80) + box.substr(1, std::string::npos), + &storage, &result)); } // Helper function to test whether one boxer can decode the output of another. static bool CanDecode(const CryptoSecretBoxer& decoder, const CryptoSecretBoxer& encoder) { QuicStringPiece message("hello world"); - const QuicString boxed = encoder.Box(QuicRandom::GetInstance(), message); - QuicString storage; + const std::string boxed = encoder.Box(QuicRandom::GetInstance(), message); + std::string storage; QuicStringPiece result; bool ok = decoder.Unbox(boxed, &storage, &result); if (ok) { @@ -49,8 +50,8 @@ } TEST_F(CryptoSecretBoxerTest, MultipleKeys) { - QuicString key_11(CryptoSecretBoxer::GetKeySize(), 0x11); - QuicString key_12(CryptoSecretBoxer::GetKeySize(), 0x12); + std::string key_11(CryptoSecretBoxer::GetKeySize(), 0x11); + std::string key_12(CryptoSecretBoxer::GetKeySize(), 0x12); CryptoSecretBoxer boxer_11, boxer_12, boxer; boxer_11.SetKeys({key_11});
diff --git a/quic/core/crypto/crypto_server_test.cc b/quic/core/crypto/crypto_server_test.cc index 11615c2..b6740e9 100644 --- a/quic/core/crypto/crypto_server_test.cc +++ b/quic/core/crypto/crypto_server_test.cc
@@ -46,7 +46,7 @@ ~DummyProofVerifierCallback() override {} void Run(bool ok, - const QuicString& error_details, + const std::string& error_details, std::unique_ptr<ProofVerifyDetails>* details) override { DCHECK(false); } @@ -279,7 +279,7 @@ void Run( QuicErrorCode error, - const QuicString& error_details, + const std::string& error_details, std::unique_ptr<CryptoHandshakeMessage> message, std::unique_ptr<DiversificationNonce> diversification_nonce, std::unique_ptr<ProofSource::Details> proof_source_details) override { @@ -291,7 +291,7 @@ ASSERT_NE(error, QUIC_NO_ERROR) << "Message didn't fail: " << result_->client_hello.DebugString(); - EXPECT_TRUE(error_details.find(error_substr_) != QuicString::npos) + EXPECT_TRUE(error_details.find(error_substr_) != std::string::npos) << error_substr_ << " not in " << error_details; } if (message != nullptr) { @@ -328,8 +328,8 @@ EXPECT_TRUE(called); } - QuicString GenerateNonce() { - QuicString nonce; + std::string GenerateNonce() { + std::string nonce; CryptoUtils::GenerateNonce( clock_.WallNow(), rand_, QuicStringPiece(reinterpret_cast<const char*>(orbit_), sizeof(orbit_)), @@ -384,7 +384,7 @@ GetParam().use_stateless_rejects; } - QuicString XlctHexString() { + std::string XlctHexString() { uint64_t xlct = crypto_test_utils::LeafCertHashForTesting(); return "#" + QuicTextUtils::HexEncode(reinterpret_cast<char*>(&xlct), sizeof(xlct)); @@ -397,7 +397,7 @@ QuicSocketAddress client_address_; ParsedQuicVersionVector supported_versions_; ParsedQuicVersion client_version_; - QuicString client_version_string_; + std::string client_version_string_; QuicCryptoServerConfig config_; QuicCryptoServerConfigPeer peer_; QuicCompressedCertsCache compressed_certs_cache_; @@ -411,11 +411,12 @@ // These strings contain hex escaped values from the server suitable for using // when constructing client hello messages. - QuicString nonce_hex_, pub_hex_, srct_hex_, scid_hex_; + std::string nonce_hex_, pub_hex_, srct_hex_, scid_hex_; std::unique_ptr<CryptoHandshakeMessage> server_config_; }; -INSTANTIATE_TEST_SUITE_P(CryptoServerTests, CryptoServerTest, +INSTANTIATE_TEST_SUITE_P(CryptoServerTests, + CryptoServerTest, ::testing::ValuesIn(GetTestParams())); TEST_P(CryptoServerTest, BadSNI) { @@ -669,7 +670,7 @@ } // Set the client's preferred version to a supported version that // is not the "current" version (supported_versions_.front()). - QuicString bad_version = + std::string bad_version = ParsedQuicVersionToString(supported_versions_.back()); CryptoHandshakeMessage msg = crypto_test_utils::CreateCHLO( @@ -683,16 +684,16 @@ TEST_P(CryptoServerTest, CorruptServerConfig) { // This tests corrupted server config. - CryptoHandshakeMessage msg = - crypto_test_utils::CreateCHLO({{"PDMD", "X509"}, - {"AEAD", "AESG"}, - {"KEXS", "C255"}, - {"SCID", (QuicString(1, 'X') + scid_hex_)}, - {"#004b5453", srct_hex_}, - {"PUBS", pub_hex_}, - {"NONC", nonce_hex_}, - {"VER\0", client_version_string_}}, - kClientHelloMinimumSize); + CryptoHandshakeMessage msg = crypto_test_utils::CreateCHLO( + {{"PDMD", "X509"}, + {"AEAD", "AESG"}, + {"KEXS", "C255"}, + {"SCID", (std::string(1, 'X') + scid_hex_)}, + {"#004b5453", srct_hex_}, + {"PUBS", pub_hex_}, + {"NONC", nonce_hex_}, + {"VER\0", client_version_string_}}, + kClientHelloMinimumSize); ShouldSucceed(msg); CheckRejectTag(); @@ -708,7 +709,7 @@ {"AEAD", "AESG"}, {"KEXS", "C255"}, {"SCID", scid_hex_}, - {"#004b5453", (QuicString(1, 'X') + srct_hex_)}, + {"#004b5453", (std::string(1, 'X') + srct_hex_)}, {"PUBS", pub_hex_}, {"NONC", nonce_hex_}, {"XLCT", XlctHexString()}, @@ -729,7 +730,7 @@ {"AEAD", "AESG"}, {"KEXS", "C255"}, {"SCID", scid_hex_}, - {"#004b5453", (QuicString(1, 'X') + srct_hex_)}, + {"#004b5453", (std::string(1, 'X') + srct_hex_)}, {"PUBS", pub_hex_}, {"NONC", nonce_hex_}, {"XLCT", XlctHexString()}, @@ -749,9 +750,9 @@ {"AEAD", "AESG"}, {"KEXS", "C255"}, {"SCID", scid_hex_}, - {"#004b5453", (QuicString(1, 'X') + srct_hex_)}, + {"#004b5453", (std::string(1, 'X') + srct_hex_)}, {"PUBS", pub_hex_}, - {"NONC", (QuicString(1, 'X') + nonce_hex_)}, + {"NONC", (std::string(1, 'X') + nonce_hex_)}, {"XLCT", XlctHexString()}, {"VER\0", client_version_string_}}, kClientHelloMinimumSize); @@ -770,11 +771,11 @@ {"AEAD", "AESG"}, {"KEXS", "C255"}, {"SCID", scid_hex_}, - {"#004b5453", (QuicString(1, 'X') + srct_hex_)}, + {"#004b5453", (std::string(1, 'X') + srct_hex_)}, {"PUBS", pub_hex_}, - {"NONC", (QuicString(1, 'X') + nonce_hex_)}, - {"NONP", (QuicString(1, 'X') + nonce_hex_)}, - {"SNO\0", (QuicString(1, 'X') + nonce_hex_)}, + {"NONC", (std::string(1, 'X') + nonce_hex_)}, + {"NONP", (std::string(1, 'X') + nonce_hex_)}, + {"SNO\0", (std::string(1, 'X') + nonce_hex_)}, {"XLCT", XlctHexString()}, {"VER\0", client_version_string_}}, kClientHelloMinimumSize); @@ -847,9 +848,9 @@ // Get certs from compressed certs. const CommonCertSets* common_cert_sets(CommonCertSets::GetInstanceQUIC()); - std::vector<QuicString> cached_certs; + std::vector<std::string> cached_certs; - std::vector<QuicString> certs; + std::vector<std::string> certs; ASSERT_TRUE(CertCompressor::DecompressChain(cert, cached_certs, common_cert_sets, &certs)); @@ -859,16 +860,16 @@ std::unique_ptr<ProofVerifyContext> verify_context( crypto_test_utils::ProofVerifyContextForTesting()); std::unique_ptr<ProofVerifyDetails> details; - QuicString error_details; + std::string error_details; std::unique_ptr<ProofVerifierCallback> callback( new DummyProofVerifierCallback()); - QuicString chlo_hash; + std::string chlo_hash; CryptoUtils::HashHandshakeMessage(msg, &chlo_hash, Perspective::IS_SERVER); EXPECT_EQ(QUIC_SUCCESS, proof_verifier->VerifyProof( - "test.example.com", 443, (QuicString(scfg_str)), + "test.example.com", 443, (std::string(scfg_str)), client_version_.transport_version, chlo_hash, certs, "", - (QuicString(proof)), verify_context.get(), &error_details, + (std::string(proof)), verify_context.get(), &error_details, &details, std::move(callback))); } @@ -980,7 +981,7 @@ QuicStringPiece certs_compressed; ASSERT_TRUE(out_.GetStringPiece(kCertificateTag, &certs_compressed)); ASSERT_NE(0u, certs_compressed.size()); - std::vector<QuicString> certs; + std::vector<std::string> certs; ASSERT_TRUE(CertCompressor::DecompressChain( certs_compressed, /*cached_certs=*/{}, /*common_sets=*/nullptr, &certs)); @@ -1084,7 +1085,7 @@ QuicStringPiece scid; EXPECT_TRUE(scfg->GetStringPiece(kSCID, &scid)); // Need to take a copy of |scid| has we're about to call |Erase|. - const QuicString scid_str(scid); + const std::string scid_str(scid); scfg->Erase(kSCID); scfg->MarkDirty();
diff --git a/quic/core/crypto/crypto_utils.cc b/quic/core/crypto/crypto_utils.cc index 4f6a61d..ff682b3 100644 --- a/quic/core/crypto/crypto_utils.cc +++ b/quic/core/crypto/crypto_utils.cc
@@ -37,7 +37,7 @@ std::vector<uint8_t> CryptoUtils::HkdfExpandLabel( const EVP_MD* prf, const std::vector<uint8_t>& secret, - const QuicString& label, + const std::string& label, size_t out_len) { bssl::ScopedCBB quic_hkdf_label; CBB inner_label; @@ -115,9 +115,9 @@ << "HKDF_extract failed when creating initial crypters"; handshake_secret.resize(handshake_secret_len); - const QuicString client_label = "client in"; - const QuicString server_label = "server in"; - QuicString encryption_label, decryption_label; + const std::string client_label = "client in"; + const std::string server_label = "server in"; + std::string encryption_label, decryption_label; if (perspective == Perspective::IS_CLIENT) { encryption_label = client_label; decryption_label = server_label; @@ -140,7 +140,7 @@ void CryptoUtils::GenerateNonce(QuicWallTime now, QuicRandom* random_generator, QuicStringPiece orbit, - QuicString* nonce) { + std::string* nonce) { // a 4-byte timestamp + 28 random bytes. nonce->reserve(kNonceSize); nonce->resize(kNonceSize); @@ -169,11 +169,11 @@ QuicStringPiece client_nonce, QuicStringPiece server_nonce, QuicStringPiece pre_shared_key, - const QuicString& hkdf_input, + const std::string& hkdf_input, Perspective perspective, Diversification diversification, CrypterPair* crypters, - QuicString* subkey_secret) { + std::string* subkey_secret) { // If the connection is using PSK, concatenate it with the pre-master secret. std::unique_ptr<char[]> psk_premaster_secret; if (!pre_shared_key.empty()) { @@ -207,9 +207,9 @@ subkey_secret == nullptr ? 0 : premaster_secret.length(); QuicStringPiece nonce = client_nonce; - QuicString nonce_storage; + std::string nonce_storage; if (!server_nonce.empty()) { - nonce_storage = QuicString(client_nonce) + QuicString(server_nonce); + nonce_storage = std::string(client_nonce) + std::string(server_nonce); nonce = nonce_storage; } @@ -259,7 +259,7 @@ return false; } - QuicString key, nonce_prefix; + std::string key, nonce_prefix; QuicDecrypter::DiversifyPreliminaryKey( hkdf.server_write_key(), hkdf.server_write_iv(), *diversification.nonce(), key_bytes, nonce_prefix_bytes, &key, @@ -277,7 +277,7 @@ } if (subkey_secret != nullptr) { - *subkey_secret = QuicString(hkdf.subkey_secret()); + *subkey_secret = std::string(hkdf.subkey_secret()); } return true; @@ -288,7 +288,7 @@ QuicStringPiece label, QuicStringPiece context, size_t result_len, - QuicString* result) { + std::string* result) { for (size_t i = 0; i < label.length(); i++) { if (label[i] == '\0') { QUIC_LOG(ERROR) << "ExportKeyingMaterial label may not contain NULs"; @@ -301,14 +301,14 @@ return false; } uint32_t context_length = static_cast<uint32_t>(context.length()); - QuicString info = QuicString(label); + std::string info = std::string(label); info.push_back('\0'); info.append(reinterpret_cast<char*>(&context_length), sizeof(context_length)); info.append(context.data(), context.length()); QuicHKDF hkdf(subkey_secret, QuicStringPiece() /* no salt */, info, result_len, 0 /* no fixed IV */, 0 /* no subkey secret */); - *result = QuicString(hkdf.client_write_key()); + *result = std::string(hkdf.client_write_key()); return true; } @@ -320,7 +320,7 @@ QuicErrorCode CryptoUtils::ValidateServerHello( const CryptoHandshakeMessage& server_hello, const ParsedQuicVersionVector& negotiated_versions, - QuicString* error_details) { + std::string* error_details) { DCHECK(error_details != nullptr); if (server_hello.tag() != kSHLO) { @@ -342,7 +342,7 @@ QuicErrorCode CryptoUtils::ValidateServerHelloVersions( const QuicVersionLabelVector& server_versions, const ParsedQuicVersionVector& negotiated_versions, - QuicString* error_details) { + std::string* error_details) { if (!negotiated_versions.empty()) { bool mismatch = server_versions.size() != negotiated_versions.size(); for (size_t i = 0; i < server_versions.size() && !mismatch; ++i) { @@ -368,7 +368,7 @@ const CryptoHandshakeMessage& client_hello, ParsedQuicVersion version, const ParsedQuicVersionVector& supported_versions, - QuicString* error_details) { + std::string* error_details) { if (client_hello.tag() != kCHLO) { *error_details = "Bad tag"; return QUIC_INVALID_CRYPTO_MESSAGE_TYPE; @@ -392,7 +392,7 @@ QuicVersionLabel client_version, ParsedQuicVersion connection_version, const ParsedQuicVersionVector& supported_versions, - QuicString* error_details) { + std::string* error_details) { if (client_version != CreateQuicVersionLabel(connection_version)) { // Check to see if |client_version| is actually on the supported versions // list. If not, the server doesn't support that version and it's not a @@ -456,7 +456,7 @@ // static void CryptoUtils::HashHandshakeMessage(const CryptoHandshakeMessage& message, - QuicString* output, + std::string* output, Perspective perspective) { const QuicData& serialized = message.GetSerialized(); uint8_t digest[SHA256_DIGEST_LENGTH];
diff --git a/quic/core/crypto/crypto_utils.h b/quic/core/crypto/crypto_utils.h index 511bae9..f340bf4 100644 --- a/quic/core/crypto/crypto_utils.h +++ b/quic/core/crypto/crypto_utils.h
@@ -101,7 +101,7 @@ static void GenerateNonce(QuicWallTime now, QuicRandom* random_generator, QuicStringPiece orbit, - QuicString* nonce); + std::string* nonce); // DeriveKeys populates |crypters->encrypter|, |crypters->decrypter|, and // |subkey_secret| (optional -- may be null) given the contents of @@ -127,11 +127,11 @@ QuicStringPiece client_nonce, QuicStringPiece server_nonce, QuicStringPiece pre_shared_key, - const QuicString& hkdf_input, + const std::string& hkdf_input, Perspective perspective, Diversification diversification, CrypterPair* crypters, - QuicString* subkey_secret); + std::string* subkey_secret); // Performs key extraction to derive a new secret of |result_len| bytes // dependent on |subkey_secret|, |label|, and |context|. Returns false if the @@ -141,7 +141,7 @@ QuicStringPiece label, QuicStringPiece context, size_t result_len, - QuicString* result); + std::string* result); // Computes the FNV-1a hash of the provided DER-encoded cert for use in the // XLCT tag. @@ -155,7 +155,7 @@ static QuicErrorCode ValidateServerHello( const CryptoHandshakeMessage& server_hello, const ParsedQuicVersionVector& negotiated_versions, - QuicString* error_details); + std::string* error_details); // Validates that the |server_versions| received do not indicate that the // ServerHello is part of a downgrade attack. |negotiated_versions| must @@ -167,7 +167,7 @@ static QuicErrorCode ValidateServerHelloVersions( const QuicVersionLabelVector& server_versions, const ParsedQuicVersionVector& negotiated_versions, - QuicString* error_details); + std::string* error_details); // Validates that |client_hello| is actually a CHLO and that this is not part // of a downgrade attack. @@ -179,7 +179,7 @@ const CryptoHandshakeMessage& client_hello, ParsedQuicVersion version, const ParsedQuicVersionVector& supported_versions, - QuicString* error_details); + std::string* error_details); // Validates that the |client_version| received does not indicate that a // downgrade attack has occurred. |connection_version| is the version of the @@ -192,7 +192,7 @@ QuicVersionLabel client_version, ParsedQuicVersion connection_version, const ParsedQuicVersionVector& supported_versions, - QuicString* error_details); + std::string* error_details); // Returns the name of the HandshakeFailureReason as a char* static const char* HandshakeFailureReasonToString( @@ -200,7 +200,7 @@ // Writes a hash of the serialized |message| into |output|. static void HashHandshakeMessage(const CryptoHandshakeMessage& message, - QuicString* output, + std::string* output, Perspective perspective); private: @@ -221,7 +221,7 @@ static std::vector<uint8_t> HkdfExpandLabel( const EVP_MD* prf, const std::vector<uint8_t>& secret, - const QuicString& label, + const std::string& label, size_t out_len); };
diff --git a/quic/core/crypto/crypto_utils_test.cc b/quic/core/crypto/crypto_utils_test.cc index 90a37af..c76337d 100644 --- a/quic/core/crypto/crypto_utils_test.cc +++ b/quic/core/crypto/crypto_utils_test.cc
@@ -50,18 +50,18 @@ for (size_t i = 0; i < QUIC_ARRAYSIZE(test_vector); i++) { // Decode the test vector. - QuicString subkey_secret = + std::string subkey_secret = QuicTextUtils::HexDecode(test_vector[i].subkey_secret); - QuicString label = QuicTextUtils::HexDecode(test_vector[i].label); - QuicString context = QuicTextUtils::HexDecode(test_vector[i].context); + std::string label = QuicTextUtils::HexDecode(test_vector[i].label); + std::string context = QuicTextUtils::HexDecode(test_vector[i].context); size_t result_len = test_vector[i].result_len; bool expect_ok = test_vector[i].expected != nullptr; - QuicString expected; + std::string expected; if (expect_ok) { expected = QuicTextUtils::HexDecode(test_vector[i].expected); } - QuicString result; + std::string result; bool ok = CryptoUtils::ExportKeyingMaterial(subkey_secret, label, context, result_len, &result); EXPECT_EQ(expect_ok, ok);
diff --git a/quic/core/crypto/curve25519_key_exchange.cc b/quic/core/crypto/curve25519_key_exchange.cc index 368b453..9c8e5ed 100644 --- a/quic/core/crypto/curve25519_key_exchange.cc +++ b/quic/core/crypto/curve25519_key_exchange.cc
@@ -20,7 +20,8 @@ ~Curve25519KeyExchangeFactory() override = default; std::unique_ptr<KeyExchange> Create(QuicRandom* rand) const override { - const QuicString private_value = Curve25519KeyExchange::NewPrivateKey(rand); + const std::string private_value = + Curve25519KeyExchange::NewPrivateKey(rand); return Curve25519KeyExchange::New(private_value); } @@ -58,10 +59,10 @@ } // static -QuicString Curve25519KeyExchange::NewPrivateKey(QuicRandom* rand) { +std::string Curve25519KeyExchange::NewPrivateKey(QuicRandom* rand) { uint8_t private_key[X25519_PRIVATE_KEY_LEN]; rand->RandBytes(private_key, sizeof(private_key)); - return QuicString(reinterpret_cast<char*>(private_key), sizeof(private_key)); + return std::string(reinterpret_cast<char*>(private_key), sizeof(private_key)); } const Curve25519KeyExchange::Factory& Curve25519KeyExchange::GetFactory() @@ -72,7 +73,7 @@ bool Curve25519KeyExchange::CalculateSharedKey( QuicStringPiece peer_public_value, - QuicString* out_result) const { + std::string* out_result) const { if (peer_public_value.size() != X25519_PUBLIC_VALUE_LEN) { return false; } @@ -89,7 +90,7 @@ void Curve25519KeyExchange::CalculateSharedKey( QuicStringPiece peer_public_value, - QuicString* shared_key, + std::string* shared_key, std::unique_ptr<Callback> callback) const { callback->Run(CalculateSharedKey(peer_public_value, shared_key)); }
diff --git a/quic/core/crypto/curve25519_key_exchange.h b/quic/core/crypto/curve25519_key_exchange.h index a715e3e..115789c 100644 --- a/quic/core/crypto/curve25519_key_exchange.h +++ b/quic/core/crypto/curve25519_key_exchange.h
@@ -29,14 +29,14 @@ // NewPrivateKey returns a private key, generated from |rand|, suitable for // passing to |New|. - static QuicString NewPrivateKey(QuicRandom* rand); + static std::string NewPrivateKey(QuicRandom* rand); // KeyExchange interface. const Factory& GetFactory() const override; bool CalculateSharedKey(QuicStringPiece peer_public_value, - QuicString* shared_key) const override; + std::string* shared_key) const override; void CalculateSharedKey(QuicStringPiece peer_public_value, - QuicString* shared_key, + std::string* shared_key, std::unique_ptr<Callback> callback) const override; QuicStringPiece public_value() const override;
diff --git a/quic/core/crypto/curve25519_key_exchange_test.cc b/quic/core/crypto/curve25519_key_exchange_test.cc index e5ed6e0..0c4f735 100644 --- a/quic/core/crypto/curve25519_key_exchange_test.cc +++ b/quic/core/crypto/curve25519_key_exchange_test.cc
@@ -46,8 +46,8 @@ QuicRandom* const rand = QuicRandom::GetInstance(); for (int i = 0; i < 5; i++) { - const QuicString alice_key(Curve25519KeyExchange::NewPrivateKey(rand)); - const QuicString bob_key(Curve25519KeyExchange::NewPrivateKey(rand)); + const std::string alice_key(Curve25519KeyExchange::NewPrivateKey(rand)); + const std::string bob_key(Curve25519KeyExchange::NewPrivateKey(rand)); std::unique_ptr<Curve25519KeyExchange> alice( Curve25519KeyExchange::New(alice_key)); @@ -57,7 +57,7 @@ const QuicStringPiece alice_public(alice->public_value()); const QuicStringPiece bob_public(bob->public_value()); - QuicString alice_shared, bob_shared; + std::string alice_shared, bob_shared; ASSERT_TRUE(alice->CalculateSharedKey(bob_public, &alice_shared)); ASSERT_TRUE(bob->CalculateSharedKey(alice_public, &bob_shared)); ASSERT_EQ(alice_shared, bob_shared); @@ -70,8 +70,8 @@ QuicRandom* const rand = QuicRandom::GetInstance(); for (int i = 0; i < 5; i++) { - const QuicString alice_key(Curve25519KeyExchange::NewPrivateKey(rand)); - const QuicString bob_key(Curve25519KeyExchange::NewPrivateKey(rand)); + const std::string alice_key(Curve25519KeyExchange::NewPrivateKey(rand)); + const std::string bob_key(Curve25519KeyExchange::NewPrivateKey(rand)); std::unique_ptr<Curve25519KeyExchange> alice( Curve25519KeyExchange::New(alice_key)); @@ -81,7 +81,7 @@ const QuicStringPiece alice_public(alice->public_value()); const QuicStringPiece bob_public(bob->public_value()); - QuicString alice_shared, bob_shared; + std::string alice_shared, bob_shared; TestCallbackResult alice_result; ASSERT_FALSE(alice_result.ok()); alice->CalculateSharedKey(bob_public, &alice_shared,
diff --git a/quic/core/crypto/key_exchange.h b/quic/core/crypto/key_exchange.h index 84ca626..8970b62 100644 --- a/quic/core/crypto/key_exchange.h +++ b/quic/core/crypto/key_exchange.h
@@ -65,14 +65,14 @@ // (which is implicitly known by a KeyExchange object) and a public value // from the peer. virtual bool CalculateSharedKey(QuicStringPiece peer_public_value, - QuicString* shared_key) const = 0; + std::string* shared_key) const = 0; // CalculateSharedKey computes the shared key between the local private key // (which is may not be locally known to a KeyExchange object) and a public // value from the peer. // Callers should expect that |callback| might be invoked synchronously. virtual void CalculateSharedKey(QuicStringPiece peer_public_value, - QuicString* shared_key, + std::string* shared_key, std::unique_ptr<Callback> callback) const = 0; // public_value returns the local public key which can be sent to a peer in
diff --git a/quic/core/crypto/p256_key_exchange.cc b/quic/core/crypto/p256_key_exchange.cc index 2bfbd09..a53efe5 100644 --- a/quic/core/crypto/p256_key_exchange.cc +++ b/quic/core/crypto/p256_key_exchange.cc
@@ -26,7 +26,7 @@ std::unique_ptr<KeyExchange> Create(QuicRandom* /* rand */) const override { // TODO(agl): avoid the serialisation/deserialisation in this function. - const QuicString private_value = P256KeyExchange::NewPrivateKey(); + const std::string private_value = P256KeyExchange::NewPrivateKey(); return P256KeyExchange::New(private_value); } @@ -72,25 +72,25 @@ } // static -QuicString P256KeyExchange::NewPrivateKey() { +std::string P256KeyExchange::NewPrivateKey() { bssl::UniquePtr<EC_KEY> key(EC_KEY_new_by_curve_name(NID_X9_62_prime256v1)); if (!key.get() || !EC_KEY_generate_key(key.get())) { QUIC_DLOG(INFO) << "Can't generate a new private key."; - return QuicString(); + return std::string(); } int key_len = i2d_ECPrivateKey(key.get(), nullptr); if (key_len <= 0) { QUIC_DLOG(INFO) << "Can't convert private key to string"; - return QuicString(); + return std::string(); } std::unique_ptr<uint8_t[]> private_key(new uint8_t[key_len]); uint8_t* keyp = private_key.get(); if (!i2d_ECPrivateKey(key.get(), &keyp)) { QUIC_DLOG(INFO) << "Can't convert private key to string."; - return QuicString(); + return std::string(); } - return QuicString(reinterpret_cast<char*>(private_key.get()), key_len); + return std::string(reinterpret_cast<char*>(private_key.get()), key_len); } const KeyExchange::Factory& P256KeyExchange::GetFactory() const { @@ -99,7 +99,7 @@ } bool P256KeyExchange::CalculateSharedKey(QuicStringPiece peer_public_value, - QuicString* out_result) const { + std::string* out_result) const { if (peer_public_value.size() != kUncompressedP256PointBytes) { QUIC_DLOG(INFO) << "Peer public value is invalid"; return false; @@ -130,7 +130,7 @@ void P256KeyExchange::CalculateSharedKey( QuicStringPiece peer_public_value, - QuicString* shared_key, + std::string* shared_key, std::unique_ptr<Callback> callback) const { callback->Run(CalculateSharedKey(peer_public_value, shared_key)); }
diff --git a/quic/core/crypto/p256_key_exchange.h b/quic/core/crypto/p256_key_exchange.h index d70d9cc..04301e4 100644 --- a/quic/core/crypto/p256_key_exchange.h +++ b/quic/core/crypto/p256_key_exchange.h
@@ -29,14 +29,14 @@ // |NewPrivateKey| returns a private key, suitable for passing to |New|. // If |NewPrivateKey| can't generate a private key, it returns an empty // string. - static QuicString NewPrivateKey(); + static std::string NewPrivateKey(); // KeyExchange interface. const Factory& GetFactory() const override; bool CalculateSharedKey(QuicStringPiece peer_public_value, - QuicString* shared_key) const override; + std::string* shared_key) const override; void CalculateSharedKey(QuicStringPiece peer_public_value, - QuicString* shared_key, + std::string* shared_key, std::unique_ptr<Callback> callback) const override; QuicStringPiece public_value() const override;
diff --git a/quic/core/crypto/p256_key_exchange_test.cc b/quic/core/crypto/p256_key_exchange_test.cc index 5deee9d..32d6bf1 100644 --- a/quic/core/crypto/p256_key_exchange_test.cc +++ b/quic/core/crypto/p256_key_exchange_test.cc
@@ -43,8 +43,8 @@ // holds: that both parties end up with the same key. TEST_F(P256KeyExchangeTest, SharedKey) { for (int i = 0; i < 5; i++) { - QuicString alice_private(P256KeyExchange::NewPrivateKey()); - QuicString bob_private(P256KeyExchange::NewPrivateKey()); + std::string alice_private(P256KeyExchange::NewPrivateKey()); + std::string bob_private(P256KeyExchange::NewPrivateKey()); ASSERT_FALSE(alice_private.empty()); ASSERT_FALSE(bob_private.empty()); @@ -59,7 +59,7 @@ const QuicStringPiece alice_public(alice->public_value()); const QuicStringPiece bob_public(bob->public_value()); - QuicString alice_shared, bob_shared; + std::string alice_shared, bob_shared; ASSERT_TRUE(alice->CalculateSharedKey(bob_public, &alice_shared)); ASSERT_TRUE(bob->CalculateSharedKey(alice_public, &bob_shared)); ASSERT_EQ(alice_shared, bob_shared); @@ -70,8 +70,8 @@ // parties end up with the same key. TEST_F(P256KeyExchangeTest, AsyncSharedKey) { for (int i = 0; i < 5; i++) { - QuicString alice_private(P256KeyExchange::NewPrivateKey()); - QuicString bob_private(P256KeyExchange::NewPrivateKey()); + std::string alice_private(P256KeyExchange::NewPrivateKey()); + std::string bob_private(P256KeyExchange::NewPrivateKey()); ASSERT_FALSE(alice_private.empty()); ASSERT_FALSE(bob_private.empty()); @@ -86,7 +86,7 @@ const QuicStringPiece alice_public(alice->public_value()); const QuicStringPiece bob_public(bob->public_value()); - QuicString alice_shared, bob_shared; + std::string alice_shared, bob_shared; TestCallbackResult alice_result; ASSERT_FALSE(alice_result.ok()); alice->CalculateSharedKey(bob_public, &alice_shared,
diff --git a/quic/core/crypto/proof_source.cc b/quic/core/crypto/proof_source.cc index ce77d8b..4edb40d 100644 --- a/quic/core/crypto/proof_source.cc +++ b/quic/core/crypto/proof_source.cc
@@ -7,7 +7,7 @@ namespace quic { -ProofSource::Chain::Chain(const std::vector<QuicString>& certs) +ProofSource::Chain::Chain(const std::vector<std::string>& certs) : certs(certs) {} ProofSource::Chain::~Chain() {}
diff --git a/quic/core/crypto/proof_source.h b/quic/core/crypto/proof_source.h index 3fec32b..0f293be 100644 --- a/quic/core/crypto/proof_source.h +++ b/quic/core/crypto/proof_source.h
@@ -25,11 +25,11 @@ // Chain is a reference-counted wrapper for a vector of stringified // certificates. struct QUIC_EXPORT_PRIVATE Chain : public QuicReferenceCounted { - explicit Chain(const std::vector<QuicString>& certs); + explicit Chain(const std::vector<std::string>& certs); Chain(const Chain&) = delete; Chain& operator=(const Chain&) = delete; - const std::vector<QuicString> certs; + const std::vector<std::string> certs; protected: ~Chain() override; @@ -85,7 +85,7 @@ // // |signature| contains the signature of the data provided to // ComputeTlsSignature. Its value is undefined if |ok| is false. - virtual void Run(bool ok, QuicString signature) = 0; + virtual void Run(bool ok, std::string signature) = 0; private: SignatureCallback(const SignatureCallback&) = delete; @@ -113,8 +113,8 @@ // // Callers should expect that |callback| might be invoked synchronously. virtual void GetProof(const QuicSocketAddress& server_address, - const QuicString& hostname, - const QuicString& server_config, + const std::string& hostname, + const std::string& server_config, QuicTransportVersion transport_version, QuicStringPiece chlo_hash, std::unique_ptr<Callback> callback) = 0; @@ -122,7 +122,7 @@ // Returns the certificate chain for |hostname| in leaf-first order. virtual QuicReferenceCountedPointer<Chain> GetCertChain( const QuicSocketAddress& server_address, - const QuicString& hostname) = 0; + const std::string& hostname) = 0; // Computes a signature using the private key of the certificate for // |hostname|. The value in |in| is signed using the algorithm specified by @@ -134,7 +134,7 @@ // Callers should expect that |callback| might be invoked synchronously. virtual void ComputeTlsSignature( const QuicSocketAddress& server_address, - const QuicString& hostname, + const std::string& hostname, uint16_t signature_algorithm, QuicStringPiece in, std::unique_ptr<SignatureCallback> callback) = 0;
diff --git a/quic/core/crypto/proof_verifier.h b/quic/core/crypto/proof_verifier.h index 3219203..9178942 100644 --- a/quic/core/crypto/proof_verifier.h +++ b/quic/core/crypto/proof_verifier.h
@@ -48,7 +48,7 @@ // details of the verification. |Run| may take ownership of |details| by // calling |release| on it. virtual void Run(bool ok, - const QuicString& error_details, + const std::string& error_details, std::unique_ptr<ProofVerifyDetails>* details) = 0; }; @@ -75,16 +75,16 @@ // The signature uses SHA-256 as the hash function and PSS padding in the // case of RSA. virtual QuicAsyncStatus VerifyProof( - const QuicString& hostname, + const std::string& hostname, const uint16_t port, - const QuicString& server_config, + const std::string& server_config, QuicTransportVersion transport_version, QuicStringPiece chlo_hash, - const std::vector<QuicString>& certs, - const QuicString& cert_sct, - const QuicString& signature, + const std::vector<std::string>& certs, + const std::string& cert_sct, + const std::string& signature, const ProofVerifyContext* context, - QuicString* error_details, + std::string* error_details, std::unique_ptr<ProofVerifyDetails>* details, std::unique_ptr<ProofVerifierCallback> callback) = 0; @@ -101,10 +101,10 @@ // will call back, on the original thread, via |callback| when complete. // In this case, the ProofVerifier will take ownership of |callback|. virtual QuicAsyncStatus VerifyCertChain( - const QuicString& hostname, - const std::vector<QuicString>& certs, + const std::string& hostname, + const std::vector<std::string>& certs, const ProofVerifyContext* context, - QuicString* error_details, + std::string* error_details, std::unique_ptr<ProofVerifyDetails>* details, std::unique_ptr<ProofVerifierCallback> callback) = 0;
diff --git a/quic/core/crypto/quic_compressed_certs_cache.cc b/quic/core/crypto/quic_compressed_certs_cache.cc index 595ac31..e07e924 100644 --- a/quic/core/crypto/quic_compressed_certs_cache.cc +++ b/quic/core/crypto/quic_compressed_certs_cache.cc
@@ -26,8 +26,8 @@ QuicCompressedCertsCache::UncompressedCerts::UncompressedCerts( const QuicReferenceCountedPointer<ProofSource::Chain>& chain, - const QuicString* client_common_set_hashes, - const QuicString* client_cached_cert_hashes) + const std::string* client_common_set_hashes, + const std::string* client_cached_cert_hashes) : chain(chain), client_common_set_hashes(client_common_set_hashes), client_cached_cert_hashes(client_cached_cert_hashes) {} @@ -38,7 +38,7 @@ QuicCompressedCertsCache::CachedCerts::CachedCerts( const UncompressedCerts& uncompressed_certs, - const QuicString& compressed_cert) + const std::string& compressed_cert) : chain_(uncompressed_certs.chain), client_common_set_hashes_(*uncompressed_certs.client_common_set_hashes), client_cached_cert_hashes_(*uncompressed_certs.client_cached_cert_hashes), @@ -58,7 +58,7 @@ chain_ == uncompressed_certs.chain); } -const QuicString* QuicCompressedCertsCache::CachedCerts::compressed_cert() +const std::string* QuicCompressedCertsCache::CachedCerts::compressed_cert() const { return &compressed_cert_; } @@ -71,10 +71,10 @@ certs_cache_.Clear(); } -const QuicString* QuicCompressedCertsCache::GetCompressedCert( +const std::string* QuicCompressedCertsCache::GetCompressedCert( const QuicReferenceCountedPointer<ProofSource::Chain>& chain, - const QuicString& client_common_set_hashes, - const QuicString& client_cached_cert_hashes) { + const std::string& client_common_set_hashes, + const std::string& client_cached_cert_hashes) { UncompressedCerts uncompressed_certs(chain, &client_common_set_hashes, &client_cached_cert_hashes); @@ -90,9 +90,9 @@ void QuicCompressedCertsCache::Insert( const QuicReferenceCountedPointer<ProofSource::Chain>& chain, - const QuicString& client_common_set_hashes, - const QuicString& client_cached_cert_hashes, - const QuicString& compressed_cert) { + const std::string& client_common_set_hashes, + const std::string& client_cached_cert_hashes, + const std::string& compressed_cert) { UncompressedCerts uncompressed_certs(chain, &client_common_set_hashes, &client_cached_cert_hashes); @@ -115,9 +115,9 @@ uint64_t QuicCompressedCertsCache::ComputeUncompressedCertsHash( const UncompressedCerts& uncompressed_certs) { uint64_t hash = - std::hash<QuicString>()(*uncompressed_certs.client_common_set_hashes); + std::hash<std::string>()(*uncompressed_certs.client_common_set_hashes); uint64_t h = - std::hash<QuicString>()(*uncompressed_certs.client_cached_cert_hashes); + std::hash<std::string>()(*uncompressed_certs.client_cached_cert_hashes); hash_combine(&hash, h); hash_combine(&hash,
diff --git a/quic/core/crypto/quic_compressed_certs_cache.h b/quic/core/crypto/quic_compressed_certs_cache.h index 418bdb9..340542a 100644 --- a/quic/core/crypto/quic_compressed_certs_cache.h +++ b/quic/core/crypto/quic_compressed_certs_cache.h
@@ -24,10 +24,10 @@ // |chain, client_common_set_hashes, client_cached_cert_hashes| hits cache. // Otherwise, return nullptr. // Returned pointer might become invalid on the next call to Insert(). - const QuicString* GetCompressedCert( + const std::string* GetCompressedCert( const QuicReferenceCountedPointer<ProofSource::Chain>& chain, - const QuicString& client_common_set_hashes, - const QuicString& client_cached_cert_hashes); + const std::string& client_common_set_hashes, + const std::string& client_cached_cert_hashes); // Inserts the specified // |chain, client_common_set_hashes, @@ -35,9 +35,9 @@ // If the insertion causes the cache to become overfull, entries will // be deleted in an LRU order to make room. void Insert(const QuicReferenceCountedPointer<ProofSource::Chain>& chain, - const QuicString& client_common_set_hashes, - const QuicString& client_cached_cert_hashes, - const QuicString& compressed_cert); + const std::string& client_common_set_hashes, + const std::string& client_cached_cert_hashes, + const std::string& compressed_cert); // Returns max number of cache entries the cache can carry. size_t MaxSize(); @@ -56,13 +56,13 @@ UncompressedCerts(); UncompressedCerts( const QuicReferenceCountedPointer<ProofSource::Chain>& chain, - const QuicString* client_common_set_hashes, - const QuicString* client_cached_cert_hashes); + const std::string* client_common_set_hashes, + const std::string* client_cached_cert_hashes); ~UncompressedCerts(); const QuicReferenceCountedPointer<ProofSource::Chain> chain; - const QuicString* client_common_set_hashes; - const QuicString* client_cached_cert_hashes; + const std::string* client_common_set_hashes; + const std::string* client_cached_cert_hashes; }; // Certs stored by QuicCompressedCertsCache where uncompressed certs data is @@ -72,7 +72,7 @@ public: CachedCerts(); CachedCerts(const UncompressedCerts& uncompressed_certs, - const QuicString& compressed_cert); + const std::string& compressed_cert); CachedCerts(const CachedCerts& other); ~CachedCerts(); @@ -81,16 +81,16 @@ bool MatchesUncompressedCerts( const UncompressedCerts& uncompressed_certs) const; - const QuicString* compressed_cert() const; + const std::string* compressed_cert() const; private: // Uncompressed certs data. QuicReferenceCountedPointer<ProofSource::Chain> chain_; - const QuicString client_common_set_hashes_; - const QuicString client_cached_cert_hashes_; + const std::string client_common_set_hashes_; + const std::string client_cached_cert_hashes_; // Cached compressed representation derived from uncompressed certs. - const QuicString compressed_cert_; + const std::string compressed_cert_; }; // Computes a uint64_t hash for |uncompressed_certs|.
diff --git a/quic/core/crypto/quic_compressed_certs_cache_test.cc b/quic/core/crypto/quic_compressed_certs_cache_test.cc index 432a8c0..788f1d7 100644 --- a/quic/core/crypto/quic_compressed_certs_cache_test.cc +++ b/quic/core/crypto/quic_compressed_certs_cache_test.cc
@@ -27,31 +27,31 @@ }; TEST_F(QuicCompressedCertsCacheTest, CacheHit) { - std::vector<QuicString> certs = {"leaf cert", "intermediate cert", - "root cert"}; + std::vector<std::string> certs = {"leaf cert", "intermediate cert", + "root cert"}; QuicReferenceCountedPointer<ProofSource::Chain> chain( new ProofSource::Chain(certs)); - QuicString common_certs = "common certs"; - QuicString cached_certs = "cached certs"; - QuicString compressed = "compressed cert"; + std::string common_certs = "common certs"; + std::string cached_certs = "cached certs"; + std::string compressed = "compressed cert"; certs_cache_.Insert(chain, common_certs, cached_certs, compressed); - const QuicString* cached_value = + const std::string* cached_value = certs_cache_.GetCompressedCert(chain, common_certs, cached_certs); ASSERT_NE(nullptr, cached_value); EXPECT_EQ(*cached_value, compressed); } TEST_F(QuicCompressedCertsCacheTest, CacheMiss) { - std::vector<QuicString> certs = {"leaf cert", "intermediate cert", - "root cert"}; + std::vector<std::string> certs = {"leaf cert", "intermediate cert", + "root cert"}; QuicReferenceCountedPointer<ProofSource::Chain> chain( new ProofSource::Chain(certs)); - QuicString common_certs = "common certs"; - QuicString cached_certs = "cached certs"; - QuicString compressed = "compressed cert"; + std::string common_certs = "common certs"; + std::string cached_certs = "cached certs"; + std::string compressed = "compressed cert"; certs_cache_.Insert(chain, common_certs, cached_certs, compressed); @@ -70,14 +70,14 @@ TEST_F(QuicCompressedCertsCacheTest, CacheMissDueToEviction) { // Test cache returns a miss when a queried uncompressed certs was cached but // then evicted. - std::vector<QuicString> certs = {"leaf cert", "intermediate cert", - "root cert"}; + std::vector<std::string> certs = {"leaf cert", "intermediate cert", + "root cert"}; QuicReferenceCountedPointer<ProofSource::Chain> chain( new ProofSource::Chain(certs)); - QuicString common_certs = "common certs"; - QuicString cached_certs = "cached certs"; - QuicString compressed = "compressed cert"; + std::string common_certs = "common certs"; + std::string cached_certs = "cached certs"; + std::string compressed = "compressed cert"; certs_cache_.Insert(chain, common_certs, cached_certs, compressed); // Insert another kQuicCompressedCertsCacheSize certs to evict the first
diff --git a/quic/core/crypto/quic_crypto_client_config.cc b/quic/core/crypto/quic_crypto_client_config.cc index 0bf1b41..8d34173 100644 --- a/quic/core/crypto/quic_crypto_client_config.cc +++ b/quic/core/crypto/quic_crypto_client_config.cc
@@ -138,7 +138,7 @@ } void QuicCryptoClientConfig::CachedState::add_server_nonce( - const QuicString& server_nonce) { + const std::string& server_nonce) { server_nonces_.push(server_nonce); } @@ -151,7 +151,7 @@ QuicStringPiece server_config, QuicWallTime now, QuicWallTime expiry_time, - QuicString* error_details) { + std::string* error_details) { const bool matches_existing = server_config == server_config_; // Even if the new server config matches the existing one, we still wish to @@ -188,7 +188,7 @@ } if (!matches_existing) { - server_config_ = QuicString(server_config); + server_config_ = std::string(server_config); SetProofInvalid(); scfg_ = std::move(new_scfg_storage); } @@ -205,7 +205,7 @@ } void QuicCryptoClientConfig::CachedState::SetProof( - const std::vector<QuicString>& certs, + const std::vector<std::string>& certs, QuicStringPiece cert_sct, QuicStringPiece chlo_hash, QuicStringPiece signature) { @@ -228,9 +228,9 @@ // If the proof has changed then it needs to be revalidated. SetProofInvalid(); certs_ = certs; - cert_sct_ = QuicString(cert_sct); - chlo_hash_ = QuicString(chlo_hash); - server_config_sig_ = QuicString(signature); + cert_sct_ = std::string(cert_sct); + chlo_hash_ = std::string(chlo_hash); + server_config_sig_ = std::string(signature); } void QuicCryptoClientConfig::CachedState::Clear() { @@ -269,8 +269,8 @@ bool QuicCryptoClientConfig::CachedState::Initialize( QuicStringPiece server_config, QuicStringPiece source_address_token, - const std::vector<QuicString>& certs, - const QuicString& cert_sct, + const std::vector<std::string>& certs, + const std::string& cert_sct, QuicStringPiece chlo_hash, QuicStringPiece signature, QuicWallTime now, @@ -282,7 +282,7 @@ return false; } - QuicString error_details; + std::string error_details; ServerConfigState state = SetServerConfig(server_config, now, expiration_time, &error_details); RecordDiskCacheServerConfigState(state); @@ -300,29 +300,29 @@ return true; } -const QuicString& QuicCryptoClientConfig::CachedState::server_config() const { +const std::string& QuicCryptoClientConfig::CachedState::server_config() const { return server_config_; } -const QuicString& QuicCryptoClientConfig::CachedState::source_address_token() +const std::string& QuicCryptoClientConfig::CachedState::source_address_token() const { return source_address_token_; } -const std::vector<QuicString>& QuicCryptoClientConfig::CachedState::certs() +const std::vector<std::string>& QuicCryptoClientConfig::CachedState::certs() const { return certs_; } -const QuicString& QuicCryptoClientConfig::CachedState::cert_sct() const { +const std::string& QuicCryptoClientConfig::CachedState::cert_sct() const { return cert_sct_; } -const QuicString& QuicCryptoClientConfig::CachedState::chlo_hash() const { +const std::string& QuicCryptoClientConfig::CachedState::chlo_hash() const { return chlo_hash_; } -const QuicString& QuicCryptoClientConfig::CachedState::signature() const { +const std::string& QuicCryptoClientConfig::CachedState::signature() const { return server_config_sig_; } @@ -341,12 +341,12 @@ void QuicCryptoClientConfig::CachedState::set_source_address_token( QuicStringPiece token) { - source_address_token_ = QuicString(token); + source_address_token_ = std::string(token); } void QuicCryptoClientConfig::CachedState::set_cert_sct( QuicStringPiece cert_sct) { - cert_sct_ = QuicString(cert_sct); + cert_sct_ = std::string(cert_sct); } void QuicCryptoClientConfig::CachedState::SetProofVerifyDetails( @@ -385,13 +385,13 @@ return next_id; } -QuicString QuicCryptoClientConfig::CachedState::GetNextServerNonce() { +std::string QuicCryptoClientConfig::CachedState::GetNextServerNonce() { if (server_nonces_.empty()) { QUIC_BUG << "Attempting to consume a server nonce that was never designated."; return ""; } - const QuicString server_nonce = server_nonces_.front(); + const std::string server_nonce = server_nonces_.front(); server_nonces_.pop(); return server_nonce; } @@ -494,7 +494,7 @@ out->SetStringPiece(kCertificateSCTTag, ""); - const std::vector<QuicString>& certs = cached->certs(); + const std::vector<std::string>& certs = cached->certs(); // We save |certs| in the QuicCryptoNegotiatedParameters so that, if the // client config is being used for multiple connections, another connection // doesn't update the cached certificates and cause us to be unable to @@ -520,7 +520,7 @@ const ChannelIDKey* channel_id_key, QuicReferenceCountedPointer<QuicCryptoNegotiatedParameters> out_params, CryptoHandshakeMessage* out, - QuicString* error_details) const { + std::string* error_details) const { DCHECK(error_details != nullptr); QUIC_BUG_IF(!QuicUtils::IsConnectionIdValidForVersion( connection_id, preferred_version.transport_version)) @@ -636,7 +636,7 @@ } out->SetStringPiece(kPUBS, out_params->client_key_exchange->public_value()); - const std::vector<QuicString>& certs = cached->certs(); + const std::vector<std::string>& certs = cached->certs(); if (certs.empty()) { *error_details = "No certs to calculate XLCT"; return QUIC_CRYPTO_INTERNAL_ERROR; @@ -653,17 +653,17 @@ CryptoHandshakeMessage cetv; cetv.set_tag(kCETV); - QuicString hkdf_input; + std::string hkdf_input; const QuicData& client_hello_serialized = out->GetSerialized(); hkdf_input.append(QuicCryptoConfig::kCETVLabel, strlen(QuicCryptoConfig::kCETVLabel) + 1); - hkdf_input.append(connection_id.data(), connection_id.length()); + hkdf_input.append(connection_id.data(), connection_id.length()); hkdf_input.append(client_hello_serialized.data(), client_hello_serialized.length()); hkdf_input.append(cached->server_config()); - QuicString key = channel_id_key->SerializeKey(); - QuicString signature; + std::string key = channel_id_key->SerializeKey(); + std::string signature; if (!channel_id_key->Sign(hkdf_input, &signature)) { *error_details = "Channel ID signature failed"; return QUIC_INVALID_CHANNEL_ID_SIGNATURE; @@ -707,8 +707,8 @@ // out_params->hkdf_input_suffix // out_params->initial_crypters out_params->hkdf_input_suffix.clear(); - out_params->hkdf_input_suffix.append(connection_id.data(), - connection_id.length()); + out_params->hkdf_input_suffix.append(connection_id.data(), + connection_id.length()); const QuicData& client_hello_serialized = out->GetSerialized(); out_params->hkdf_input_suffix.append(client_hello_serialized.data(), client_hello_serialized.length()); @@ -719,13 +719,13 @@ } out_params->hkdf_input_suffix.append(certs[0]); - QuicString hkdf_input; + std::string hkdf_input; const size_t label_len = strlen(QuicCryptoConfig::kInitialLabel) + 1; hkdf_input.reserve(label_len + out_params->hkdf_input_suffix.size()); hkdf_input.append(QuicCryptoConfig::kInitialLabel, label_len); hkdf_input.append(out_params->hkdf_input_suffix); - QuicString* subkey_secret = &out_params->initial_subkey_secret; + std::string* subkey_secret = &out_params->initial_subkey_secret; if (!CryptoUtils::DeriveKeys(out_params->initial_premaster_secret, out_params->aead, out_params->client_nonce, @@ -745,9 +745,9 @@ QuicWallTime now, QuicTransportVersion version, QuicStringPiece chlo_hash, - const std::vector<QuicString>& cached_certs, + const std::vector<std::string>& cached_certs, CachedState* cached, - QuicString* error_details) { + std::string* error_details) { DCHECK(error_details != nullptr); QuicStringPiece scfg; @@ -784,7 +784,7 @@ bool has_proof = message.GetStringPiece(kPROF, &proof); bool has_cert = message.GetStringPiece(kCertificateTag, &cert_bytes); if (has_proof && has_cert) { - std::vector<QuicString> certs; + std::vector<std::string> certs; if (!CertCompressor::DecompressChain(cert_bytes, cached_certs, common_cert_sets, &certs)) { *error_details = "Certificate data invalid"; @@ -819,7 +819,7 @@ QuicStringPiece chlo_hash, CachedState* cached, QuicReferenceCountedPointer<QuicCryptoNegotiatedParameters> out_params, - QuicString* error_details) { + std::string* error_details) { DCHECK(error_details != nullptr); if ((rej.tag() != kREJ) && (rej.tag() != kSREJ)) { @@ -836,29 +836,29 @@ QuicStringPiece nonce; if (rej.GetStringPiece(kServerNonceTag, &nonce)) { - out_params->server_nonce = QuicString(nonce); + out_params->server_nonce = std::string(nonce); } if (rej.tag() == kSREJ) { QuicConnectionId connection_id; - QuicStringPiece connection_id_bytes; - if (!rej.GetStringPiece(kRCID, &connection_id_bytes)) { - *error_details = "Missing kRCID"; - return QUIC_CRYPTO_MESSAGE_PARAMETER_NOT_FOUND; - } - connection_id = QuicConnectionId(connection_id_bytes.data(), - connection_id_bytes.length()); - if (!QuicUtils::IsConnectionIdValidForVersion(connection_id, version)) { - QUIC_PEER_BUG << "Received server-designated connection ID " - << connection_id << " which is invalid with version " - << QuicVersionToString(version); - *error_details = "Bad kRCID length"; - return QUIC_CRYPTO_INTERNAL_ERROR; - } + QuicStringPiece connection_id_bytes; + if (!rej.GetStringPiece(kRCID, &connection_id_bytes)) { + *error_details = "Missing kRCID"; + return QUIC_CRYPTO_MESSAGE_PARAMETER_NOT_FOUND; + } + connection_id = QuicConnectionId(connection_id_bytes.data(), + connection_id_bytes.length()); + if (!QuicUtils::IsConnectionIdValidForVersion(connection_id, version)) { + QUIC_PEER_BUG << "Received server-designated connection ID " + << connection_id << " which is invalid with version " + << QuicVersionToString(version); + *error_details = "Bad kRCID length"; + return QUIC_CRYPTO_INTERNAL_ERROR; + } cached->add_server_designated_connection_id(connection_id); if (!nonce.empty()) { - cached->add_server_nonce(QuicString(nonce)); + cached->add_server_nonce(std::string(nonce)); } return QUIC_NO_ERROR; } @@ -873,7 +873,7 @@ const ParsedQuicVersionVector& negotiated_versions, CachedState* cached, QuicReferenceCountedPointer<QuicCryptoNegotiatedParameters> out_params, - QuicString* error_details) { + std::string* error_details) { DCHECK(error_details != nullptr); QuicErrorCode valid = CryptoUtils::ValidateServerHello( @@ -909,7 +909,7 @@ return QUIC_INVALID_CRYPTO_MESSAGE_PARAMETER; } - QuicString hkdf_input; + std::string hkdf_input; const size_t label_len = strlen(QuicCryptoConfig::kForwardSecureLabel) + 1; hkdf_input.reserve(label_len + out_params->hkdf_input_suffix.size()); hkdf_input.append(QuicCryptoConfig::kForwardSecureLabel, label_len); @@ -936,7 +936,7 @@ QuicStringPiece chlo_hash, CachedState* cached, QuicReferenceCountedPointer<QuicCryptoNegotiatedParameters> out_params, - QuicString* error_details) { + std::string* error_details) { DCHECK(error_details != nullptr); if (server_config_update.tag() != kSCUP) { @@ -976,7 +976,7 @@ cached->InitializeFrom(*canonical_cached); } -void QuicCryptoClientConfig::AddCanonicalSuffix(const QuicString& suffix) { +void QuicCryptoClientConfig::AddCanonicalSuffix(const std::string& suffix) { canonical_suffixes_.push_back(suffix); }
diff --git a/quic/core/crypto/quic_crypto_client_config.h b/quic/core/crypto/quic_crypto_client_config.h index 32df726..4c2004d 100644 --- a/quic/core/crypto/quic_crypto_client_config.h +++ b/quic/core/crypto/quic_crypto_client_config.h
@@ -82,13 +82,13 @@ ServerConfigState SetServerConfig(QuicStringPiece server_config, QuicWallTime now, QuicWallTime expiry_time, - QuicString* error_details); + std::string* error_details); // InvalidateServerConfig clears the cached server config (if any). void InvalidateServerConfig(); // SetProof stores a cert chain, cert signed timestamp and signature. - void SetProof(const std::vector<QuicString>& certs, + void SetProof(const std::vector<std::string>& certs, QuicStringPiece cert_sct, QuicStringPiece chlo_hash, QuicStringPiece signature); @@ -109,12 +109,12 @@ // generation_counter_ in sync. void SetProofInvalid(); - const QuicString& server_config() const; - const QuicString& source_address_token() const; - const std::vector<QuicString>& certs() const; - const QuicString& cert_sct() const; - const QuicString& chlo_hash() const; - const QuicString& signature() const; + const std::string& server_config() const; + const std::string& source_address_token() const; + const std::vector<std::string>& certs() const; + const std::string& cert_sct() const; + const std::string& chlo_hash() const; + const std::string& signature() const; bool proof_valid() const; uint64_t generation_counter() const; const ProofVerifyDetails* proof_verify_details() const; @@ -138,7 +138,7 @@ QuicConnectionId GetNextServerDesignatedConnectionId(); // Adds the servernonce to the queue of server nonces. - void add_server_nonce(const QuicString& server_nonce); + void add_server_nonce(const std::string& server_nonce); // If true, the crypto config contains at least one server nonce, and the // client should use one of these nonces. @@ -147,7 +147,7 @@ // This function should only be called when has_server_nonce is true. // Returns the next server_nonce specified by the server and removes it // from the queue of nonces. - QuicString GetNextServerNonce(); + std::string GetNextServerNonce(); // SetProofVerifyDetails takes ownership of |details|. void SetProofVerifyDetails(ProofVerifyDetails* details); @@ -162,22 +162,22 @@ // Returns false if there is a problem parsing the server config. bool Initialize(QuicStringPiece server_config, QuicStringPiece source_address_token, - const std::vector<QuicString>& certs, - const QuicString& cert_sct, + const std::vector<std::string>& certs, + const std::string& cert_sct, QuicStringPiece chlo_hash, QuicStringPiece signature, QuicWallTime now, QuicWallTime expiration_time); private: - QuicString server_config_; // A serialized handshake message. - QuicString source_address_token_; // An opaque proof of IP ownership. - std::vector<QuicString> certs_; // A list of certificates in leaf-first - // order. - QuicString cert_sct_; // Signed timestamp of the leaf cert. - QuicString chlo_hash_; // Hash of the CHLO message. - QuicString server_config_sig_; // A signature of |server_config_|. - bool server_config_valid_; // True if |server_config_| is correctly + std::string server_config_; // A serialized handshake message. + std::string source_address_token_; // An opaque proof of IP ownership. + std::vector<std::string> certs_; // A list of certificates in leaf-first + // order. + std::string cert_sct_; // Signed timestamp of the leaf cert. + std::string chlo_hash_; // Hash of the CHLO message. + std::string server_config_sig_; // A signature of |server_config_|. + bool server_config_valid_; // True if |server_config_| is correctly // signed and |certs_| has been validated. QuicWallTime expiration_time_; // Time when the config is no longer valid. // Generation counter associated with the |server_config_|, |certs_| and @@ -194,7 +194,7 @@ // that no connection-id is added twice. Also, consider keeping the server // nonces and connection_ids together in one queue. QuicQueue<QuicConnectionId> server_designated_connection_ids_; - QuicQueue<QuicString> server_nonces_; + QuicQueue<std::string> server_nonces_; }; // Used to filter server ids for partial config deletion. @@ -262,7 +262,7 @@ const ChannelIDKey* channel_id_key, QuicReferenceCountedPointer<QuicCryptoNegotiatedParameters> out_params, CryptoHandshakeMessage* out, - QuicString* error_details) const; + std::string* error_details) const; // ProcessRejection processes a REJ message from a server and updates the // cached information about that server. After this, |IsComplete| may return @@ -277,7 +277,7 @@ QuicStringPiece chlo_hash, CachedState* cached, QuicReferenceCountedPointer<QuicCryptoNegotiatedParameters> out_params, - QuicString* error_details); + std::string* error_details); // ProcessServerHello processes the message in |server_hello|, updates the // cached information about that server, writes the negotiated parameters to @@ -295,7 +295,7 @@ const ParsedQuicVersionVector& negotiated_versions, CachedState* cached, QuicReferenceCountedPointer<QuicCryptoNegotiatedParameters> out_params, - QuicString* error_details); + std::string* error_details); // Processes the message in |server_update|, updating the cached source // address token, and server config. @@ -309,7 +309,7 @@ QuicStringPiece chlo_hash, CachedState* cached, QuicReferenceCountedPointer<QuicCryptoNegotiatedParameters> out_params, - QuicString* error_details); + std::string* error_details); ProofVerifier* proof_verifier() const; @@ -334,22 +334,22 @@ // is expected to be shared among servers with the domain suffix. If a server // matches this suffix, then the server config from another server with the // suffix will be used to initialize the cached state for this server. - void AddCanonicalSuffix(const QuicString& suffix); + void AddCanonicalSuffix(const std::string& suffix); // Saves the |user_agent_id| that will be passed in QUIC's CHLO message. - void set_user_agent_id(const QuicString& user_agent_id) { + void set_user_agent_id(const std::string& user_agent_id) { user_agent_id_ = user_agent_id; } // Returns the user_agent_id that will be provided in the client hello // handshake message. - const QuicString& user_agent_id() const { return user_agent_id_; } + const std::string& user_agent_id() const { return user_agent_id_; } // Saves the |alpn| that will be passed in QUIC's CHLO message. - void set_alpn(const QuicString& alpn) { alpn_ = alpn; } + void set_alpn(const std::string& alpn) { alpn_ = alpn; } void set_pre_shared_key(QuicStringPiece psk) { - pre_shared_key_ = QuicString(psk); + pre_shared_key_ = std::string(psk); } bool pad_inchoate_hello() const { return pad_inchoate_hello_; } @@ -373,9 +373,9 @@ QuicWallTime now, QuicTransportVersion version, QuicStringPiece chlo_hash, - const std::vector<QuicString>& cached_certs, + const std::vector<std::string>& cached_certs, CachedState* cached, - QuicString* error_details); + std::string* error_details); // If the suffix of the hostname in |server_id| is in |canonical_suffixes_|, // then populate |cached| with the canonical cached state from @@ -396,21 +396,21 @@ // Contains list of suffixes (for exmaple ".c.youtube.com", // ".googlevideo.com") of canonical hostnames. - std::vector<QuicString> canonical_suffixes_; + std::vector<std::string> canonical_suffixes_; std::unique_ptr<ProofVerifier> proof_verifier_; std::unique_ptr<ChannelIDSource> channel_id_source_; bssl::UniquePtr<SSL_CTX> ssl_ctx_; // The |user_agent_id_| passed in QUIC's CHLO message. - QuicString user_agent_id_; + std::string user_agent_id_; // The |alpn_| passed in QUIC's CHLO message. - QuicString alpn_; + std::string alpn_; // If non-empty, the client will operate in the pre-shared key mode by // incorporating |pre_shared_key_| into the key schedule. - QuicString pre_shared_key_; + std::string pre_shared_key_; // In QUIC, technically, client hello should be fully padded. // However, fully padding on slow network connection (e.g. 50kbps) can add
diff --git a/quic/core/crypto/quic_crypto_client_config_test.cc b/quic/core/crypto/quic_crypto_client_config_test.cc index 5e0ca6e..097f455 100644 --- a/quic/core/crypto/quic_crypto_client_config_test.cc +++ b/quic/core/crypto/quic_crypto_client_config_test.cc
@@ -124,7 +124,7 @@ QuicCryptoClientConfig::CachedState state; EXPECT_FALSE(state.has_server_nonce()); - QuicString server_nonce = "nonce_1"; + std::string server_nonce = "nonce_1"; state.add_server_nonce(server_nonce); EXPECT_TRUE(state.has_server_nonce()); EXPECT_EQ(server_nonce, state.GetNextServerNonce()); @@ -142,8 +142,8 @@ EXPECT_FALSE(state.has_server_nonce()); // Test FIFO behavior. - const QuicString first_nonce = "first_nonce"; - const QuicString second_nonce = "second_nonce"; + const std::string first_nonce = "first_nonce"; + const std::string second_nonce = "second_nonce"; state.add_server_nonce(first_nonce); state.add_server_nonce(second_nonce); EXPECT_TRUE(state.has_server_nonce()); @@ -194,7 +194,7 @@ EXPECT_EQ(CreateQuicVersionLabel(QuicVersionMax()), cver); QuicStringPiece proof_nonce; EXPECT_TRUE(msg.GetStringPiece(kNONP, &proof_nonce)); - EXPECT_EQ(QuicString(32, 'r'), proof_nonce); + EXPECT_EQ(std::string(32, 'r'), proof_nonce); QuicStringPiece user_agent_id; EXPECT_TRUE(msg.GetStringPiece(kUAID, &user_agent_id)); EXPECT_EQ("quic-tester", user_agent_id); @@ -261,7 +261,7 @@ CryptoHandshakeMessage scfg; scfg.set_tag(kSCFG); scfg.SetStringPiece(kSCID, "12345678"); - QuicString details; + std::string details; QuicWallTime now = QuicWallTime::FromUNIXSeconds(1); QuicWallTime expiry = QuicWallTime::FromUNIXSeconds(2); state.SetServerConfig(scfg.GetSerialized().AsStringPiece(), now, expiry, @@ -289,7 +289,7 @@ uint64_t future = 1; scfg.SetValue(kEXPY, future); scfg.SetStringPiece(kSCID, "12345678"); - QuicString details; + std::string details; state.SetServerConfig(scfg.GetSerialized().AsStringPiece(), QuicWallTime::FromUNIXSeconds(1), QuicWallTime::FromUNIXSeconds(0), &details); @@ -316,7 +316,7 @@ QuicReferenceCountedPointer<QuicCryptoNegotiatedParameters> params( new QuicCryptoNegotiatedParameters); QuicConnectionId kConnectionId = TestConnectionId(1234); - QuicString error_details; + std::string error_details; MockRandom rand; CryptoHandshakeMessage chlo; QuicServerId server_id("www.google.com", 443, false); @@ -339,7 +339,7 @@ QuicReferenceCountedPointer<QuicCryptoNegotiatedParameters> params( new QuicCryptoNegotiatedParameters); QuicConnectionId kConnectionId = TestConnectionId(1234); - QuicString error_details; + std::string error_details; MockRandom rand; CryptoHandshakeMessage chlo; QuicServerId server_id("www.google.com", 443, false); @@ -374,7 +374,7 @@ QuicCryptoClientConfig::CachedState cached; QuicReferenceCountedPointer<QuicCryptoNegotiatedParameters> out_params( new QuicCryptoNegotiatedParameters); - QuicString error; + std::string error; QuicCryptoClientConfig config(crypto_test_utils::ProofVerifierForTesting(), TlsClientHandshaker::CreateSslCtx()); EXPECT_EQ(QUIC_VERSION_NEGOTIATION_MISMATCH, @@ -452,7 +452,7 @@ // Create two states on different origins. struct TestCase { - TestCase(const QuicString& host, QuicCryptoClientConfig* config) + TestCase(const std::string& host, QuicCryptoClientConfig* config) : server_id(host, 443, false), state(config->LookupOrCreate(server_id)) { // TODO(rch): Populate other fields of |state|. @@ -461,12 +461,12 @@ uint64_t future = 1; scfg.SetValue(kEXPY, future); scfg.SetStringPiece(kSCID, "12345678"); - QuicString details; + std::string details; state->SetServerConfig(scfg.GetSerialized().AsStringPiece(), QuicWallTime::FromUNIXSeconds(0), QuicWallTime::FromUNIXSeconds(future), &details); - std::vector<QuicString> certs(1); + std::vector<std::string> certs(1); certs[0] = "Hello Cert for " + host; state->SetProof(certs, "cert_sct", "chlo_hash", "signature"); state->set_source_address_token("TOKEN"); @@ -542,7 +542,7 @@ QuicCryptoClientConfig::CachedState cached; QuicReferenceCountedPointer<QuicCryptoNegotiatedParameters> out_params( new QuicCryptoNegotiatedParameters); - QuicString error; + std::string error; QuicCryptoClientConfig config(crypto_test_utils::ProofVerifierForTesting(), TlsClientHandshaker::CreateSslCtx()); EXPECT_EQ(QUIC_NO_ERROR, @@ -564,7 +564,7 @@ QuicCryptoClientConfig::CachedState cached; QuicReferenceCountedPointer<QuicCryptoNegotiatedParameters> out_params( new QuicCryptoNegotiatedParameters); - QuicString error; + std::string error; QuicCryptoClientConfig config(crypto_test_utils::ProofVerifierForTesting(), TlsClientHandshaker::CreateSslCtx()); EXPECT_EQ(QUIC_NO_ERROR, @@ -584,7 +584,7 @@ CryptoHandshakeMessage rej; crypto_test_utils::FillInDummyReject(&rej, /* stateless */ true); const QuicConnectionId kConnectionId = TestConnectionId(0xdeadbeef); - const QuicString server_nonce = "SERVER_NONCE"; + const std::string server_nonce = "SERVER_NONCE"; const uint64_t kConnectionId64 = TestConnectionIdToUInt64(kConnectionId); rej.SetValue(kRCID, kConnectionId64); rej.SetStringPiece(kServerNonceTag, server_nonce); @@ -593,7 +593,7 @@ QuicCryptoClientConfig::CachedState cached; QuicReferenceCountedPointer<QuicCryptoNegotiatedParameters> out_params( new QuicCryptoNegotiatedParameters); - QuicString error; + std::string error; QuicCryptoClientConfig config(crypto_test_utils::ProofVerifierForTesting(), TlsClientHandshaker::CreateSslCtx()); EXPECT_EQ(QUIC_NO_ERROR, @@ -617,7 +617,7 @@ QuicCryptoClientConfig::CachedState cached; QuicReferenceCountedPointer<QuicCryptoNegotiatedParameters> out_params( new QuicCryptoNegotiatedParameters); - QuicString error; + std::string error; QuicCryptoClientConfig config(crypto_test_utils::ProofVerifierForTesting(), TlsClientHandshaker::CreateSslCtx()); EXPECT_EQ(QUIC_CRYPTO_MESSAGE_PARAMETER_NOT_FOUND, @@ -643,7 +643,7 @@ QuicCryptoClientConfig::CachedState cached; QuicReferenceCountedPointer<QuicCryptoNegotiatedParameters> out_params( new QuicCryptoNegotiatedParameters); - QuicString error_details; + std::string error_details; EXPECT_EQ(QUIC_INVALID_CRYPTO_MESSAGE_PARAMETER, config.ProcessServerHello(msg, EmptyQuicConnectionId(), version, supported_versions, &cached, out_params,
diff --git a/quic/core/crypto/quic_crypto_proof.h b/quic/core/crypto/quic_crypto_proof.h index d70ad50..88255dc 100644 --- a/quic/core/crypto/quic_crypto_proof.h +++ b/quic/core/crypto/quic_crypto_proof.h
@@ -15,9 +15,9 @@ QuicCryptoProof(); // Signature generated by ProofSource - QuicString signature; + std::string signature; // SCTList (RFC6962) to be sent to the client, if it supports receiving it. - QuicString leaf_cert_scts; + std::string leaf_cert_scts; // Should the Expect-CT header be sent on the connection where the // certificate is used. bool send_expect_ct_header;
diff --git a/quic/core/crypto/quic_crypto_server_config.cc b/quic/core/crypto/quic_crypto_server_config.cc index 1cb0266..2b54c73 100644 --- a/quic/core/crypto/quic_crypto_server_config.cc +++ b/quic/core/crypto/quic_crypto_server_config.cc
@@ -60,13 +60,13 @@ const int kMaxTokenAddresses = 4; -QuicString DeriveSourceAddressTokenKey( +std::string DeriveSourceAddressTokenKey( QuicStringPiece source_address_token_secret) { QuicHKDF hkdf(source_address_token_secret, QuicStringPiece() /* no salt */, "QUIC source address token key", CryptoSecretBoxer::GetKeySize(), 0 /* no fixed IV needed */, 0 /* no subkey secret */); - return QuicString(hkdf.server_write_key()); + return std::string(hkdf.server_write_key()); } // Default source for creating KeyExchange objects. @@ -75,7 +75,7 @@ DefaultKeyExchangeSource() = default; ~DefaultKeyExchangeSource() override = default; - std::unique_ptr<KeyExchange> Create(QuicString /*server_config_id*/, + std::unique_ptr<KeyExchange> Create(std::string /*server_config_id*/, QuicTag type, QuicStringPiece private_key) override { if (private_key.empty()) { @@ -237,7 +237,7 @@ server_nonce_entropy->RandBytes(key_bytes.get(), key_size); server_nonce_boxer_.SetKeys( - {QuicString(reinterpret_cast<char*>(key_bytes.get()), key_size)}); + {std::string(reinterpret_cast<char*>(key_bytes.get()), key_size)}); } QuicCryptoServerConfig::~QuicCryptoServerConfig() {} @@ -249,13 +249,13 @@ const ConfigOptions& options) { CryptoHandshakeMessage msg; - const QuicString curve25519_private_key = + const std::string curve25519_private_key = Curve25519KeyExchange::NewPrivateKey(rand); std::unique_ptr<Curve25519KeyExchange> curve25519( Curve25519KeyExchange::New(curve25519_private_key)); QuicStringPiece curve25519_public_value = curve25519->public_value(); - QuicString encoded_public_values; + std::string encoded_public_values; // First three bytes encode the length of the public value. DCHECK_LT(curve25519_public_value.size(), (1U << 24)); encoded_public_values.push_back( @@ -267,7 +267,7 @@ encoded_public_values.append(curve25519_public_value.data(), curve25519_public_value.size()); - QuicString p256_private_key; + std::string p256_private_key; if (options.p256) { p256_private_key = P256KeyExchange::NewPrivateKey(); std::unique_ptr<P256KeyExchange> p256( @@ -346,7 +346,7 @@ std::unique_ptr<QuicServerConfigProtobuf> config( new QuicServerConfigProtobuf); - config->set_config(QuicString(serialized->AsStringPiece())); + config->set_config(std::string(serialized->AsStringPiece())); QuicServerConfigProtobuf::PrivateKey* curve25519_key = config->add_key(); curve25519_key->set_tag(kC255); curve25519_key->set_private_key(curve25519_private_key); @@ -478,12 +478,12 @@ } void QuicCryptoServerConfig::SetSourceAddressTokenKeys( - const std::vector<QuicString>& keys) { + const std::vector<std::string>& keys) { source_address_token_boxer_.SetKeys(keys); } void QuicCryptoServerConfig::GetConfigIds( - std::vector<QuicString>* scids) const { + std::vector<std::string>* scids) const { QuicReaderMutexLock locked(&configs_lock_); for (auto it = configs_.begin(); it != configs_.end(); ++it) { scids->push_back(it->first); @@ -556,7 +556,7 @@ << "Deleting ProcessClientHelloHelper with a pending callback."; } - void Fail(QuicErrorCode error, const QuicString& error_details) { + void Fail(QuicErrorCode error, const std::string& error_details) { (*done_cb_)->Run(error, error_details, nullptr, nullptr, nullptr); DetachCallback(); } @@ -564,7 +564,7 @@ void Succeed(std::unique_ptr<CryptoHandshakeMessage> message, std::unique_ptr<DiversificationNonce> diversification_nonce, std::unique_ptr<ProofSource::Details> proof_source_details) { - (*done_cb_)->Run(QUIC_NO_ERROR, QuicString(), std::move(message), + (*done_cb_)->Run(QUIC_NO_ERROR, std::string(), std::move(message), std::move(diversification_nonce), std::move(proof_source_details)); DetachCallback(); @@ -721,7 +721,7 @@ std::unique_ptr<ProofSource::Details> proof_source_details_; const KeyExchange::Factory& key_exchange_factory_; std::unique_ptr<CryptoHandshakeMessage> out_; - QuicString public_value_; + std::string public_value_; QuicReferenceCountedPointer<ValidateClientHelloResultCallback::Result> validate_chlo_result_; QuicConnectionId connection_id_; @@ -764,7 +764,7 @@ validate_chlo_result->client_hello; const ClientHelloInfo& info = validate_chlo_result->info; - QuicString error_details; + std::string error_details; QuicErrorCode valid = CryptoUtils::ValidateClientHello( client_hello, version, supported_versions, &error_details); if (valid != QUIC_NO_ERROR) { @@ -818,7 +818,7 @@ return; } DCHECK(proof_source_.get()); - QuicString chlo_hash; + std::string chlo_hash; CryptoUtils::HashHandshakeMessage(client_hello, &chlo_hash, Perspective::IS_SERVER); @@ -833,7 +833,7 @@ total_framing_overhead, chlo_packet_size, requested_config, primary_config, std::move(done_cb))); proof_source_->GetProof( - server_address, QuicString(info.sni), primary_config->serialized, + server_address, std::string(info.sni), primary_config->serialized, version.transport_version, chlo_hash, std::move(cb)); helper.DetachCallback(); return; @@ -1014,12 +1014,12 @@ params->sni = QuicHostnameUtils::NormalizeHostname(info.sni); } - QuicString hkdf_suffix; + std::string hkdf_suffix; const QuicData& client_hello_serialized = client_hello.GetSerialized(); - hkdf_suffix.reserve(connection_id.length() + - client_hello_serialized.length() + - requested_config->serialized.size()); - hkdf_suffix.append(connection_id.data(), connection_id.length()); + hkdf_suffix.reserve(connection_id.length() + + client_hello_serialized.length() + + requested_config->serialized.size()); + hkdf_suffix.append(connection_id.data(), connection_id.length()); hkdf_suffix.append(client_hello_serialized.data(), client_hello_serialized.length()); hkdf_suffix.append(requested_config->serialized); @@ -1039,7 +1039,7 @@ const QuicData& client_hello_copy_serialized = client_hello_copy.GetSerialized(); - QuicString hkdf_input; + std::string hkdf_input; hkdf_input.append(QuicCryptoConfig::kCETVLabel, strlen(QuicCryptoConfig::kCETVLabel) + 1); hkdf_input.append(connection_id.data(), connection_id.length()); @@ -1084,11 +1084,11 @@ return; } - params->channel_id = QuicString(key); + params->channel_id = std::string(key); } } - QuicString hkdf_input; + std::string hkdf_input; size_t label_len = strlen(QuicCryptoConfig::kInitialLabel) + 1; hkdf_input.reserve(label_len + hkdf_suffix.size()); hkdf_input.append(QuicCryptoConfig::kInitialLabel, label_len); @@ -1108,25 +1108,25 @@ return; } - QuicString forward_secure_public_value; + std::string forward_secure_public_value; std::unique_ptr<KeyExchange> forward_secure_key_exchange = key_exchange_factory.Create(rand); forward_secure_public_value = - QuicString(forward_secure_key_exchange->public_value()); + std::string(forward_secure_key_exchange->public_value()); if (!forward_secure_key_exchange->CalculateSharedKey( public_value, ¶ms->forward_secure_premaster_secret)) { helper.Fail(QUIC_INVALID_CRYPTO_MESSAGE_PARAMETER, "Invalid public value"); return; } - QuicString forward_secure_hkdf_input; + std::string forward_secure_hkdf_input; label_len = strlen(QuicCryptoConfig::kForwardSecureLabel) + 1; forward_secure_hkdf_input.reserve(label_len + hkdf_suffix.size()); forward_secure_hkdf_input.append(QuicCryptoConfig::kForwardSecureLabel, label_len); forward_secure_hkdf_input.append(hkdf_suffix); - QuicString shlo_nonce; + std::string shlo_nonce; shlo_nonce = NewServerNonce(rand, info.now); out->SetStringPiece(kServerNonceTag, shlo_nonce); @@ -1162,7 +1162,7 @@ configs_lock_.AssertReaderHeld(); if (!requested_scid.empty()) { - auto it = configs_.find((QuicString(requested_scid))); + auto it = configs_.find((std::string(requested_scid))); if (it != configs_.end()) { // We'll use the config that the client requested in order to do // key-agreement. @@ -1406,7 +1406,7 @@ } QuicReferenceCountedPointer<ProofSource::Chain> chain = - proof_source_->GetCertChain(server_address, QuicString(info->sni)); + proof_source_->GetCertChain(server_address, std::string(info->sni)); if (!chain) { info->reject_reasons.push_back(SERVER_CONFIG_UNKNOWN_CONFIG_FAILURE); } else if (!ValidateExpectedLeafCertificate(client_hello, chain->certs)) { @@ -1467,8 +1467,8 @@ const QuicCryptoNegotiatedParameters& params, const CachedNetworkParameters* cached_network_params, std::unique_ptr<BuildServerConfigUpdateMessageResultCallback> cb) const { - QuicString serialized; - QuicString source_address_token; + std::string serialized; + std::string source_address_token; const CommonCertSets* common_cert_sets; { QuicReaderMutexLock locked(&configs_lock_); @@ -1533,14 +1533,14 @@ QuicTransportVersion version, QuicCompressedCertsCache* compressed_certs_cache, const CommonCertSets* common_cert_sets, - const QuicString& client_common_set_hashes, - const QuicString& client_cached_cert_hashes, + const std::string& client_common_set_hashes, + const std::string& client_cached_cert_hashes, bool sct_supported_by_client, - const QuicString& sni, + const std::string& sni, bool ok, const QuicReferenceCountedPointer<ProofSource::Chain>& chain, - const QuicString& signature, - const QuicString& leaf_cert_sct, + const std::string& signature, + const std::string& leaf_cert_sct, std::unique_ptr<ProofSource::Details> details, CryptoHandshakeMessage message, std::unique_ptr<BuildServerConfigUpdateMessageResultCallback> cb) const { @@ -1549,7 +1549,7 @@ return; } - const QuicString compressed = + const std::string compressed = CompressChain(compressed_certs_cache, chain, client_common_set_hashes, client_cached_cert_hashes, common_cert_sets); @@ -1589,17 +1589,17 @@ << "with server-designated connection ID " << server_designated_connection_id; out->set_tag(kSREJ); - if (!QuicUtils::IsConnectionIdValidForVersion( - server_designated_connection_id, version)) { - QUIC_BUG << "Tried to send server designated connection ID " - << server_designated_connection_id - << " which is invalid with version " - << QuicVersionToString(version); - return; - } - out->SetStringPiece( - kRCID, QuicStringPiece(server_designated_connection_id.data(), - server_designated_connection_id.length())); + if (!QuicUtils::IsConnectionIdValidForVersion( + server_designated_connection_id, version)) { + QUIC_BUG << "Tried to send server designated connection ID " + << server_designated_connection_id + << " which is invalid with version " + << QuicVersionToString(version); + return; + } + out->SetStringPiece( + kRCID, QuicStringPiece(server_designated_connection_id.data(), + server_designated_connection_id.length())); } else { out->set_tag(kREJ); } @@ -1625,17 +1625,17 @@ QuicStringPiece client_common_set_hashes; if (client_hello.GetStringPiece(kCCS, &client_common_set_hashes)) { - params->client_common_set_hashes = QuicString(client_common_set_hashes); + params->client_common_set_hashes = std::string(client_common_set_hashes); } QuicStringPiece client_cached_cert_hashes; if (client_hello.GetStringPiece(kCCRT, &client_cached_cert_hashes)) { - params->client_cached_cert_hashes = QuicString(client_cached_cert_hashes); + params->client_cached_cert_hashes = std::string(client_cached_cert_hashes); } else { params->client_cached_cert_hashes.clear(); } - const QuicString compressed = + const std::string compressed = CompressChain(compressed_certs_cache, signed_config.chain, params->client_common_set_hashes, params->client_cached_cert_hashes, config.common_cert_sets); @@ -1659,7 +1659,7 @@ "overhead calculation may underflow"); bool should_return_sct = params->sct_supported_by_client && enable_serving_sct_; - const QuicString& cert_sct = signed_config.proof.leaf_cert_scts; + const std::string& cert_sct = signed_config.proof.leaf_cert_scts; const size_t sct_size = should_return_sct ? cert_sct.size() : 0; const size_t total_size = signed_config.proof.signature.size() + compressed.size() + sct_size; @@ -1674,8 +1674,7 @@ } else { // Log SNI and subject name for the leaf cert if its SCT is empty. // This is for debugging b/28342827. - const std::vector<quic::QuicString>& certs = - signed_config.chain->certs; + const std::vector<std::string>& certs = signed_config.chain->certs; QuicStringPiece ca_subject; if (!certs.empty()) { QuicCertUtils::ExtractSubjectNameFromDERCert(certs[0], &ca_subject); @@ -1697,20 +1696,20 @@ } } -QuicString QuicCryptoServerConfig::CompressChain( +std::string QuicCryptoServerConfig::CompressChain( QuicCompressedCertsCache* compressed_certs_cache, const QuicReferenceCountedPointer<ProofSource::Chain>& chain, - const QuicString& client_common_set_hashes, - const QuicString& client_cached_cert_hashes, + const std::string& client_common_set_hashes, + const std::string& client_cached_cert_hashes, const CommonCertSets* common_sets) { // Check whether the compressed certs is available in the cache. DCHECK(compressed_certs_cache); - const QuicString* cached_value = compressed_certs_cache->GetCompressedCert( + const std::string* cached_value = compressed_certs_cache->GetCompressedCert( chain, client_common_set_hashes, client_cached_cert_hashes); if (cached_value) { return *cached_value; } - QuicString compressed = + std::string compressed = CertCompressor::CompressChain(chain->certs, client_common_set_hashes, client_cached_cert_hashes, common_sets); // Insert the newly compressed cert to cache. @@ -1747,7 +1746,7 @@ QUIC_LOG(WARNING) << "Server config message is missing SCID"; return nullptr; } - config->id = QuicString(scid); + config->id = std::string(scid); if (msg->GetTaglist(kAEAD, &config->aead) != QUIC_NO_ERROR) { QUIC_LOG(WARNING) << "Server config message is missing AEAD"; @@ -1802,7 +1801,7 @@ for (size_t i = 0; i < kexs_tags.size(); i++) { const QuicTag tag = kexs_tags[i]; - QuicString private_key; + std::string private_key; config->kexs.push_back(tag); @@ -1867,7 +1866,7 @@ primary_config_changed_cb_ = std::move(cb); } -QuicString QuicCryptoServerConfig::NewSourceAddressToken( +std::string QuicCryptoServerConfig::NewSourceAddressToken( const Config& config, const SourceAddressTokens& previous_tokens, const QuicIpAddress& ip, @@ -1922,7 +1921,7 @@ const Config& config, QuicStringPiece token, SourceAddressTokens* tokens) const { - QuicString storage; + std::string storage; QuicStringPiece plaintext; if (!config.source_address_token_boxer->Unbox(token, &storage, &plaintext)) { return SOURCE_ADDRESS_TOKEN_DECRYPTION_FAILURE; @@ -1999,8 +1998,8 @@ static const size_t kServerNoncePlaintextSize = 4 /* timestamp */ + 20 /* random bytes */; -QuicString QuicCryptoServerConfig::NewServerNonce(QuicRandom* rand, - QuicWallTime now) const { +std::string QuicCryptoServerConfig::NewServerNonce(QuicRandom* rand, + QuicWallTime now) const { const uint32_t timestamp = static_cast<uint32_t>(now.ToUNIXSeconds()); uint8_t server_nonce[kServerNoncePlaintextSize]; @@ -2019,7 +2018,7 @@ bool QuicCryptoServerConfig::ValidateExpectedLeafCertificate( const CryptoHandshakeMessage& client_hello, - const std::vector<QuicString>& certs) const { + const std::vector<std::string>& certs) const { if (certs.empty()) { return false; }
diff --git a/quic/core/crypto/quic_crypto_server_config.h b/quic/core/crypto/quic_crypto_server_config.h index 9f91c9a..858c95e 100644 --- a/quic/core/crypto/quic_crypto_server_config.h +++ b/quic/core/crypto/quic_crypto_server_config.h
@@ -76,7 +76,7 @@ PrimaryConfigChangedCallback& operator=(const PrimaryConfigChangedCallback&) = delete; virtual ~PrimaryConfigChangedCallback(); - virtual void Run(const QuicString& scid) = 0; + virtual void Run(const std::string& scid) = 0; }; // Callback used to accept the result of the |client_hello| validation step. @@ -92,7 +92,7 @@ CryptoHandshakeMessage client_hello; ClientHelloInfo info; QuicErrorCode error_code; - QuicString error_details; + std::string error_details; // Populated if the CHLO STK contained a CachedNetworkParameters proto. CachedNetworkParameters cached_network_params; @@ -121,7 +121,7 @@ const ProcessClientHelloResultCallback&) = delete; virtual ~ProcessClientHelloResultCallback(); virtual void Run(QuicErrorCode error, - const QuicString& error_details, + const std::string& error_details, std::unique_ptr<CryptoHandshakeMessage> message, std::unique_ptr<DiversificationNonce> diversification_nonce, std::unique_ptr<ProofSource::Details> details) = 0; @@ -163,7 +163,7 @@ // Create a new KeyExchange of the specified type using the specified // private key. - virtual std::unique_ptr<KeyExchange> Create(QuicString /*server_config_id*/, + virtual std::unique_ptr<KeyExchange> Create(std::string /*server_config_id*/, QuicTag type, QuicStringPiece private_key) = 0; }; @@ -192,10 +192,10 @@ QuicTagVector token_binding_params; // id contains the server config id for the resulting config. If empty, a // random id is generated. - QuicString id; + std::string id; // orbit contains the kOrbitSize bytes of the orbit value for the server // config. If |orbit| is empty then a random orbit is generated. - QuicString orbit; + std::string orbit; // p256 determines whether a P-256 public key will be included in the // server config. Note that this breaks deterministic server-config // generation since P-256 key generation doesn't use the QuicRandom given @@ -262,10 +262,10 @@ // decrypting a source address token. Note that these keys are used *without* // passing them through a KDF, in contradistinction to the // |source_address_token_secret| argument to the constructor. - void SetSourceAddressTokenKeys(const std::vector<QuicString>& keys); + void SetSourceAddressTokenKeys(const std::vector<std::string>& keys); // Get the server config ids for all known configs. - void GetConfigIds(std::vector<QuicString>* scids) const; + void GetConfigIds(std::vector<std::string>* scids) const; // Checks |client_hello| for gross errors and determines whether it can be // shown to be fresh (i.e. not a replay). The result of the validation step @@ -429,7 +429,7 @@ SSL_CTX* ssl_ctx() const; void set_pre_shared_key(QuicStringPiece psk) { - pre_shared_key_ = QuicString(psk); + pre_shared_key_ = std::string(psk); } bool pad_rej() const { return pad_rej_; } @@ -455,9 +455,9 @@ // getters/setters here. // |serialized| contains the bytes of this server config, suitable for // sending on the wire. - QuicString serialized; + std::string serialized; // id contains the SCID of this server config. - QuicString id; + std::string id; // orbit contains the orbit value for this config: an opaque identifier // used to identify clusters of server frontends. unsigned char orbit[kOrbitSize]; @@ -636,11 +636,11 @@ // sets known locally and |client_common_set_hashes| contains the hashes of // the common sets known to the peer. |client_cached_cert_hashes| contains // 64-bit, FNV-1a hashes of certificates that the peer already possesses. - static QuicString CompressChain( + static std::string CompressChain( QuicCompressedCertsCache* compressed_certs_cache, const QuicReferenceCountedPointer<ProofSource::Chain>& chain, - const QuicString& client_common_set_hashes, - const QuicString& client_cached_cert_hashes, + const std::string& client_common_set_hashes, + const std::string& client_cached_cert_hashes, const CommonCertSets* common_sets); // ParseConfigProtobuf parses the given config protobuf and returns a @@ -651,7 +651,7 @@ // NewSourceAddressToken returns a fresh source address token for the given // IP address. |cached_network_params| is optional, and can be nullptr. - QuicString NewSourceAddressToken( + std::string NewSourceAddressToken( const Config& config, const SourceAddressTokens& previous_tokens, const QuicIpAddress& ip, @@ -696,7 +696,7 @@ QuicWallTime now) const; // NewServerNonce generates and encrypts a random nonce. - QuicString NewServerNonce(QuicRandom* rand, QuicWallTime now) const; + std::string NewServerNonce(QuicRandom* rand, QuicWallTime now) const; // ValidateExpectedLeafCertificate checks the |client_hello| to see if it has // an XLCT tag, and if so, verifies that its value matches the hash of the @@ -705,7 +705,7 @@ // XLCT tag is present and valid. It returns false otherwise. bool ValidateExpectedLeafCertificate( const CryptoHandshakeMessage& client_hello, - const std::vector<QuicString>& certs) const; + const std::vector<std::string>& certs) const; // Returns true if the PDMD field from the client hello demands an X509 // certificate. @@ -742,10 +742,10 @@ const QuicTransportVersion version_; QuicCompressedCertsCache* compressed_certs_cache_; const CommonCertSets* common_cert_sets_; - const QuicString client_common_set_hashes_; - const QuicString client_cached_cert_hashes_; + const std::string client_common_set_hashes_; + const std::string client_cached_cert_hashes_; const bool sct_supported_by_client_; - const QuicString sni_; + const std::string sni_; CryptoHandshakeMessage message_; std::unique_ptr<BuildServerConfigUpdateMessageResultCallback> cb_; }; @@ -757,14 +757,14 @@ QuicTransportVersion version, QuicCompressedCertsCache* compressed_certs_cache, const CommonCertSets* common_cert_sets, - const QuicString& client_common_set_hashes, - const QuicString& client_cached_cert_hashes, + const std::string& client_common_set_hashes, + const std::string& client_cached_cert_hashes, bool sct_supported_by_client, - const QuicString& sni, + const std::string& sni, bool ok, const QuicReferenceCountedPointer<ProofSource::Chain>& chain, - const QuicString& signature, - const QuicString& leaf_cert_sct, + const std::string& signature, + const std::string& leaf_cert_sct, std::unique_ptr<ProofSource::Details> details, CryptoHandshakeMessage message, std::unique_ptr<BuildServerConfigUpdateMessageResultCallback> cb) const; @@ -837,7 +837,7 @@ // If non-empty, the server will operate in the pre-shared key mode by // incorporating |pre_shared_key_| into the key schedule. - QuicString pre_shared_key_; + std::string pre_shared_key_; // Whether REJ message should be padded to max packet size. bool pad_rej_; @@ -866,7 +866,7 @@ // The server config that is used for this proof (and the rest of the // request). QuicReferenceCountedPointer<QuicCryptoServerConfig::Config> config; - QuicString primary_scid; + std::string primary_scid; protected: ~QuicSignedServerConfig() override;
diff --git a/quic/core/crypto/quic_crypto_server_config_test.cc b/quic/core/crypto/quic_crypto_server_config_test.cc index 101be1d..6d38bde 100644 --- a/quic/core/crypto/quic_crypto_server_config_test.cc +++ b/quic/core/crypto/quic_crypto_server_config_test.cc
@@ -58,11 +58,11 @@ TlsServerHandshaker::CreateSslCtx()); QuicCryptoServerConfigPeer peer(&server); - std::vector<QuicString> certs = {"testcert"}; + std::vector<std::string> certs = {"testcert"}; QuicReferenceCountedPointer<ProofSource::Chain> chain( new ProofSource::Chain(certs)); - QuicString compressed = QuicCryptoServerConfigPeer::CompressChain( + std::string compressed = QuicCryptoServerConfigPeer::CompressChain( &compressed_certs_cache, chain, "", "", nullptr); EXPECT_EQ(compressed_certs_cache.Size(), 1u); @@ -80,18 +80,18 @@ QuicCryptoServerConfigPeer peer(&server); // Compress the certs for the first time. - std::vector<QuicString> certs = {"testcert"}; + std::vector<std::string> certs = {"testcert"}; QuicReferenceCountedPointer<ProofSource::Chain> chain( new ProofSource::Chain(certs)); - QuicString common_certs = ""; - QuicString cached_certs = ""; + std::string common_certs = ""; + std::string cached_certs = ""; - QuicString compressed = QuicCryptoServerConfigPeer::CompressChain( + std::string compressed = QuicCryptoServerConfigPeer::CompressChain( &compressed_certs_cache, chain, common_certs, cached_certs, nullptr); EXPECT_EQ(compressed_certs_cache.Size(), 1u); // Compress the same certs, should use cache if available. - QuicString compressed2 = QuicCryptoServerConfigPeer::CompressChain( + std::string compressed2 = QuicCryptoServerConfigPeer::CompressChain( &compressed_certs_cache, chain, common_certs, cached_certs, nullptr); EXPECT_EQ(compressed, compressed2); EXPECT_EQ(compressed_certs_cache.Size(), 1u); @@ -110,13 +110,13 @@ TlsServerHandshaker::CreateSslCtx()); QuicCryptoServerConfigPeer peer(&server); - std::vector<QuicString> certs = {"testcert"}; + std::vector<std::string> certs = {"testcert"}; QuicReferenceCountedPointer<ProofSource::Chain> chain( new ProofSource::Chain(certs)); - QuicString common_certs = ""; - QuicString cached_certs = ""; + std::string common_certs = ""; + std::string cached_certs = ""; - QuicString compressed = QuicCryptoServerConfigPeer::CompressChain( + std::string compressed = QuicCryptoServerConfigPeer::CompressChain( &compressed_certs_cache, chain, common_certs, cached_certs, nullptr); EXPECT_EQ(compressed_certs_cache.Size(), 1u); @@ -124,7 +124,7 @@ QuicReferenceCountedPointer<ProofSource::Chain> chain2( new ProofSource::Chain(certs)); - QuicString compressed2 = QuicCryptoServerConfigPeer::CompressChain( + std::string compressed2 = QuicCryptoServerConfigPeer::CompressChain( &compressed_certs_cache, chain2, common_certs, cached_certs, nullptr); EXPECT_EQ(compressed_certs_cache.Size(), 2u); @@ -134,8 +134,8 @@ crypto_test_utils::MockCommonCertSets(certs[0], set_hash, 1)); QuicStringPiece different_common_certs( reinterpret_cast<const char*>(&set_hash), sizeof(set_hash)); - QuicString compressed3 = QuicCryptoServerConfigPeer::CompressChain( - &compressed_certs_cache, chain, QuicString(different_common_certs), + std::string compressed3 = QuicCryptoServerConfigPeer::CompressChain( + &compressed_certs_cache, chain, std::string(different_common_certs), cached_certs, common_sets.get()); EXPECT_EQ(compressed_certs_cache.Size(), 3u); } @@ -162,20 +162,21 @@ rand_, &clock_, QuicCryptoServerConfig::ConfigOptions())); } - QuicString NewSourceAddressToken(QuicString config_id, - const QuicIpAddress& ip) { + std::string NewSourceAddressToken(std::string config_id, + const QuicIpAddress& ip) { return NewSourceAddressToken(config_id, ip, nullptr); } - QuicString NewSourceAddressToken(QuicString config_id, - const QuicIpAddress& ip, - const SourceAddressTokens& previous_tokens) { + std::string NewSourceAddressToken( + std::string config_id, + const QuicIpAddress& ip, + const SourceAddressTokens& previous_tokens) { return peer_.NewSourceAddressToken(config_id, previous_tokens, ip, rand_, clock_.WallNow(), nullptr); } - QuicString NewSourceAddressToken( - QuicString config_id, + std::string NewSourceAddressToken( + std::string config_id, const QuicIpAddress& ip, CachedNetworkParameters* cached_network_params) { SourceAddressTokens previous_tokens; @@ -183,14 +184,14 @@ clock_.WallNow(), cached_network_params); } - HandshakeFailureReason ValidateSourceAddressTokens(QuicString config_id, + HandshakeFailureReason ValidateSourceAddressTokens(std::string config_id, QuicStringPiece srct, const QuicIpAddress& ip) { return ValidateSourceAddressTokens(config_id, srct, ip, nullptr); } HandshakeFailureReason ValidateSourceAddressTokens( - QuicString config_id, + std::string config_id, QuicStringPiece srct, const QuicIpAddress& ip, CachedNetworkParameters* cached_network_params) { @@ -198,8 +199,8 @@ config_id, srct, ip, clock_.WallNow(), cached_network_params); } - const QuicString kPrimary = "<primary>"; - const QuicString kOverride = "Config with custom source address token key"; + const std::string kPrimary = "<primary>"; + const std::string kOverride = "Config with custom source address token key"; QuicIpAddress ip4_; QuicIpAddress ip4_dual_; @@ -219,9 +220,9 @@ // to a single IP address and server config. TEST_F(SourceAddressTokenTest, SourceAddressToken) { // Primary config generates configs that validate successfully. - const QuicString token4 = NewSourceAddressToken(kPrimary, ip4_); - const QuicString token4d = NewSourceAddressToken(kPrimary, ip4_dual_); - const QuicString token6 = NewSourceAddressToken(kPrimary, ip6_); + const std::string token4 = NewSourceAddressToken(kPrimary, ip4_); + const std::string token4d = NewSourceAddressToken(kPrimary, ip4_dual_); + const std::string token6 = NewSourceAddressToken(kPrimary, ip6_); EXPECT_EQ(HANDSHAKE_OK, ValidateSourceAddressTokens(kPrimary, token4, ip4_)); ASSERT_EQ(HANDSHAKE_OK, ValidateSourceAddressTokens(kPrimary, token4, ip4_dual_)); @@ -236,7 +237,7 @@ } TEST_F(SourceAddressTokenTest, SourceAddressTokenExpiration) { - const QuicString token = NewSourceAddressToken(kPrimary, ip4_); + const std::string token = NewSourceAddressToken(kPrimary, ip4_); // Validation fails if the token is from the future. clock_.AdvanceTime(QuicTime::Delta::FromSeconds(-3600 * 2)); @@ -254,7 +255,7 @@ // that this gets written to ValidateSourceAddressToken output argument. CachedNetworkParameters cached_network_params_input; cached_network_params_input.set_bandwidth_estimate_bytes_per_second(1234); - const QuicString token4_with_cached_network_params = + const std::string token4_with_cached_network_params = NewSourceAddressToken(kPrimary, ip4_, &cached_network_params_input); CachedNetworkParameters cached_network_params_output; @@ -277,7 +278,7 @@ previous_token.set_timestamp(now.ToUNIXSeconds()); SourceAddressTokens previous_tokens; (*previous_tokens.add_tokens()) = previous_token; - const QuicString token4or6 = + const std::string token4or6 = NewSourceAddressToken(kPrimary, ip4_, previous_tokens); EXPECT_EQ(HANDSHAKE_OK, @@ -346,7 +347,7 @@ QuicCryptoServerConfig::GenerateConfig(rand_, &clock_, options); protobuf->set_primary_time(primary_time); protobuf->set_priority(priority); - if (QuicString(server_config_id).find("INVALID") == 0) { + if (std::string(server_config_id).find("INVALID") == 0) { protobuf->clear_key(); has_invalid = true; } @@ -365,7 +366,7 @@ }; TEST_F(CryptoServerConfigsTest, NoConfigs) { - test_peer_.CheckConfigs(std::vector<std::pair<QuicString, bool>>()); + test_peer_.CheckConfigs(std::vector<std::pair<std::string, bool>>()); } TEST_F(CryptoServerConfigsTest, MakePrimaryFirst) {
diff --git a/quic/core/crypto/quic_decrypter.cc b/quic/core/crypto/quic_decrypter.cc index d2aa28d..1ab67ba 100644 --- a/quic/core/crypto/quic_decrypter.cc +++ b/quic/core/crypto/quic_decrypter.cc
@@ -55,14 +55,14 @@ const DiversificationNonce& nonce, size_t key_size, size_t nonce_prefix_size, - QuicString* out_key, - QuicString* out_nonce_prefix) { - QuicHKDF hkdf((QuicString(preliminary_key)) + (QuicString(nonce_prefix)), + std::string* out_key, + std::string* out_nonce_prefix) { + QuicHKDF hkdf((std::string(preliminary_key)) + (std::string(nonce_prefix)), QuicStringPiece(nonce.data(), nonce.size()), "QUIC key diversification", 0, key_size, 0, nonce_prefix_size, 0); - *out_key = QuicString(hkdf.server_write_key()); - *out_nonce_prefix = QuicString(hkdf.server_write_iv()); + *out_key = std::string(hkdf.server_write_key()); + *out_nonce_prefix = std::string(hkdf.server_write_iv()); } } // namespace quic
diff --git a/quic/core/crypto/quic_decrypter.h b/quic/core/crypto/quic_decrypter.h index c7c2ccc..f55b00b 100644 --- a/quic/core/crypto/quic_decrypter.h +++ b/quic/core/crypto/quic_decrypter.h
@@ -73,8 +73,8 @@ const DiversificationNonce& nonce, size_t key_size, size_t nonce_prefix_size, - QuicString* out_key, - QuicString* out_nonce_prefix); + std::string* out_key, + std::string* out_nonce_prefix); }; } // namespace quic
diff --git a/quic/core/crypto/quic_hkdf_test.cc b/quic/core/crypto/quic_hkdf_test.cc index f8c53c6..fbf2860 100644 --- a/quic/core/crypto/quic_hkdf_test.cc +++ b/quic/core/crypto/quic_hkdf_test.cc
@@ -70,10 +70,10 @@ const HKDFInput& test(kHKDFInputs[i]); SCOPED_TRACE(i); - const QuicString key = QuicTextUtils::HexDecode(test.key_hex); - const QuicString salt = QuicTextUtils::HexDecode(test.salt_hex); - const QuicString info = QuicTextUtils::HexDecode(test.info_hex); - const QuicString expected = QuicTextUtils::HexDecode(test.output_hex); + const std::string key = QuicTextUtils::HexDecode(test.key_hex); + const std::string salt = QuicTextUtils::HexDecode(test.salt_hex); + const std::string info = QuicTextUtils::HexDecode(test.info_hex); + const std::string expected = QuicTextUtils::HexDecode(test.output_hex); // We set the key_length to the length of the expected output and then take // the result from the first key, which is the client write key.
diff --git a/quic/core/crypto/transport_parameters_test.cc b/quic/core/crypto/transport_parameters_test.cc index 8a81841..23b18e5 100644 --- a/quic/core/crypto/transport_parameters_test.cc +++ b/quic/core/crypto/transport_parameters_test.cc
@@ -412,7 +412,7 @@ orig_params.idle_timeout = 56; orig_params.google_quic_params = QuicMakeUnique<CryptoHandshakeMessage>(); - const QuicString kTestString = "test string"; + const std::string kTestString = "test string"; orig_params.google_quic_params->SetStringPiece(42, kTestString); const uint32_t kTestValue = 12; orig_params.google_quic_params->SetValue(1337, kTestValue);
diff --git a/quic/core/frames/quic_application_close_frame.h b/quic/core/frames/quic_application_close_frame.h index b9b84dd..6a85265 100644 --- a/quic/core/frames/quic_application_close_frame.h +++ b/quic/core/frames/quic_application_close_frame.h
@@ -21,7 +21,7 @@ const QuicApplicationCloseFrame& frame); QuicErrorCode error_code; - QuicString error_details; + std::string error_details; }; } // namespace quic
diff --git a/quic/core/frames/quic_connection_close_frame.cc b/quic/core/frames/quic_connection_close_frame.cc index 51969c6..55d356b 100644 --- a/quic/core/frames/quic_connection_close_frame.cc +++ b/quic/core/frames/quic_connection_close_frame.cc
@@ -10,14 +10,14 @@ : error_code(QUIC_NO_ERROR), frame_type(0) {} QuicConnectionCloseFrame::QuicConnectionCloseFrame(QuicErrorCode error_code, - QuicString error_details) + std::string error_details) : error_code(error_code), error_details(std::move(error_details)), frame_type(0) {} QuicConnectionCloseFrame::QuicConnectionCloseFrame( QuicIetfTransportErrorCodes ietf_error_code, - QuicString error_details, + std::string error_details, uint64_t frame_type) : ietf_error_code(ietf_error_code), error_details(std::move(error_details)),
diff --git a/quic/core/frames/quic_connection_close_frame.h b/quic/core/frames/quic_connection_close_frame.h index 2bbbe73..1b909ce 100644 --- a/quic/core/frames/quic_connection_close_frame.h +++ b/quic/core/frames/quic_connection_close_frame.h
@@ -16,9 +16,9 @@ struct QUIC_EXPORT_PRIVATE QuicConnectionCloseFrame { QuicConnectionCloseFrame(); - QuicConnectionCloseFrame(QuicErrorCode error_code, QuicString error_details); + QuicConnectionCloseFrame(QuicErrorCode error_code, std::string error_details); QuicConnectionCloseFrame(QuicIetfTransportErrorCodes ietf_error_code, - QuicString error_details, + std::string error_details, uint64_t frame_type); friend QUIC_EXPORT_PRIVATE std::ostream& operator<<( @@ -33,7 +33,7 @@ QuicErrorCode error_code; QuicIetfTransportErrorCodes ietf_error_code; }; - QuicString error_details; + std::string error_details; // Contains the type of frame that triggered the connection close. Made a // uint64, as opposed to the QuicIetfFrameType, to support possible
diff --git a/quic/core/frames/quic_goaway_frame.cc b/quic/core/frames/quic_goaway_frame.cc index ff034f0..53dca54 100644 --- a/quic/core/frames/quic_goaway_frame.cc +++ b/quic/core/frames/quic_goaway_frame.cc
@@ -16,7 +16,7 @@ QuicGoAwayFrame::QuicGoAwayFrame(QuicControlFrameId control_frame_id, QuicErrorCode error_code, QuicStreamId last_good_stream_id, - const QuicString& reason) + const std::string& reason) : control_frame_id(control_frame_id), error_code(error_code), last_good_stream_id(last_good_stream_id),
diff --git a/quic/core/frames/quic_goaway_frame.h b/quic/core/frames/quic_goaway_frame.h index 085e915..03d6273 100644 --- a/quic/core/frames/quic_goaway_frame.h +++ b/quic/core/frames/quic_goaway_frame.h
@@ -18,7 +18,7 @@ QuicGoAwayFrame(QuicControlFrameId control_frame_id, QuicErrorCode error_code, QuicStreamId last_good_stream_id, - const QuicString& reason); + const std::string& reason); friend QUIC_EXPORT_PRIVATE std::ostream& operator<<(std::ostream& os, const QuicGoAwayFrame& g); @@ -28,7 +28,7 @@ QuicControlFrameId control_frame_id; QuicErrorCode error_code; QuicStreamId last_good_stream_id; - QuicString reason_phrase; + std::string reason_phrase; }; } // namespace quic
diff --git a/quic/core/frames/quic_new_token_frame.cc b/quic/core/frames/quic_new_token_frame.cc index c2f4e74..6e36866 100644 --- a/quic/core/frames/quic_new_token_frame.cc +++ b/quic/core/frames/quic_new_token_frame.cc
@@ -12,7 +12,7 @@ : control_frame_id(kInvalidControlFrameId) {} QuicNewTokenFrame::QuicNewTokenFrame(QuicControlFrameId control_frame_id, - QuicString token) + std::string token) : control_frame_id(control_frame_id), token(token) {} std::ostream& operator<<(std::ostream& os, const QuicNewTokenFrame& s) {
diff --git a/quic/core/frames/quic_new_token_frame.h b/quic/core/frames/quic_new_token_frame.h index 6fb0ea4..5a063a3 100644 --- a/quic/core/frames/quic_new_token_frame.h +++ b/quic/core/frames/quic_new_token_frame.h
@@ -17,7 +17,7 @@ struct QUIC_EXPORT_PRIVATE QuicNewTokenFrame { QuicNewTokenFrame(); - QuicNewTokenFrame(QuicControlFrameId control_frame_id, QuicString token); + QuicNewTokenFrame(QuicControlFrameId control_frame_id, std::string token); friend QUIC_EXPORT_PRIVATE std::ostream& operator<<( std::ostream& os, @@ -27,7 +27,7 @@ // and non-zero when sent. QuicControlFrameId control_frame_id; - QuicString token; + std::string token; }; static_assert(sizeof(QuicNewTokenFrame) <= 64, "Keep the QuicNewTokenFrame size to a cacheline.");
diff --git a/quic/core/http/end_to_end_test.cc b/quic/core/http/end_to_end_test.cc index c26ffa6..d439e95 100644 --- a/quic/core/http/end_to_end_test.cc +++ b/quic/core/http/end_to_end_test.cc
@@ -622,7 +622,7 @@ // Default is true. bool connect_to_server_on_initialize_; QuicSocketAddress server_address_; - QuicString server_hostname_; + std::string server_hostname_; QuicMemoryCacheBackend memory_cache_backend_; std::unique_ptr<ServerThread> server_thread_; std::unique_ptr<QuicTestClient> client_; @@ -637,8 +637,8 @@ size_t chlo_multiplier_; QuicTestServer::StreamFactory* stream_factory_; bool support_server_push_; - QuicString pre_shared_key_client_; - QuicString pre_shared_key_server_; + std::string pre_shared_key_client_; + std::string pre_shared_key_server_; QuicConnectionId* override_connection_id_; }; @@ -854,8 +854,8 @@ TEST_P(EndToEndTestWithTls, RequestOverMultiplePackets) { // Send a large enough request to guarantee fragmentation. - QuicString huge_request = - "/some/path?query=" + QuicString(kMaxPacketSize, '.'); + std::string huge_request = + "/some/path?query=" + std::string(kMaxPacketSize, '.'); AddToCache(huge_request, 200, kBarResponseBody); ASSERT_TRUE(Initialize()); @@ -866,8 +866,8 @@ TEST_P(EndToEndTestWithTls, MultiplePacketsRandomOrder) { // Send a large enough request to guarantee fragmentation. - QuicString huge_request = - "/some/path?query=" + QuicString(kMaxPacketSize, '.'); + std::string huge_request = + "/some/path?query=" + std::string(kMaxPacketSize, '.'); AddToCache(huge_request, 200, kBarResponseBody); ASSERT_TRUE(Initialize()); @@ -903,7 +903,7 @@ EXPECT_TRUE(client_->client()->WaitForCryptoHandshakeConfirmed()); // 1 MB body. - QuicString body(1024 * 1024, 'a'); + std::string body(1024 * 1024, 'a'); SpdyHeaderBlock headers; headers[":method"] = "POST"; headers[":path"] = "/foo"; @@ -924,7 +924,7 @@ EXPECT_TRUE(client_->client()->WaitForCryptoHandshakeConfirmed()); // 100 KB body. - QuicString body(100 * 1024, 'a'); + std::string body(100 * 1024, 'a'); SpdyHeaderBlock headers; headers[":method"] = "POST"; headers[":path"] = "/foo"; @@ -952,7 +952,7 @@ SetPacketLossPercentage(30); // 10 KB body. - QuicString body(1024 * 10, 'a'); + std::string body(1024 * 10, 'a'); SpdyHeaderBlock headers; headers[":method"] = "POST"; headers[":path"] = "/foo"; @@ -983,7 +983,7 @@ SetPacketLossPercentage(30); // 10 KB body. - QuicString body(1024 * 10, 'a'); + std::string body(1024 * 10, 'a'); SpdyHeaderBlock headers; headers[":method"] = "POST"; headers[":path"] = "/foo"; @@ -1011,7 +1011,7 @@ client_writer_->set_fake_blocked_socket_percentage(10); // 10 KB body. - QuicString body(1024 * 10, 'a'); + std::string body(1024 * 10, 'a'); SpdyHeaderBlock headers; headers[":method"] = "POST"; headers[":path"] = "/foo"; @@ -1031,7 +1031,7 @@ SetReorderPercentage(30); // 1 MB body. - QuicString body(1024 * 1024, 'a'); + std::string body(1024 * 1024, 'a'); SpdyHeaderBlock headers; headers[":method"] = "POST"; headers[":path"] = "/foo"; @@ -1047,7 +1047,7 @@ // a 0-RTT handshake for the next request. ASSERT_TRUE(Initialize()); - QuicString body(20480, 'a'); + std::string body(20480, 'a'); SpdyHeaderBlock headers; headers[":method"] = "POST"; headers[":path"] = "/foo"; @@ -1187,7 +1187,7 @@ // a 0-RTT handshake for the next request. ASSERT_TRUE(Initialize()); - QuicString body(20480, 'a'); + std::string body(20480, 'a'); SpdyHeaderBlock headers; headers[":method"] = "POST"; headers[":path"] = "/foo"; @@ -1302,7 +1302,7 @@ EXPECT_TRUE(client_->client()->WaitForCryptoHandshakeConfirmed()); // 1 MB body. - QuicString body(1024 * 1024, 'a'); + std::string body(1024 * 1024, 'a'); SpdyHeaderBlock headers; headers[":method"] = "POST"; headers[":path"] = "/foo"; @@ -1363,7 +1363,7 @@ ASSERT_TRUE(Initialize()); EXPECT_TRUE(client_->client()->WaitForCryptoHandshakeConfirmed()); - QuicString body(kMaxPacketSize, 'a'); + std::string body(kMaxPacketSize, 'a'); SpdyHeaderBlock headers; headers[":method"] = "POST"; headers[":path"] = "/foo"; @@ -1387,15 +1387,15 @@ ASSERT_TRUE(Initialize()); EXPECT_TRUE(client_->client()->WaitForCryptoHandshakeConfirmed()); - QuicString body(kMaxPacketSize, 'a'); + std::string body(kMaxPacketSize, 'a'); SpdyHeaderBlock headers; headers[":method"] = "POST"; headers[":path"] = "/foo"; headers[":scheme"] = "https"; headers[":authority"] = server_hostname_; - headers["key1"] = QuicString(15 * 1024, 'a'); - headers["key2"] = QuicString(15 * 1024, 'a'); - headers["key3"] = QuicString(15 * 1024, 'a'); + headers["key1"] = std::string(15 * 1024, 'a'); + headers["key2"] = std::string(15 * 1024, 'a'); + headers["key3"] = std::string(15 * 1024, 'a'); client_->SendCustomSynchronousRequest(headers, body); EXPECT_EQ(QUIC_HEADERS_TOO_LARGE, client_->stream_error()); @@ -1406,7 +1406,7 @@ ASSERT_TRUE(Initialize()); EXPECT_TRUE(client_->client()->WaitForCryptoHandshakeConfirmed()); - QuicString large_body(1024 * 1024, 'a'); + std::string large_body(1024 * 1024, 'a'); SpdyHeaderBlock headers; headers[":method"] = "POST"; headers[":path"] = "/foo"; @@ -1765,7 +1765,7 @@ SetPacketLossPercentage(1); } ASSERT_TRUE(Initialize()); - QuicString large_body(10240, 'a'); + std::string large_body(10240, 'a'); int max_streams = 100; AddToCache("/large_response", 200, large_body); @@ -1785,7 +1785,7 @@ TEST_P(EndToEndTestWithTls, StreamCancelErrorTest) { ASSERT_TRUE(Initialize()); - QuicString small_body(256, 'a'); + std::string small_body(256, 'a'); AddToCache("/small_response", 200, small_body); @@ -2166,7 +2166,7 @@ public: void OnCompleteResponse(QuicStreamId id, const SpdyHeaderBlock& response_headers, - const QuicString& response_body) override { + const std::string& response_body) override { QUIC_DVLOG(1) << "response for stream " << id << " " << response_headers.DebugString() << "\n" << response_body; @@ -2201,8 +2201,8 @@ // Test the AckNotifier's ability to track multiple packets by making the // request body exceed the size of a single packet. - QuicString request_string = - "a request body bigger than one packet" + QuicString(kMaxPacketSize, '.'); + std::string request_string = "a request body bigger than one packet" + + std::string(kMaxPacketSize, '.'); // The TestAckListener will cause a failure if not notified. QuicReferenceCountedPointer<TestAckListener> ack_listener( @@ -2492,7 +2492,7 @@ EmptyQuicConnectionId(), false, false, 1, "At least 20 characters.", CONNECTION_ID_PRESENT, CONNECTION_ID_ABSENT, PACKET_4BYTE_PACKET_NUMBER)); // Damage the encrypted data. - QuicString damaged_packet(packet->data(), packet->length()); + std::string damaged_packet(packet->data(), packet->length()); damaged_packet[30] ^= 0x01; QUIC_DLOG(INFO) << "Sending bad packet."; client_writer_->WritePacket( @@ -2544,7 +2544,7 @@ QuicStreamId id, QuicSpdySession* session, QuicSimpleServerBackend* quic_simple_server_backend, - QuicString response_body) + std::string response_body) : QuicSimpleServerStream(id, session, BIDIRECTIONAL, @@ -2566,12 +2566,12 @@ SendHeadersAndBody(std::move(headers), response_body_); } - QuicString response_body_; + std::string response_body_; }; class StreamWithErrorFactory : public QuicTestServer::StreamFactory { public: - explicit StreamWithErrorFactory(QuicString response_body) + explicit StreamWithErrorFactory(std::string response_body) : response_body_(std::move(response_body)) {} ~StreamWithErrorFactory() override = default; @@ -2585,7 +2585,7 @@ } private: - QuicString response_body_; + std::string response_body_; }; // A test server stream that drops all received body. @@ -2665,7 +2665,7 @@ protected: void SendResponse() override { QuicBackendResponse response; - QuicString body(body_bytes_, 'a'); + std::string body(body_bytes_, 'a'); response.set_body(body); SendHeadersAndBodyAndTrailers(response.headers().Clone(), response.body(), response.trailers().Clone()); @@ -2712,7 +2712,7 @@ // it. uint32_t response_body_size = 2 * client_config_.GetInitialStreamFlowControlWindowToSend(); - QuicString response_body(response_body_size, 'a'); + std::string response_body(response_body_size, 'a'); StreamWithErrorFactory stream_factory(response_body); SetSpdyStreamFactory(&stream_factory); @@ -2738,7 +2738,7 @@ // before the request FIN is processed but receive the request FIN before the // response is sent completely. const uint32_t kRequestBodySize = kMaxPacketSize + 10; - QuicString request_body(kRequestBodySize, 'a'); + std::string request_body(kRequestBodySize, 'a'); // Send the request. client_->SendMessage(headers, request_body); @@ -2774,7 +2774,7 @@ SetReorderPercentage(30); // Add a response with headers, body, and trailers. - const QuicString kBody = "body content"; + const std::string kBody = "body content"; SpdyHeaderBlock headers; headers[":status"] = "200"; @@ -2808,24 +2808,24 @@ // If |resource_size| == 0, response body of push resources use default string // concatenating with resource url. Otherwise, generate a string of // |resource_size| as body. - void AddRequestAndResponseWithServerPush(QuicString host, - QuicString path, - QuicString response_body, - QuicString* push_urls, + void AddRequestAndResponseWithServerPush(std::string host, + std::string path, + std::string response_body, + std::string* push_urls, const size_t num_resources, const size_t resource_size) { bool use_large_response = resource_size != 0; - QuicString large_resource; + std::string large_resource; if (use_large_response) { // Generate a response common body larger than flow control window for // push response. - large_resource = QuicString(resource_size, 'a'); + large_resource = std::string(resource_size, 'a'); } std::list<QuicBackendResponse::ServerPushInfo> push_resources; for (size_t i = 0; i < num_resources; ++i) { - QuicString url = push_urls[i]; + std::string url = push_urls[i]; QuicUrl resource_url(url); - QuicString body = + std::string body = use_large_response ? large_resource : QuicStrCat("This is server push response body for ", url); @@ -2857,12 +2857,12 @@ SetReorderPercentage(30); // Add a response with headers, body, and push resources. - const QuicString kBody = "body content"; + const std::string kBody = "body content"; size_t kNumResources = 4; - QuicString push_urls[] = {"https://example.com/font.woff", - "https://example.com/script.js", - "https://fonts.example.com/font.woff", - "https://example.com/logo-hires.jpg"}; + std::string push_urls[] = {"https://example.com/font.woff", + "https://example.com/script.js", + "https://fonts.example.com/font.woff", + "https://example.com/logo-hires.jpg"}; AddRequestAndResponseWithServerPush("example.com", "/push_example", kBody, push_urls, kNumResources, 0); @@ -2880,11 +2880,11 @@ // hasn't finished yet. EXPECT_TRUE(QuicStreamSequencerPeer::IsUnderlyingBufferAllocated(sequencer)); - for (const QuicString& url : push_urls) { + for (const std::string& url : push_urls) { QUIC_DVLOG(1) << "send request for pushed stream on url " << url; - QuicString expected_body = + std::string expected_body = QuicStrCat("This is server push response body for ", url); - QuicString response_body = client_->SendSynchronousRequest(url); + std::string response_body = client_->SendSynchronousRequest(url); QUIC_DVLOG(1) << "response body " << response_body; EXPECT_EQ(expected_body, response_body); } @@ -2904,9 +2904,9 @@ SetReorderPercentage(30); // Add a response with headers, body, and push resources. - const QuicString kBody = "body content"; + const std::string kBody = "body content"; size_t const kNumResources = 4; - QuicString push_urls[] = { + std::string push_urls[] = { "https://example.com/font.woff", "https://example.com/script.js", "https://fonts.example.com/font.woff", @@ -2924,13 +2924,13 @@ EXPECT_EQ(kBody, client_->SendSynchronousRequest( "https://example.com/push_example")); - for (const QuicString& url : push_urls) { + for (const std::string& url : push_urls) { // Sending subsequent requesets will not actually send anything on the wire, // as the responses are already in the client's cache. QUIC_DVLOG(1) << "send request for pushed stream on url " << url; - QuicString expected_body = + std::string expected_body = QuicStrCat("This is server push response body for ", url); - QuicString response_body = client_->SendSynchronousRequest(url); + std::string response_body = client_->SendSynchronousRequest(url); QUIC_DVLOG(1) << "response body " << response_body; EXPECT_EQ(expected_body, response_body); } @@ -2953,11 +2953,11 @@ SetReorderPercentage(30); // Add a response with headers, body, and push resources. - const QuicString kBody = "body content"; + const std::string kBody = "body content"; // One more resource than max number of outgoing stream of this session. const size_t kNumResources = 1 + kNumMaxStreams; // 11. - QuicString push_urls[11]; + std::string push_urls[11]; for (size_t i = 0; i < kNumResources; ++i) { push_urls[i] = QuicStrCat("https://example.com/push_resources", i); } @@ -2973,7 +2973,7 @@ EXPECT_EQ(kBody, client_->SendSynchronousRequest( "https://example.com/push_example")); - for (const QuicString& url : push_urls) { + for (const std::string& url : push_urls) { // Sending subsequent requesets will not actually send anything on the wire, // as the responses are already in the client's cache. EXPECT_EQ(QuicStrCat("This is server push response body for ", url), @@ -3011,10 +3011,10 @@ SetReorderPercentage(30); // Add a response with headers, body, and push resources. - const QuicString kBody = "body content"; + const std::string kBody = "body content"; const size_t kNumResources = kNumMaxStreams + 1; - QuicString push_urls[11]; + std::string push_urls[11]; for (size_t i = 0; i < kNumResources; ++i) { push_urls[i] = QuicStrCat("http://example.com/push_resources", i); } @@ -3085,7 +3085,7 @@ // Request body size is 4G plus one more kSizeBytes. int64_t request_body_size_bytes = pow(2, 32) + kSizeBytes; ASSERT_LT(INT64_C(4294967296), request_body_size_bytes); - QuicString body(kSizeBytes, 'a'); + std::string body(kSizeBytes, 'a'); SpdyHeaderBlock headers; headers[":method"] = "POST"; @@ -3099,7 +3099,7 @@ for (int i = 0; i < request_body_size_bytes / kSizeBytes; ++i) { bool fin = (i == request_body_size_bytes - 1); - client_->SendData(QuicString(body.data(), kSizeBytes), fin); + client_->SendData(std::string(body.data(), kSizeBytes), fin); client_->client()->WaitForEvents(); } VerifyCleanConnection(true); @@ -3200,7 +3200,7 @@ headers[":path"] = "/foo"; headers[":scheme"] = "https"; headers[":authority"] = server_hostname_; - headers["key"] = QuicString(64 * 1024, 'a'); + headers["key"] = std::string(64 * 1024, 'a'); client_->SendMessage(headers, ""); client_->WaitForResponse(); @@ -3236,7 +3236,7 @@ client_->client()->client_session()->connection(); client_connection->set_debug_visitor(&observer); // 100KB body. - QuicString body(100 * 1024, 'a'); + std::string body(100 * 1024, 'a'); SpdyHeaderBlock headers; headers[":method"] = "POST"; headers[":path"] = "/foo"; @@ -3336,7 +3336,7 @@ std::unique_ptr<QuicTestClient> client(CreateQuicClient(bad_writer)); // 1 MB body. - QuicString body(1024 * 1024, 'a'); + std::string body(1024 * 1024, 'a'); SpdyHeaderBlock headers; headers[":method"] = "POST"; headers[":path"] = "/foo"; @@ -3429,7 +3429,7 @@ // INCOMPLETE_RESPONSE will cause the server to not to send the trailer // (and the FIN) after the response body. - QuicString response_body(1305, 'a'); + std::string response_body(1305, 'a'); SpdyHeaderBlock response_headers; response_headers[":status"] = QuicTextUtils::Uint64ToString(200); response_headers["content-length"] = @@ -3471,7 +3471,7 @@ stream->MaybeSetTtl(QuicTime::Delta::FromMicroseconds(1)); // 1 MB body. - QuicString body(1024 * 1024, 'a'); + std::string body(1024 * 1024, 'a'); stream->WriteOrBufferBody(body, true); client_->WaitForResponse(); EXPECT_EQ(QUIC_STREAM_TTL_EXPIRED, client_->stream_error()); @@ -3490,7 +3490,7 @@ ASSERT_GT(kMaxPacketSize, client_session->GetLargestMessagePayload()); ASSERT_LT(0, client_session->GetLargestMessagePayload()); - QuicString message_string(kMaxPacketSize, 'a'); + std::string message_string(kMaxPacketSize, 'a'); QuicStringPiece message_buffer(message_string); QuicRandom* random = QuicConnectionPeer::GetHelper(client_connection)->GetRandomGenerator(); @@ -3662,7 +3662,7 @@ // STOP_SENDING will cause the server to not to send the trailer // (and the FIN) after the response body. Instead, it sends a STOP_SENDING // frame for the stream. - QuicString response_body(1305, 'a'); + std::string response_body(1305, 'a'); SpdyHeaderBlock response_headers; response_headers[":status"] = QuicTextUtils::Uint64ToString(200); response_headers["content-length"] =
diff --git a/quic/core/http/http_decoder.cc b/quic/core/http/http_decoder.cc index e697821..55879d0 100644 --- a/quic/core/http/http_decoder.cc +++ b/quic/core/http/http_decoder.cc
@@ -355,7 +355,7 @@ remaining_length_field_length_ -= bytes_to_read; } -void HttpDecoder::RaiseError(QuicErrorCode error, QuicString error_detail) { +void HttpDecoder::RaiseError(QuicErrorCode error, std::string error_detail) { state_ = STATE_ERROR; error_ = error; error_detail_ = std::move(error_detail);
diff --git a/quic/core/http/http_decoder.h b/quic/core/http/http_decoder.h index 910d189..d6b1cc1 100644 --- a/quic/core/http/http_decoder.h +++ b/quic/core/http/http_decoder.h
@@ -111,7 +111,7 @@ bool has_payload() { return has_payload_; } QuicErrorCode error() const { return error_; } - const QuicString& error_detail() const { return error_detail_; } + const std::string& error_detail() const { return error_detail_; } private: // Represents the current state of the parsing state machine. @@ -145,7 +145,7 @@ void BufferFrameLength(QuicDataReader* reader); // Sets |error_| and |error_detail_| accordingly. - void RaiseError(QuicErrorCode error, QuicString error_detail); + void RaiseError(QuicErrorCode error, std::string error_detail); // Parses the payload of a PRIORITY frame from |reader| into |frame|. bool ParsePriorityFrame(QuicDataReader* reader, PriorityFrame* frame); @@ -170,14 +170,14 @@ // Last error. QuicErrorCode error_; // The issue which caused |error_| - QuicString error_detail_; + std::string error_detail_; // True if the call to ProcessInput() generates any payload. Flushed every // time ProcessInput() is called. bool has_payload_; // Remaining unparsed data. - QuicString buffer_; + std::string buffer_; // Remaining unparsed length field data. - QuicString length_buffer_; + std::string length_buffer_; }; } // namespace quic
diff --git a/quic/core/http/http_decoder_test.cc b/quic/core/http/http_decoder_test.cc index c6d7d9f..cfabe70 100644 --- a/quic/core/http/http_decoder_test.cc +++ b/quic/core/http/http_decoder_test.cc
@@ -321,12 +321,12 @@ TEST_F(HttpDecoderTest, FrameHeaderPartialDelivery) { // A large input that will occupy more than 1 byte in the length field. - QuicString input(2048, 'x'); + std::string input(2048, 'x'); HttpEncoder encoder; std::unique_ptr<char[]> buffer; QuicByteCount header_length = encoder.SerializeDataFrameHeader(input.length(), &buffer); - QuicString header = QuicString(buffer.get(), header_length); + std::string header = std::string(buffer.get(), header_length); // Partially send only 1 byte of the header to process. EXPECT_EQ(1u, decoder_.ProcessInput(header.data(), 1)); EXPECT_EQ(QUIC_NO_ERROR, decoder_.error());
diff --git a/quic/core/http/quic_client_promised_info.cc b/quic/core/http/quic_client_promised_info.cc index abfc4b4..3cebc1e 100644 --- a/quic/core/http/quic_client_promised_info.cc +++ b/quic/core/http/quic_client_promised_info.cc
@@ -19,7 +19,7 @@ QuicClientPromisedInfo::QuicClientPromisedInfo( QuicSpdyClientSessionBase* session, QuicStreamId id, - QuicString url) + std::string url) : session_(session), id_(id), url_(std::move(url)),
diff --git a/quic/core/http/quic_client_promised_info.h b/quic/core/http/quic_client_promised_info.h index 917c9f7..64ee09e 100644 --- a/quic/core/http/quic_client_promised_info.h +++ b/quic/core/http/quic_client_promised_info.h
@@ -7,11 +7,11 @@ #include <cstddef> -#include "net/third_party/quiche/src/quic/core/quic_alarm.h" #include "net/third_party/quiche/src/quic/core/http/quic_client_push_promise_index.h" -#include "net/third_party/quiche/src/quic/core/quic_packets.h" #include "net/third_party/quiche/src/quic/core/http/quic_spdy_client_session_base.h" #include "net/third_party/quiche/src/quic/core/http/quic_spdy_stream.h" +#include "net/third_party/quiche/src/quic/core/quic_alarm.h" +#include "net/third_party/quiche/src/quic/core/quic_packets.h" #include "net/third_party/quiche/src/quic/platform/api/quic_export.h" #include "net/third_party/quiche/src/quic/platform/api/quic_string.h" #include "net/third_party/quiche/src/spdy/core/spdy_framer.h" @@ -32,7 +32,7 @@ // Interface to QuicSpdyClientStream QuicClientPromisedInfo(QuicSpdyClientSessionBase* session, QuicStreamId id, - QuicString url); + std::string url); QuicClientPromisedInfo(const QuicClientPromisedInfo&) = delete; QuicClientPromisedInfo& operator=(const QuicClientPromisedInfo&) = delete; virtual ~QuicClientPromisedInfo(); @@ -76,7 +76,7 @@ QuicStreamId id() const { return id_; } - const QuicString url() const { return url_; } + const std::string url() const { return url_; } // Return true if there's a request pending matching this push promise. bool is_validating() const { return client_request_delegate_ != nullptr; } @@ -98,7 +98,7 @@ QuicSpdyClientSessionBase* session_; QuicStreamId id_; - QuicString url_; + std::string url_; spdy::SpdyHeaderBlock request_headers_; std::unique_ptr<spdy::SpdyHeaderBlock> response_headers_; spdy::SpdyHeaderBlock client_request_headers_;
diff --git a/quic/core/http/quic_client_promised_info_test.cc b/quic/core/http/quic_client_promised_info_test.cc index 2a7b1b0..43346d9 100644 --- a/quic/core/http/quic_client_promised_info_test.cc +++ b/quic/core/http/quic_client_promised_info_test.cc
@@ -49,7 +49,7 @@ delete; ~MockQuicSpdyClientSession() override {} - bool IsAuthorized(const QuicString& authority) override { + bool IsAuthorized(const std::string& authority) override { return authorized_; } @@ -125,10 +125,10 @@ std::unique_ptr<StreamVisitor> stream_visitor_; std::unique_ptr<QuicSpdyClientStream> promised_stream_; SpdyHeaderBlock headers_; - QuicString body_; + std::string body_; SpdyHeaderBlock push_promise_; QuicStreamId promise_id_; - QuicString promise_url_; + std::string promise_url_; SpdyHeaderBlock client_request_; };
diff --git a/quic/core/http/quic_client_push_promise_index.cc b/quic/core/http/quic_client_push_promise_index.cc index 2ba5951..08a4477 100644 --- a/quic/core/http/quic_client_push_promise_index.cc +++ b/quic/core/http/quic_client_push_promise_index.cc
@@ -19,7 +19,7 @@ QuicClientPushPromiseIndex::TryHandle::~TryHandle() {} QuicClientPromisedInfo* QuicClientPushPromiseIndex::GetPromised( - const QuicString& url) { + const std::string& url) { auto it = promised_by_url_.find(url); if (it == promised_by_url_.end()) { return nullptr; @@ -31,7 +31,7 @@ const spdy::SpdyHeaderBlock& request, QuicClientPushPromiseIndex::Delegate* delegate, TryHandle** handle) { - QuicString url(SpdyUtils::GetPromisedUrlFromHeaders(request)); + std::string url(SpdyUtils::GetPromisedUrlFromHeaders(request)); auto it = promised_by_url_.find(url); if (it != promised_by_url_.end()) { QuicClientPromisedInfo* promised = it->second;
diff --git a/quic/core/http/quic_client_push_promise_index.h b/quic/core/http/quic_client_push_promise_index.h index 5dd29b4..2647924 100644 --- a/quic/core/http/quic_client_push_promise_index.h +++ b/quic/core/http/quic_client_push_promise_index.h
@@ -66,7 +66,7 @@ // Called by client code, used to enforce affinity between requests // for promised streams and the session the promise came from. - QuicClientPromisedInfo* GetPromised(const QuicString& url); + QuicClientPromisedInfo* GetPromised(const std::string& url); // Called by client code, to initiate rendezvous between a request // and a server push stream. If |request|'s url is in the index,
diff --git a/quic/core/http/quic_client_push_promise_index_test.cc b/quic/core/http/quic_client_push_promise_index_test.cc index b68b41f..a4a0ee6 100644 --- a/quic/core/http/quic_client_push_promise_index_test.cc +++ b/quic/core/http/quic_client_push_promise_index_test.cc
@@ -73,7 +73,7 @@ MockQuicSpdyClientSession session_; QuicClientPushPromiseIndex index_; spdy::SpdyHeaderBlock request_; - QuicString url_; + std::string url_; MockQuicClientPromisedInfo promised_; QuicClientPushPromiseIndex::TryHandle* handle_; };
diff --git a/quic/core/http/quic_header_list.cc b/quic/core/http/quic_header_list.cc index cb10248..e937cf2 100644 --- a/quic/core/http/quic_header_list.cc +++ b/quic/core/http/quic_header_list.cc
@@ -40,7 +40,7 @@ current_header_list_size_ += name.size(); current_header_list_size_ += value.size(); current_header_list_size_ += spdy::kPerHeaderOverhead; - header_list_.emplace_back(QuicString(name), QuicString(value)); + header_list_.emplace_back(std::string(name), std::string(value)); } } @@ -60,8 +60,8 @@ compressed_header_bytes_ = 0; } -QuicString QuicHeaderList::DebugString() const { - QuicString s = "{ "; +std::string QuicHeaderList::DebugString() const { + std::string s = "{ "; for (const auto& p : *this) { s.append(p.first + "=" + p.second + ", "); }
diff --git a/quic/core/http/quic_header_list.h b/quic/core/http/quic_header_list.h index c7b4c80..b62cba4 100644 --- a/quic/core/http/quic_header_list.h +++ b/quic/core/http/quic_header_list.h
@@ -23,7 +23,7 @@ class QUIC_EXPORT_PRIVATE QuicHeaderList : public spdy::SpdyHeadersHandlerInterface { public: - typedef QuicDeque<std::pair<QuicString, QuicString>> ListType; + typedef QuicDeque<std::pair<std::string, std::string>> ListType; typedef ListType::const_iterator const_iterator; QuicHeaderList(); @@ -56,10 +56,10 @@ size_t max_header_list_size() const { return max_header_list_size_; } - QuicString DebugString() const; + std::string DebugString() const; private: - QuicDeque<std::pair<QuicString, QuicString>> header_list_; + QuicDeque<std::pair<std::string, std::string>> header_list_; // The limit on the size of the header list (defined by spec as name + value + // overhead for each header field). Headers over this limit will not be @@ -76,8 +76,8 @@ }; inline bool operator==(const QuicHeaderList& l1, const QuicHeaderList& l2) { - auto pred = [](const std::pair<QuicString, QuicString>& p1, - const std::pair<QuicString, QuicString>& p2) { + auto pred = [](const std::pair<std::string, std::string>& p1, + const std::pair<std::string, std::string>& p2) { return p1.first == p2.first && p1.second == p2.second; }; return std::equal(l1.begin(), l1.end(), l2.begin(), pred);
diff --git a/quic/core/http/quic_header_list_test.cc b/quic/core/http/quic_header_list_test.cc index 1b2a394..c098715 100644 --- a/quic/core/http/quic_header_list_test.cc +++ b/quic/core/http/quic_header_list_test.cc
@@ -24,8 +24,8 @@ TEST_F(QuicHeaderListTest, TooLarge) { QuicHeaderList headers; - QuicString key = "key"; - QuicString value(1 << 18, '1'); + std::string key = "key"; + std::string value(1 << 18, '1'); // Send a header that exceeds max_header_list_size. headers.OnHeader(key, value); // Send a second header exceeding max_header_list_size. @@ -42,8 +42,8 @@ TEST_F(QuicHeaderListTest, NotTooLarge) { QuicHeaderList headers; headers.set_max_header_list_size(1 << 20); - QuicString key = "key"; - QuicString value(1 << 18, '1'); + std::string key = "key"; + std::string value(1 << 18, '1'); headers.OnHeader(key, value); size_t total_bytes = key.size() + value.size(); headers.OnHeaderBlockEnd(total_bytes, total_bytes);
diff --git a/quic/core/http/quic_headers_stream_test.cc b/quic/core/http/quic_headers_stream_test.cc index b6409b1..7059b72 100644 --- a/quic/core/http/quic_headers_stream_test.cc +++ b/quic/core/http/quic_headers_stream_test.cc
@@ -344,10 +344,10 @@ QuicHeadersStream* headers_stream_; SpdyHeaderBlock headers_; std::unique_ptr<TestHeadersHandler> headers_handler_; - QuicString body_; - QuicString saved_data_; - QuicString saved_header_data_; - QuicString saved_payloads_; + std::string body_; + std::string saved_data_; + std::string saved_header_data_; + std::string saved_payloads_; std::unique_ptr<SpdyFramer> framer_; std::unique_ptr<http2::Http2DecoderAdapter> deframer_; StrictMock<MockVisitor> visitor_; @@ -360,7 +360,8 @@ }; // Run all tests with each version and perspective (client or server). -INSTANTIATE_TEST_SUITE_P(Tests, QuicHeadersStreamTest, +INSTANTIATE_TEST_SUITE_P(Tests, + QuicHeadersStreamTest, ::testing::ValuesIn(GetTestParams())); TEST_P(QuicHeadersStreamTest, StreamId) { @@ -539,9 +540,9 @@ // We want to create a frame that is more than the SPDY Framer's max control // frame size, which is 16K, but less than the HPACK decoders max decode // buffer size, which is 32K. - headers_["key0"] = QuicString(1 << 13, '.'); - headers_["key1"] = QuicString(1 << 13, '.'); - headers_["key2"] = QuicString(1 << 13, '.'); + headers_["key0"] = std::string(1 << 13, '.'); + headers_["key1"] = std::string(1 << 13, '.'); + headers_["key2"] = std::string(1 << 13, '.'); for (QuicStreamId stream_id = client_id_1_; stream_id < client_id_3_; stream_id += next_stream_id_) { for (bool fin : {false, true}) { @@ -725,9 +726,9 @@ // Create some headers we expect to generate entries in HPACK's // dynamic table, in addition to content-length. - headers_["key0"] = QuicString(1 << 1, '.'); - headers_["key1"] = QuicString(1 << 2, '.'); - headers_["key2"] = QuicString(1 << 3, '.'); + headers_["key0"] = std::string(1 << 1, '.'); + headers_["key1"] = std::string(1 << 2, '.'); + headers_["key2"] = std::string(1 << 3, '.'); for (QuicStreamId stream_id = client_id_1_; stream_id < client_id_3_; stream_id += next_stream_id_) { for (bool fin : {false, true}) {
diff --git a/quic/core/http/quic_server_session_base.cc b/quic/core/http/quic_server_session_base.cc index f240ece..6c6acdf 100644 --- a/quic/core/http/quic_server_session_base.cc +++ b/quic/core/http/quic_server_session_base.cc
@@ -80,7 +80,7 @@ } void QuicServerSessionBase::OnConnectionClosed(QuicErrorCode error, - const QuicString& error_details, + const std::string& error_details, ConnectionCloseSource source) { QuicSession::OnConnectionClosed(error, error_details, source); // In the unlikely event we get a connection close while doing an asynchronous
diff --git a/quic/core/http/quic_server_session_base.h b/quic/core/http/quic_server_session_base.h index 55a8d60..7332640 100644 --- a/quic/core/http/quic_server_session_base.h +++ b/quic/core/http/quic_server_session_base.h
@@ -47,7 +47,7 @@ // Override the base class to cancel any ongoing asychronous crypto. void OnConnectionClosed(QuicErrorCode error, - const QuicString& error_details, + const std::string& error_details, ConnectionCloseSource source) override; // Sends a server config update to the client, containing new bandwidth @@ -66,7 +66,7 @@ // client. void OnConfigNegotiated() override; - void set_serving_region(const QuicString& serving_region) { + void set_serving_region(const std::string& serving_region) { serving_region_ = serving_region; } @@ -120,7 +120,7 @@ // Text describing server location. Sent to the client as part of the bandwith // estimate in the source-address token. Optional, can be left empty. - QuicString serving_region_; + std::string serving_region_; // Time at which we send the last SCUP to the client. QuicTime last_scup_time_;
diff --git a/quic/core/http/quic_server_session_base_test.cc b/quic/core/http/quic_server_session_base_test.cc index efc2388..5678b26 100644 --- a/quic/core/http/quic_server_session_base_test.cc +++ b/quic/core/http/quic_server_session_base_test.cc
@@ -492,7 +492,7 @@ int32_t bandwidth_estimate_kbytes_per_second = 123; int32_t max_bandwidth_estimate_kbytes_per_second = 134; int32_t max_bandwidth_estimate_timestamp = 1122334455; - const QuicString serving_region = "not a real region"; + const std::string serving_region = "not a real region"; session_->set_serving_region(serving_region); session_->UnregisterStreamPriority( @@ -601,7 +601,7 @@ copt.push_back(kBWRE); QuicConfigPeer::SetReceivedConnectionOptions(session_->config(), copt); - const QuicString kTestServingRegion = "a serving region"; + const std::string kTestServingRegion = "a serving region"; session_->set_serving_region(kTestServingRegion); // Set the time to be one hour + one second from the 0 baseline. @@ -703,7 +703,7 @@ std::vector<ParsedQuicVersion> packet_version_list = {GetParam()}; std::unique_ptr<QuicEncryptedPacket> packet(ConstructEncryptedPacket( TestConnectionId(1), EmptyQuicConnectionId(), true, false, 1, - QuicString(chlo.GetSerialized().AsStringPiece()), CONNECTION_ID_PRESENT, + std::string(chlo.GetSerialized().AsStringPiece()), CONNECTION_ID_PRESENT, CONNECTION_ID_ABSENT, PACKET_4BYTE_PACKET_NUMBER, &packet_version_list)); EXPECT_CALL(stream_helper_, CanAcceptClientHello(_, _, _, _, _))
diff --git a/quic/core/http/quic_spdy_client_session.cc b/quic/core/http/quic_spdy_client_session.cc index 9e8170b..45eb0ae 100644 --- a/quic/core/http/quic_spdy_client_session.cc +++ b/quic/core/http/quic_spdy_client_session.cc
@@ -175,7 +175,7 @@ this); } -bool QuicSpdyClientSession::IsAuthorized(const QuicString& authority) { +bool QuicSpdyClientSession::IsAuthorized(const std::string& authority) { return true; }
diff --git a/quic/core/http/quic_spdy_client_session.h b/quic/core/http/quic_spdy_client_session.h index c92753b..3bb8168 100644 --- a/quic/core/http/quic_spdy_client_session.h +++ b/quic/core/http/quic_spdy_client_session.h
@@ -43,7 +43,7 @@ QuicCryptoClientStreamBase* GetMutableCryptoStream() override; const QuicCryptoClientStreamBase* GetCryptoStream() const override; - bool IsAuthorized(const QuicString& authority) override; + bool IsAuthorized(const std::string& authority) override; // QuicSpdyClientSessionBase methods: void OnProofValid(const QuicCryptoClientConfig::CachedState& cached) override;
diff --git a/quic/core/http/quic_spdy_client_session_base.cc b/quic/core/http/quic_spdy_client_session_base.cc index 924ab36..b0dfc01 100644 --- a/quic/core/http/quic_spdy_client_session_base.cc +++ b/quic/core/http/quic_spdy_client_session_base.cc
@@ -118,7 +118,7 @@ return false; } - const QuicString url = SpdyUtils::GetPromisedUrlFromHeaders(headers); + const std::string url = SpdyUtils::GetPromisedUrlFromHeaders(headers); QuicClientPromisedInfo* old_promised = GetPromisedByUrl(url); if (old_promised) { QUIC_DVLOG(1) << "Promise for stream " << promised_id @@ -150,7 +150,7 @@ } QuicClientPromisedInfo* QuicSpdyClientSessionBase::GetPromisedByUrl( - const QuicString& url) { + const std::string& url) { auto it = push_promise_index_->promised_by_url()->find(url); if (it != push_promise_index_->promised_by_url()->end()) { return it->second;
diff --git a/quic/core/http/quic_spdy_client_session_base.h b/quic/core/http/quic_spdy_client_session_base.h index f27708c..a47bdd0 100644 --- a/quic/core/http/quic_spdy_client_session_base.h +++ b/quic/core/http/quic_spdy_client_session_base.h
@@ -6,8 +6,8 @@ #define QUICHE_QUIC_CORE_HTTP_QUIC_SPDY_CLIENT_SESSION_BASE_H_ #include "base/macros.h" -#include "net/third_party/quiche/src/quic/core/quic_crypto_client_stream.h" #include "net/third_party/quiche/src/quic/core/http/quic_spdy_session.h" +#include "net/third_party/quiche/src/quic/core/quic_crypto_client_stream.h" #include "net/third_party/quiche/src/quic/platform/api/quic_containers.h" #include "net/third_party/quiche/src/quic/platform/api/quic_export.h" #include "net/third_party/quiche/src/quic/platform/api/quic_string.h" @@ -25,7 +25,7 @@ // session affinity for requests corresponding to cross-origin push // promised streams. using QuicPromisedByUrlMap = - QuicUnorderedMap<QuicString, QuicClientPromisedInfo*>; + QuicUnorderedMap<std::string, QuicClientPromisedInfo*>; // The maximum time a promises stream can be reserved without being // claimed by a client request. @@ -80,10 +80,10 @@ // list in the certificate should contain a matching DNS name, or IP // address. |hostname| is derived from the ":authority" header field of // the PUSH_PROMISE frame, port if present there will be dropped. - virtual bool IsAuthorized(const QuicString& hostname) = 0; + virtual bool IsAuthorized(const std::string& hostname) = 0; // Session retains ownership. - QuicClientPromisedInfo* GetPromisedByUrl(const QuicString& url); + QuicClientPromisedInfo* GetPromisedByUrl(const std::string& url); // Session retains ownership. QuicClientPromisedInfo* GetPromisedById(const QuicStreamId id);
diff --git a/quic/core/http/quic_spdy_client_session_test.cc b/quic/core/http/quic_spdy_client_session_test.cc index 3a40043..6b80196 100644 --- a/quic/core/http/quic_spdy_client_session_test.cc +++ b/quic/core/http/quic_spdy_client_session_test.cc
@@ -165,7 +165,7 @@ std::unique_ptr<TestQuicSpdyClientSession> session_; QuicClientPushPromiseIndex push_promise_index_; SpdyHeaderBlock push_promise_; - QuicString promise_url_; + std::string promise_url_; QuicStreamId promised_stream_id_; QuicStreamId associated_stream_id_; }; @@ -636,7 +636,8 @@ session_->HandlePromised(associated_stream_id_, id, push_promise_)); // Verify that the promise is in the unclaimed streams map. - QuicString promise_url(SpdyUtils::GetPromisedUrlFromHeaders(push_promise_)); + std::string promise_url( + SpdyUtils::GetPromisedUrlFromHeaders(push_promise_)); EXPECT_NE(session_->GetPromisedByUrl(promise_url), nullptr); EXPECT_NE(session_->GetPromisedById(id), nullptr); } @@ -654,7 +655,7 @@ session_->HandlePromised(associated_stream_id_, id, push_promise_)); // Verify that the promise was not created. - QuicString promise_url(SpdyUtils::GetPromisedUrlFromHeaders(push_promise_)); + std::string promise_url(SpdyUtils::GetPromisedUrlFromHeaders(push_promise_)); EXPECT_EQ(session_->GetPromisedById(id), nullptr); EXPECT_EQ(session_->GetPromisedByUrl(promise_url), nullptr); }
diff --git a/quic/core/http/quic_spdy_client_stream.h b/quic/core/http/quic_spdy_client_stream.h index 8a66740..521914a 100644 --- a/quic/core/http/quic_spdy_client_stream.h +++ b/quic/core/http/quic_spdy_client_stream.h
@@ -57,7 +57,7 @@ bool fin); // Returns the response data. - const QuicString& data() { return data_; } + const std::string& data() { return data_; } // Returns whatever headers have been received for this stream. const spdy::SpdyHeaderBlock& response_headers() { return response_headers_; } @@ -83,7 +83,7 @@ // The parsed content-length, or -1 if none is specified. int64_t content_length_; int response_code_; - QuicString data_; + std::string data_; size_t header_bytes_read_; size_t header_bytes_written_;
diff --git a/quic/core/http/quic_spdy_client_stream_test.cc b/quic/core/http/quic_spdy_client_stream_test.cc index 0b2c157..3c56630 100644 --- a/quic/core/http/quic_spdy_client_stream_test.cc +++ b/quic/core/http/quic_spdy_client_stream_test.cc
@@ -97,7 +97,7 @@ std::unique_ptr<QuicSpdyClientStream> stream_; std::unique_ptr<StreamVisitor> stream_visitor_; SpdyHeaderBlock headers_; - QuicString body_; + std::string body_; HttpEncoder encoder_; }; @@ -124,10 +124,10 @@ std::unique_ptr<char[]> buffer; QuicByteCount header_length = encoder_.SerializeDataFrameHeader(body_.length(), &buffer); - QuicString header = QuicString(buffer.get(), header_length); - QuicString data = VersionHasDataFrameHeader(connection_->transport_version()) - ? header + body_ - : body_; + std::string header = std::string(buffer.get(), header_length); + std::string data = VersionHasDataFrameHeader(connection_->transport_version()) + ? header + body_ + : body_; stream_->OnStreamFrame( QuicStreamFrame(stream_->id(), /*fin=*/false, /*offset=*/0, data)); EXPECT_EQ("200", stream_->response_headers().find(":status")->second); @@ -155,10 +155,10 @@ std::unique_ptr<char[]> buffer; QuicByteCount header_length = encoder_.SerializeDataFrameHeader(body_.length(), &buffer); - QuicString header = QuicString(buffer.get(), header_length); - QuicString data = VersionHasDataFrameHeader(connection_->transport_version()) - ? header + body_ - : body_; + std::string header = std::string(buffer.get(), header_length); + std::string data = VersionHasDataFrameHeader(connection_->transport_version()) + ? header + body_ + : body_; stream_->OnStreamFrame( QuicStreamFrame(stream_->id(), /*fin=*/false, /*offset=*/0, data)); EXPECT_EQ("200", stream_->response_headers().find(":status")->second); @@ -168,7 +168,7 @@ TEST_P(QuicSpdyClientStreamTest, QUIC_TEST_DISABLED_IN_CHROME(TestFramingExtraData)) { - QuicString large_body = "hello world!!!!!!"; + std::string large_body = "hello world!!!!!!"; auto headers = AsHeaderList(headers_); stream_->OnStreamHeaderList(false, headers.uncompressed_header_bytes(), @@ -180,10 +180,10 @@ std::unique_ptr<char[]> buffer; QuicByteCount header_length = encoder_.SerializeDataFrameHeader(large_body.length(), &buffer); - QuicString header = QuicString(buffer.get(), header_length); - QuicString data = VersionHasDataFrameHeader(connection_->transport_version()) - ? header + large_body - : large_body; + std::string header = std::string(buffer.get(), header_length); + std::string data = VersionHasDataFrameHeader(connection_->transport_version()) + ? header + large_body + : large_body; EXPECT_CALL(*connection_, SendControlFrame(_)); EXPECT_CALL(*connection_, OnStreamReset(stream_->id(), QUIC_BAD_APPLICATION_PAYLOAD)); @@ -219,10 +219,10 @@ std::unique_ptr<char[]> buffer; QuicByteCount header_length = encoder_.SerializeDataFrameHeader(body_.length(), &buffer); - QuicString header = QuicString(buffer.get(), header_length); - QuicString data = VersionHasDataFrameHeader(connection_->transport_version()) - ? header + body_ - : body_; + std::string header = std::string(buffer.get(), header_length); + std::string data = VersionHasDataFrameHeader(connection_->transport_version()) + ? header + body_ + : body_; stream_->OnStreamFrame( QuicStreamFrame(stream_->id(), /*fin=*/false, /*offset=*/0, data)); EXPECT_TRUE(stream_->reading_stopped());
diff --git a/quic/core/http/quic_spdy_session.cc b/quic/core/http/quic_spdy_session.cc index ddae51a..415129e 100644 --- a/quic/core/http/quic_spdy_session.cc +++ b/quic/core/http/quic_spdy_session.cc
@@ -283,7 +283,7 @@ } private: - void CloseConnection(const QuicString& details, QuicErrorCode code) { + void CloseConnection(const std::string& details, QuicErrorCode code) { if (session_->IsConnected()) { session_->CloseConnectionWithDetails(code, details); } @@ -419,8 +419,8 @@ // byte offset necessary for flow control and open stream accounting. size_t final_byte_offset = 0; for (const auto& header : header_list) { - const QuicString& header_key = header.first; - const QuicString& header_value = header.second; + const std::string& header_key = header.first; + const std::string& header_value = header.second; if (header_key == kFinalOffsetHeaderKey) { if (!QuicTextUtils::StringToSizeT(header_value, &final_byte_offset)) { connection()->CloseConnection( @@ -577,7 +577,8 @@ QuicStreamId promised_stream_id, size_t frame_len, const QuicHeaderList& header_list) { - QuicString error = "OnPromiseHeaderList should be overridden in client code."; + std::string error = + "OnPromiseHeaderList should be overridden in client code."; QUIC_BUG << error; connection()->CloseConnection(QUIC_INTERNAL_ERROR, error, ConnectionCloseBehavior::SILENT_CLOSE); @@ -688,7 +689,7 @@ } void QuicSpdySession::CloseConnectionWithDetails(QuicErrorCode error, - const QuicString& details) { + const std::string& details) { connection()->CloseConnection( error, details, ConnectionCloseBehavior::SEND_CONNECTION_CLOSE_PACKET); }
diff --git a/quic/core/http/quic_spdy_session.h b/quic/core/http/quic_spdy_session.h index 93067fa..c13daeb 100644 --- a/quic/core/http/quic_spdy_session.h +++ b/quic/core/http/quic_spdy_session.h
@@ -153,7 +153,7 @@ virtual bool ShouldReleaseHeadersStreamSequencerBuffer(); void CloseConnectionWithDetails(QuicErrorCode error, - const QuicString& details); + const std::string& details); void set_max_inbound_header_list_size(size_t max_inbound_header_list_size) { max_inbound_header_list_size_ = max_inbound_header_list_size;
diff --git a/quic/core/http/quic_spdy_session_test.cc b/quic/core/http/quic_spdy_session_test.cc index 1c53472..1087493 100644 --- a/quic/core/http/quic_spdy_session_test.cc +++ b/quic/core/http/quic_spdy_session_test.cc
@@ -64,7 +64,7 @@ encryption_established_ = true; handshake_confirmed_ = true; CryptoHandshakeMessage msg; - QuicString error_details; + std::string error_details; session()->config()->SetInitialStreamFlowControlWindowToSend( kInitialStreamFlowControlWindowForTest); session()->config()->SetInitialSessionFlowControlWindowToSend( @@ -569,7 +569,7 @@ EXPECT_CALL(*connection_, SendControlFrame(_)); EXPECT_CALL(*connection_, OnStreamReset(closed_stream_id, _)); stream2->Reset(QUIC_BAD_APPLICATION_PAYLOAD); - QuicString msg = + std::string msg = QuicStrCat("Marking unknown stream ", closed_stream_id, " blocked."); EXPECT_QUIC_BUG(session_.MarkConnectionLevelWriteBlocked(closed_stream_id), msg); @@ -1086,7 +1086,7 @@ // Create a stream, and send enough data to make it flow control blocked. TestStream* stream2 = session_.CreateOutgoingBidirectionalStream(); - QuicString body(kMinimumFlowControlSendWindow, '.'); + std::string body(kMinimumFlowControlSendWindow, '.'); EXPECT_FALSE(stream2->flow_controller()->IsBlocked()); EXPECT_FALSE(session_.IsConnectionFlowControlBlocked()); EXPECT_FALSE(session_.IsStreamFlowControlBlocked()); @@ -1321,7 +1321,7 @@ // adjusting the connection level flow control receive window to take into // account the total number of bytes sent by the peer. const QuicStreamOffset kByteOffset = 5678; - QuicString body = "hello"; + std::string body = "hello"; QuicStreamFrame frame(stream->id(), true, kByteOffset, QuicStringPiece(body)); session_.OnStreamFrame(frame);
diff --git a/quic/core/http/quic_spdy_stream.cc b/quic/core/http/quic_spdy_stream.cc index 9e9f1b7..cdd61c4 100644 --- a/quic/core/http/quic_spdy_stream.cc +++ b/quic/core/http/quic_spdy_stream.cc
@@ -98,7 +98,7 @@ } private: - void CloseConnectionOnWrongFrame(QuicString frame_type) { + void CloseConnectionOnWrongFrame(std::string frame_type) { stream_->session()->connection()->CloseConnection( QUIC_HTTP_DECODER_ERROR, frame_type + " frame received on data stream", ConnectionCloseBehavior::SEND_CONNECTION_CLOSE_PACKET);
diff --git a/quic/core/http/quic_spdy_stream_body_buffer_test.cc b/quic/core/http/quic_spdy_stream_body_buffer_test.cc index 7ea776f..deaf54a 100644 --- a/quic/core/http/quic_spdy_stream_body_buffer_test.cc +++ b/quic/core/http/quic_spdy_stream_body_buffer_test.cc
@@ -25,7 +25,7 @@ MOCK_METHOD0(OnFinRead, void()); MOCK_METHOD0(OnDataAvailable, void()); MOCK_METHOD2(CloseConnectionWithDetails, - void(QuicErrorCode error, const QuicString& details)); + void(QuicErrorCode error, const std::string& details)); MOCK_METHOD1(Reset, void(QuicRstStreamErrorCode error)); MOCK_METHOD0(OnCanWrite, void()); MOCK_METHOD1(AddBytesConsumed, void(QuicByteCount bytes)); @@ -61,7 +61,7 @@ }; TEST_F(QuicSpdyStreamBodyBufferTest, ReceiveBodies) { - QuicString body(1024, 'a'); + std::string body(1024, 'a'); EXPECT_FALSE(body_buffer_.HasBytesToRead()); body_buffer_.OnDataHeader(Http3FrameLengths(3, 1024)); body_buffer_.OnDataPayload(QuicStringPiece(body)); @@ -70,7 +70,7 @@ } TEST_F(QuicSpdyStreamBodyBufferTest, PeekBody) { - QuicString body(1024, 'a'); + std::string body(1024, 'a'); body_buffer_.OnDataHeader(Http3FrameLengths(3, 1024)); body_buffer_.OnDataPayload(QuicStringPiece(body)); EXPECT_EQ(1024u, body_buffer_.total_body_bytes_received()); @@ -84,13 +84,13 @@ // Buffer only receives 1 frame. Stream consumes less or equal than a frame. TEST_F(QuicSpdyStreamBodyBufferTest, MarkConsumedPartialSingleFrame) { testing::InSequence seq; - QuicString body(1024, 'a'); + std::string body(1024, 'a'); std::unique_ptr<char[]> buffer; QuicByteCount header_length = encoder_.SerializeDataFrameHeader(body.length(), &buffer); - QuicString header = QuicString(buffer.get(), header_length); + std::string header = std::string(buffer.get(), header_length); Http3FrameLengths lengths(header_length, 1024); - QuicString data = header + body; + std::string data = header + body; QuicStreamFrame frame(1, false, 0, data); sequencer_.OnStreamFrame(frame); body_buffer_.OnDataHeader(lengths); @@ -104,25 +104,25 @@ TEST_F(QuicSpdyStreamBodyBufferTest, MarkConsumedMultipleFrames) { testing::InSequence seq; // 1st frame. - QuicString body1(1024, 'a'); + std::string body1(1024, 'a'); std::unique_ptr<char[]> buffer; QuicByteCount header_length1 = encoder_.SerializeDataFrameHeader(body1.length(), &buffer); - QuicString header1 = QuicString(buffer.get(), header_length1); + std::string header1 = std::string(buffer.get(), header_length1); Http3FrameLengths lengths1(header_length1, 1024); - QuicString data1 = header1 + body1; + std::string data1 = header1 + body1; QuicStreamFrame frame1(1, false, 0, data1); sequencer_.OnStreamFrame(frame1); body_buffer_.OnDataHeader(lengths1); body_buffer_.OnDataPayload(QuicStringPiece(body1)); // 2nd frame. - QuicString body2(2048, 'b'); + std::string body2(2048, 'b'); QuicByteCount header_length2 = encoder_.SerializeDataFrameHeader(body2.length(), &buffer); - QuicString header2 = QuicString(buffer.get(), header_length2); + std::string header2 = std::string(buffer.get(), header_length2); Http3FrameLengths lengths2(header_length2, 2048); - QuicString data2 = header2 + body2; + std::string data2 = header2 + body2; QuicStreamFrame frame2(1, false, data1.length(), data2); sequencer_.OnStreamFrame(frame2); body_buffer_.OnDataHeader(lengths2); @@ -139,7 +139,7 @@ } TEST_F(QuicSpdyStreamBodyBufferTest, MarkConsumedMoreThanBuffered) { - QuicString body(1024, 'a'); + std::string body(1024, 'a'); Http3FrameLengths lengths(3, 1024); body_buffer_.OnDataHeader(lengths); body_buffer_.OnDataPayload(body); @@ -152,13 +152,13 @@ // Buffer receives 1 frame. Stream read from the buffer. TEST_F(QuicSpdyStreamBodyBufferTest, ReadSingleBody) { testing::InSequence seq; - QuicString body(1024, 'a'); + std::string body(1024, 'a'); std::unique_ptr<char[]> buffer; QuicByteCount header_length = encoder_.SerializeDataFrameHeader(body.length(), &buffer); - QuicString header = QuicString(buffer.get(), header_length); + std::string header = std::string(buffer.get(), header_length); Http3FrameLengths lengths(header_length, 1024); - QuicString data = header + body; + std::string data = header + body; QuicStreamFrame frame(1, false, 0, data); sequencer_.OnStreamFrame(frame); body_buffer_.OnDataHeader(lengths); @@ -179,25 +179,25 @@ TEST_F(QuicSpdyStreamBodyBufferTest, ReadMultipleBody) { testing::InSequence seq; // 1st frame. - QuicString body1(1024, 'a'); + std::string body1(1024, 'a'); std::unique_ptr<char[]> buffer; QuicByteCount header_length1 = encoder_.SerializeDataFrameHeader(body1.length(), &buffer); - QuicString header1 = QuicString(buffer.get(), header_length1); + std::string header1 = std::string(buffer.get(), header_length1); Http3FrameLengths lengths1(header_length1, 1024); - QuicString data1 = header1 + body1; + std::string data1 = header1 + body1; QuicStreamFrame frame1(1, false, 0, data1); sequencer_.OnStreamFrame(frame1); body_buffer_.OnDataHeader(lengths1); body_buffer_.OnDataPayload(QuicStringPiece(body1)); // 2nd frame. - QuicString body2(2048, 'b'); + std::string body2(2048, 'b'); QuicByteCount header_length2 = encoder_.SerializeDataFrameHeader(body2.length(), &buffer); - QuicString header2 = QuicString(buffer.get(), header_length2); + std::string header2 = std::string(buffer.get(), header_length2); Http3FrameLengths lengths2(header_length2, 2048); - QuicString data2 = header2 + body2; + std::string data2 = header2 + body2; QuicStreamFrame frame2(1, false, data1.length(), data2); sequencer_.OnStreamFrame(frame2); body_buffer_.OnDataHeader(lengths2);
diff --git a/quic/core/http/quic_spdy_stream_test.cc b/quic/core/http/quic_spdy_stream_test.cc index 1aabe0e..d61d197 100644 --- a/quic/core/http/quic_spdy_stream_test.cc +++ b/quic/core/http/quic_spdy_stream_test.cc
@@ -67,7 +67,7 @@ vec.iov_base = buffer; vec.iov_len = QUIC_ARRAYSIZE(buffer); size_t bytes_read = Readv(&vec, 1); - data_ += QuicString(buffer, bytes_read); + data_ += std::string(buffer, bytes_read); } MOCK_METHOD1(WriteHeadersMock, void(bool fin)); @@ -81,13 +81,13 @@ return 0; } - const QuicString& data() const { return data_; } + const std::string& data() const { return data_; } const spdy::SpdyHeaderBlock& saved_headers() const { return saved_headers_; } private: bool should_process_data_; spdy::SpdyHeaderBlock saved_headers_; - QuicString data_; + std::string data_; }; class TestMockUpdateStreamSession : public MockQuicSpdySession { @@ -192,7 +192,8 @@ HttpEncoder encoder_; }; -INSTANTIATE_TEST_SUITE_P(Tests, QuicSpdyStreamTest, +INSTANTIATE_TEST_SUITE_P(Tests, + QuicSpdyStreamTest, ::testing::ValuesIn(AllSupportedVersions())); TEST_P(QuicSpdyStreamTest, ProcessHeaderList) { @@ -295,7 +296,7 @@ TEST_P(QuicSpdyStreamTest, MarkHeadersConsumed) { Initialize(kShouldProcessData); - QuicString body = "this is the body"; + std::string body = "this is the body"; QuicHeaderList headers = ProcessHeaders(false, headers_); EXPECT_EQ(headers, stream_->header_list()); @@ -306,12 +307,12 @@ TEST_P(QuicSpdyStreamTest, ProcessHeadersAndBody) { Initialize(kShouldProcessData); - QuicString body = "this is the body"; + std::string body = "this is the body"; std::unique_ptr<char[]> buffer; QuicByteCount header_length = encoder_.SerializeDataFrameHeader(body.length(), &buffer); - QuicString header = QuicString(buffer.get(), header_length); - QuicString data = HasFrameHeader() ? header + body : body; + std::string header = std::string(buffer.get(), header_length); + std::string data = HasFrameHeader() ? header + body : body; EXPECT_EQ("", stream_->data()); QuicHeaderList headers = ProcessHeaders(false, headers_); @@ -326,12 +327,12 @@ TEST_P(QuicSpdyStreamTest, ProcessHeadersAndBodyFragments) { Initialize(kShouldProcessData); - QuicString body = "this is the body"; + std::string body = "this is the body"; std::unique_ptr<char[]> buffer; QuicByteCount header_length = encoder_.SerializeDataFrameHeader(body.length(), &buffer); - QuicString header = QuicString(buffer.get(), header_length); - QuicString data = HasFrameHeader() ? header + body : body; + std::string header = std::string(buffer.get(), header_length); + std::string data = HasFrameHeader() ? header + body : body; for (size_t fragment_size = 1; fragment_size < data.size(); ++fragment_size) { Initialize(kShouldProcessData); @@ -352,12 +353,12 @@ TEST_P(QuicSpdyStreamTest, ProcessHeadersAndBodyFragmentsSplit) { Initialize(kShouldProcessData); - QuicString body = "this is the body"; + std::string body = "this is the body"; std::unique_ptr<char[]> buffer; QuicByteCount header_length = encoder_.SerializeDataFrameHeader(body.length(), &buffer); - QuicString header = QuicString(buffer.get(), header_length); - QuicString data = HasFrameHeader() ? header + body : body; + std::string header = std::string(buffer.get(), header_length); + std::string data = HasFrameHeader() ? header + body : body; for (size_t split_point = 1; split_point < data.size() - 1; ++split_point) { Initialize(kShouldProcessData); @@ -383,12 +384,12 @@ TEST_P(QuicSpdyStreamTest, ProcessHeadersAndBodyReadv) { Initialize(!kShouldProcessData); - QuicString body = "this is the body"; + std::string body = "this is the body"; std::unique_ptr<char[]> buf; QuicByteCount header_length = encoder_.SerializeDataFrameHeader(body.length(), &buf); - QuicString header = QuicString(buf.get(), header_length); - QuicString data = HasFrameHeader() ? header + body : body; + std::string header = std::string(buf.get(), header_length); + std::string data = HasFrameHeader() ? header + body : body; ProcessHeaders(false, headers_); QuicStreamFrame frame(GetNthClientInitiatedBidirectionalId(0), false, 0, @@ -404,17 +405,17 @@ size_t bytes_read = stream_->Readv(&vec, 1); EXPECT_EQ(body.length(), bytes_read); - EXPECT_EQ(body, QuicString(buffer, bytes_read)); + EXPECT_EQ(body, std::string(buffer, bytes_read)); } TEST_P(QuicSpdyStreamTest, ProcessHeadersAndLargeBodySmallReadv) { Initialize(kShouldProcessData); - QuicString body(12 * 1024, 'a'); + std::string body(12 * 1024, 'a'); std::unique_ptr<char[]> buf; QuicByteCount header_length = encoder_.SerializeDataFrameHeader(body.length(), &buf); - QuicString header = QuicString(buf.get(), header_length); - QuicString data = HasFrameHeader() ? header + body : body; + std::string header = std::string(buf.get(), header_length); + std::string data = HasFrameHeader() ? header + body : body; ProcessHeaders(false, headers_); QuicStreamFrame frame(GetNthClientInitiatedBidirectionalId(0), false, 0, QuicStringPiece(data)); @@ -429,19 +430,19 @@ vec[1].iov_len = QUIC_ARRAYSIZE(buffer2); size_t bytes_read = stream_->Readv(vec, 2); EXPECT_EQ(2048u * 2, bytes_read); - EXPECT_EQ(body.substr(0, 2048), QuicString(buffer, 2048)); - EXPECT_EQ(body.substr(2048, 2048), QuicString(buffer2, 2048)); + EXPECT_EQ(body.substr(0, 2048), std::string(buffer, 2048)); + EXPECT_EQ(body.substr(2048, 2048), std::string(buffer2, 2048)); } TEST_P(QuicSpdyStreamTest, ProcessHeadersAndBodyMarkConsumed) { Initialize(!kShouldProcessData); - QuicString body = "this is the body"; + std::string body = "this is the body"; std::unique_ptr<char[]> buf; QuicByteCount header_length = encoder_.SerializeDataFrameHeader(body.length(), &buf); - QuicString header = QuicString(buf.get(), header_length); - QuicString data = HasFrameHeader() ? header + body : body; + std::string header = std::string(buf.get(), header_length); + std::string data = HasFrameHeader() ? header + body : body; ProcessHeaders(false, headers_); QuicStreamFrame frame(GetNthClientInitiatedBidirectionalId(0), false, 0, @@ -453,7 +454,7 @@ EXPECT_EQ(1, stream_->GetReadableRegions(&vec, 1)); EXPECT_EQ(body.length(), vec.iov_len); - EXPECT_EQ(body, QuicString(static_cast<char*>(vec.iov_base), vec.iov_len)); + EXPECT_EQ(body, std::string(static_cast<char*>(vec.iov_base), vec.iov_len)); stream_->MarkConsumed(body.length()); EXPECT_EQ(data.length(), stream_->flow_controller()->bytes_consumed()); @@ -461,15 +462,15 @@ TEST_P(QuicSpdyStreamTest, ProcessHeadersAndConsumeMultipleBody) { Initialize(!kShouldProcessData); - QuicString body1 = "this is body 1"; - QuicString body2 = "body 2"; + std::string body1 = "this is body 1"; + std::string body2 = "body 2"; std::unique_ptr<char[]> buf; QuicByteCount header_length = encoder_.SerializeDataFrameHeader(body1.length(), &buf); - QuicString header = QuicString(buf.get(), header_length); - QuicString data1 = HasFrameHeader() ? header + body1 : body1; + std::string header = std::string(buf.get(), header_length); + std::string data1 = HasFrameHeader() ? header + body1 : body1; header_length = encoder_.SerializeDataFrameHeader(body2.length(), &buf); - QuicString data2 = HasFrameHeader() ? header + body2 : body2; + std::string data2 = HasFrameHeader() ? header + body2 : body2; ProcessHeaders(false, headers_); QuicStreamFrame frame1(GetNthClientInitiatedBidirectionalId(0), false, 0, @@ -488,12 +489,12 @@ TEST_P(QuicSpdyStreamTest, ProcessHeadersAndBodyIncrementalReadv) { Initialize(!kShouldProcessData); - QuicString body = "this is the body"; + std::string body = "this is the body"; std::unique_ptr<char[]> buf; QuicByteCount header_length = encoder_.SerializeDataFrameHeader(body.length(), &buf); - QuicString header = QuicString(buf.get(), header_length); - QuicString data = HasFrameHeader() ? header + body : body; + std::string header = std::string(buf.get(), header_length); + std::string data = HasFrameHeader() ? header + body : body; ProcessHeaders(false, headers_); QuicStreamFrame frame(GetNthClientInitiatedBidirectionalId(0), false, 0, @@ -516,12 +517,12 @@ TEST_P(QuicSpdyStreamTest, ProcessHeadersUsingReadvWithMultipleIovecs) { Initialize(!kShouldProcessData); - QuicString body = "this is the body"; + std::string body = "this is the body"; std::unique_ptr<char[]> buf; QuicByteCount header_length = encoder_.SerializeDataFrameHeader(body.length(), &buf); - QuicString header = QuicString(buf.get(), header_length); - QuicString data = HasFrameHeader() ? header + body : body; + std::string header = std::string(buf.get(), header_length); + std::string data = HasFrameHeader() ? header + body : body; ProcessHeaders(false, headers_); QuicStreamFrame frame(GetNthClientInitiatedBidirectionalId(0), false, 0, @@ -560,7 +561,7 @@ // Try to send more data than the flow control limit allows. const uint64_t kOverflow = 15; - QuicString body(kWindow + kOverflow, 'a'); + std::string body(kWindow + kOverflow, 'a'); const uint64_t kHeaderLength = HasFrameHeader() ? 2 : 0; if (HasFrameHeader()) { @@ -602,14 +603,14 @@ stream_->flow_controller())); // Stream receives enough data to fill a fraction of the receive window. - QuicString body(kWindow / 3, 'a'); + std::string body(kWindow / 3, 'a'); QuicByteCount header_length = 0; - QuicString data; + std::string data; if (HasFrameHeader()) { std::unique_ptr<char[]> buffer; header_length = encoder_.SerializeDataFrameHeader(body.length(), &buffer); - QuicString header = QuicString(buffer.get(), header_length); + std::string header = std::string(buffer.get(), header_length); data = header + body; } else { data = body; @@ -651,14 +652,14 @@ stream_->flow_controller())); // Stream receives enough data to fill a fraction of the receive window. - QuicString body(kWindow / 3, 'a'); + std::string body(kWindow / 3, 'a'); QuicByteCount header_length = 0; - QuicString data; + std::string data; if (HasFrameHeader()) { std::unique_ptr<char[]> buffer; header_length = encoder_.SerializeDataFrameHeader(body.length(), &buffer); - QuicString header = QuicString(buffer.get(), header_length); + std::string header = std::string(buffer.get(), header_length); data = header + body; } else { data = body; @@ -719,24 +720,24 @@ // Each stream gets a quarter window of data. This should not trigger a // WINDOW_UPDATE for either stream, nor for the connection. QuicByteCount header_length = 0; - QuicString body; - QuicString data; - QuicString data2; - QuicString body2(1, 'a'); + std::string body; + std::string data; + std::string data2; + std::string body2(1, 'a'); if (HasFrameHeader()) { - body = QuicString(kWindow / 4 - 2, 'a'); + body = std::string(kWindow / 4 - 2, 'a'); std::unique_ptr<char[]> buffer; header_length = encoder_.SerializeDataFrameHeader(body.length(), &buffer); - QuicString header = QuicString(buffer.get(), header_length); + std::string header = std::string(buffer.get(), header_length); data = header + body; std::unique_ptr<char[]> buffer2; QuicByteCount header_length2 = encoder_.SerializeDataFrameHeader(body2.length(), &buffer2); - QuicString header2 = QuicString(buffer2.get(), header_length2); + std::string header2 = std::string(buffer2.get(), header_length2); data2 = header2 + body2; } else { - body = QuicString(kWindow / 4, 'a'); + body = std::string(kWindow / 4, 'a'); data = body; data2 = body2; } @@ -773,12 +774,12 @@ ProcessHeaders(false, headers_); // Receive data to overflow the window, violating flow control. - QuicString body(kWindow + 1, 'a'); + std::string body(kWindow + 1, 'a'); std::unique_ptr<char[]> buf; QuicByteCount header_length = encoder_.SerializeDataFrameHeader(body.length(), &buf); - QuicString header = QuicString(buf.get(), header_length); - QuicString data = HasFrameHeader() ? header + body : body; + std::string header = std::string(buf.get(), header_length); + std::string data = HasFrameHeader() ? header + body : body; QuicStreamFrame frame(GetNthClientInitiatedBidirectionalId(0), false, 0, QuicStringPiece(data)); EXPECT_CALL(*connection_, @@ -816,12 +817,12 @@ ProcessHeaders(false, headers_); // Send enough data to overflow the connection level flow control window. - QuicString body(kConnectionWindow + 1, 'a'); + std::string body(kConnectionWindow + 1, 'a'); std::unique_ptr<char[]> buf; QuicByteCount header_length = encoder_.SerializeDataFrameHeader(body.length(), &buf); - QuicString header = QuicString(buf.get(), header_length); - QuicString data = HasFrameHeader() ? header + body : body; + std::string header = std::string(buf.get(), header_length); + std::string data = HasFrameHeader() ? header + body : body; EXPECT_LT(data.size(), kStreamWindow); QuicStreamFrame frame(GetNthClientInitiatedBidirectionalId(0), false, 0, @@ -844,7 +845,7 @@ stream_->flow_controller())); // Send a frame with a FIN but no data. This should not be blocked. - QuicString body = ""; + std::string body = ""; bool fin = true; EXPECT_CALL(*connection_, @@ -906,12 +907,12 @@ QuicHeaderList headers = ProcessHeaders(false, headers_); stream_->ConsumeHeaderList(); - const QuicString body = "this is the body"; + const std::string body = "this is the body"; std::unique_ptr<char[]> buf; QuicByteCount header_length = encoder_.SerializeDataFrameHeader(body.length(), &buf); - QuicString header = QuicString(buf.get(), header_length); - QuicString data = HasFrameHeader() ? header + body : body; + std::string header = std::string(buf.get(), header_length); + std::string data = HasFrameHeader() ? header + body : body; // Receive trailing headers. SpdyHeaderBlock trailers_block; @@ -1041,12 +1042,12 @@ stream_->ConsumeHeaderList(); // Receive and consume body with FIN set, and no trailers. - QuicString body(1024, 'x'); + std::string body(1024, 'x'); std::unique_ptr<char[]> buf; QuicByteCount header_length = encoder_.SerializeDataFrameHeader(body.length(), &buf); - QuicString header = QuicString(buf.get(), header_length); - QuicString data = HasFrameHeader() ? header + body : body; + std::string header = std::string(buf.get(), header_length); + std::string data = HasFrameHeader() ? header + body : body; QuicStreamFrame frame(GetNthClientInitiatedBidirectionalId(0), /*fin=*/true, 0, data); @@ -1083,7 +1084,7 @@ // Write non-zero body data to force a non-zero final offset. EXPECT_CALL(*session_, WritevData(_, _, _, _, _)).Times(AtLeast(1)); - QuicString body(1024, 'x'); // 1 kB + std::string body(1024, 'x'); // 1 kB QuicByteCount header_length = 0; if (HasFrameHeader()) { std::unique_ptr<char[]> buf; @@ -1116,7 +1117,7 @@ // Write non-zero body data. EXPECT_CALL(*session_, WritevData(_, _, _, _, _)).Times(AtLeast(1)); const int kBodySize = 1 * 1024; // 1 kB - stream_->WriteOrBufferBody(QuicString(kBodySize, 'x'), false); + stream_->WriteOrBufferBody(std::string(kBodySize, 'x'), false); EXPECT_EQ(0u, stream_->BufferedDataBytes()); // Headers and body have been fully written, there is no queued data. Writing @@ -1143,7 +1144,7 @@ } EXPECT_CALL(*session_, WritevData(_, _, kBodySize, _, NO_FIN)) .WillOnce(Return(QuicConsumedData(kBodySize - 1, false))); - stream_->WriteOrBufferBody(QuicString(kBodySize, 'x'), false); + stream_->WriteOrBufferBody(std::string(kBodySize, 'x'), false); EXPECT_EQ(1u, stream_->BufferedDataBytes()); // Writing trailers will send a FIN, but not close the write side of the @@ -1201,11 +1202,11 @@ QuicStreamFrame frame1( QuicUtils::GetHeadersStreamId(connection_->transport_version()), false, 0, "Header1"); - QuicString header = ""; + std::string header = ""; if (HasFrameHeader()) { std::unique_ptr<char[]> buffer; QuicByteCount header_length = encoder_.SerializeDataFrameHeader(5, &buffer); - header = QuicString(buffer.get(), header_length); + header = std::string(buffer.get(), header_length); } QuicStreamFrame frame2(stream_->id(), true, 0, header + "Test1"); QuicStreamFrame frame3( @@ -1400,8 +1401,8 @@ QuicReferenceCountedPointer<MockAckListener> mock_ack_listener( new StrictMock<MockAckListener>); stream_->set_ack_listener(mock_ack_listener); - QuicString body = "Test1"; - QuicString body2(100, 'x'); + std::string body = "Test1"; + std::string body2(100, 'x'); EXPECT_CALL(*session_, WritevData(_, _, _, _, _)).Times(AtLeast(1)); stream_->WriteOrBufferBody(body, false); @@ -1410,10 +1411,10 @@ std::unique_ptr<char[]> buffer; QuicByteCount header_length = encoder_.SerializeDataFrameHeader(body.length(), &buffer); - QuicString header = QuicString(buffer.get(), header_length); + std::string header = std::string(buffer.get(), header_length); header_length = encoder_.SerializeDataFrameHeader(body2.length(), &buffer); - QuicString header2 = QuicString(buffer.get(), header_length); + std::string header2 = std::string(buffer.get(), header_length); EXPECT_CALL(*mock_ack_listener, OnPacketAcked(body.length(), _)); QuicStreamFrame frame(stream_->id(), false, 0, header + body); @@ -1445,8 +1446,8 @@ QuicReferenceCountedPointer<MockAckListener> mock_ack_listener( new StrictMock<MockAckListener>); stream_->set_ack_listener(mock_ack_listener); - QuicString body = "Test1"; - QuicString body2(100, 'x'); + std::string body = "Test1"; + std::string body2(100, 'x'); struct iovec body1_iov = {const_cast<char*>(body.data()), body.length()}; struct iovec body2_iov = {const_cast<char*>(body2.data()), body2.length()}; QuicMemSliceStorage storage(&body1_iov, 1, @@ -1460,10 +1461,10 @@ std::unique_ptr<char[]> buffer; QuicByteCount header_length = encoder_.SerializeDataFrameHeader(body.length(), &buffer); - QuicString header = QuicString(buffer.get(), header_length); + std::string header = std::string(buffer.get(), header_length); header_length = encoder_.SerializeDataFrameHeader(body2.length(), &buffer); - QuicString header2 = QuicString(buffer.get(), header_length); + std::string header2 = std::string(buffer.get(), header_length); EXPECT_CALL(*mock_ack_listener, OnPacketAcked(body.length() + body2.length(), _)); @@ -1485,8 +1486,8 @@ QuicReferenceCountedPointer<MockAckListener> mock_ack_listener( new StrictMock<MockAckListener>); stream_->set_ack_listener(mock_ack_listener); - QuicString body = "Test1"; - QuicString body2(100, 'x'); + std::string body = "Test1"; + std::string body2(100, 'x'); EXPECT_CALL(*session_, WritevData(_, _, _, _, _)).Times(AtLeast(1)); stream_->WriteOrBufferBody(body, false); @@ -1495,10 +1496,10 @@ std::unique_ptr<char[]> buffer; QuicByteCount header_length = encoder_.SerializeDataFrameHeader(body.length(), &buffer); - QuicString header = QuicString(buffer.get(), header_length); + std::string header = std::string(buffer.get(), header_length); header_length = encoder_.SerializeDataFrameHeader(body2.length(), &buffer); - QuicString header2 = QuicString(buffer.get(), header_length); + std::string header2 = std::string(buffer.get(), header_length); EXPECT_CALL(*mock_ack_listener, OnPacketRetransmitted(body.length())); QuicStreamFrame frame(stream_->id(), false, 0, header + body);
diff --git a/quic/core/http/spdy_utils.cc b/quic/core/http/spdy_utils.cc index 7022ae2..c3f312b 100644 --- a/quic/core/http/spdy_utils.cc +++ b/quic/core/http/spdy_utils.cc
@@ -61,7 +61,7 @@ int64_t* content_length, SpdyHeaderBlock* headers) { for (const auto& p : header_list) { - const QuicString& name = p.first; + const std::string& name = p.first; if (name.empty()) { QUIC_DLOG(ERROR) << "Header name must not be empty."; return false; @@ -90,7 +90,7 @@ SpdyHeaderBlock* trailers) { bool found_final_byte_offset = false; for (const auto& p : header_list) { - const QuicString& name = p.first; + const std::string& name = p.first; // Pull out the final offset pseudo header which indicates the number of // response body bytes expected. @@ -129,7 +129,7 @@ } // static -QuicString SpdyUtils::GetPromisedUrlFromHeaders( +std::string SpdyUtils::GetPromisedUrlFromHeaders( const SpdyHeaderBlock& headers) { // RFC 7540, Section 8.1.2.3: All HTTP/2 requests MUST include exactly // one valid value for the ":method", ":scheme", and ":path" pseudo-header @@ -150,12 +150,12 @@ // So the only methods allowed in a PUSH_PROMISE are GET and HEAD. SpdyHeaderBlock::const_iterator it = headers.find(":method"); if (it == headers.end() || (it->second != "GET" && it->second != "HEAD")) { - return QuicString(); + return std::string(); } it = headers.find(":scheme"); if (it == headers.end() || it->second.empty()) { - return QuicString(); + return std::string(); } QuicStringPiece scheme = it->second; @@ -164,7 +164,7 @@ // (see Section 10.1). it = headers.find(":authority"); if (it == headers.end() || it->second.empty()) { - return QuicString(); + return std::string(); } QuicStringPiece authority = it->second; @@ -175,7 +175,7 @@ // is deferred to implementations in QuicUrlUtils::GetPushPromiseUrl(). it = headers.find(":path"); if (it == headers.end()) { - return QuicString(); + return std::string(); } QuicStringPiece path = it->second; @@ -183,7 +183,7 @@ } // static -QuicString SpdyUtils::GetPromisedHostNameFromHeaders( +std::string SpdyUtils::GetPromisedHostNameFromHeaders( const SpdyHeaderBlock& headers) { // TODO(fayang): Consider just checking out the value of the ":authority" key // in headers. @@ -192,22 +192,22 @@ // static bool SpdyUtils::PromisedUrlIsValid(const SpdyHeaderBlock& headers) { - QuicString url(GetPromisedUrlFromHeaders(headers)); + std::string url(GetPromisedUrlFromHeaders(headers)); return !url.empty() && GURL(url).is_valid(); } // static -bool SpdyUtils::PopulateHeaderBlockFromUrl(const QuicString url, +bool SpdyUtils::PopulateHeaderBlockFromUrl(const std::string url, SpdyHeaderBlock* headers) { (*headers)[":method"] = "GET"; size_t pos = url.find("://"); - if (pos == QuicString::npos) { + if (pos == std::string::npos) { return false; } (*headers)[":scheme"] = url.substr(0, pos); size_t start = pos + 3; pos = url.find("/", start); - if (pos == QuicString::npos) { + if (pos == std::string::npos) { (*headers)[":authority"] = url.substr(start); (*headers)[":path"] = "/"; return true; @@ -218,9 +218,9 @@ } // static -QuicString SpdyUtils::GetPushPromiseUrl(QuicStringPiece scheme, - QuicStringPiece authority, - QuicStringPiece path) { +std::string SpdyUtils::GetPushPromiseUrl(QuicStringPiece scheme, + QuicStringPiece authority, + QuicStringPiece path) { // RFC 7540, Section 8.1.2.3: The ":path" pseudo-header field includes the // path and query parts of the target URI (the "path-absolute" production // and optionally a '?' character followed by the "query" production (see @@ -249,7 +249,7 @@ // 8.1.2.3 about OPTIONS requests does not apply here (i.e. ":path" cannot be // "*"). if (path.empty() || path[0] != '/' || (path.size() >= 2 && path[1] == '/')) { - return QuicString(); + return std::string(); } // Validate the scheme; this is to ensure a scheme of "foo://bar" is not @@ -262,7 +262,7 @@ if (!url::CanonicalizeScheme(scheme.data(), scheme_component, &canon_scheme_output, &canon_component) || !canon_component.is_nonempty() || canon_component.begin != 0) { - return QuicString(); + return std::string(); } canonical_scheme.resize(canon_component.len + 1); @@ -285,14 +285,14 @@ // it is performed later in processing, only "http" and "https" schemed // URIs are supported for PUSH. if (username_component.is_valid() || password_component.is_valid()) { - return QuicString(); + return std::string(); } // Failed parsing or no host present. ParseAuthority() will ensure that // host_component + port_component cover the entire string, if // username_component and password_component are not present. if (!host_component.is_nonempty()) { - return QuicString(); + return std::string(); } // Validate the port (if present; it's optional). @@ -300,7 +300,7 @@ if (port_component.is_nonempty()) { parsed_port_number = url::ParsePort(authority.data(), port_component); if (parsed_port_number < 0 && parsed_port_number != url::PORT_UNSPECIFIED) { - return QuicString(); + return std::string(); } } @@ -312,7 +312,7 @@ if (!url::CanonicalizeHost(authority.data(), host_component, &canon_host_output, &canon_component) || !canon_component.is_nonempty() || canon_component.begin != 0) { - return QuicString(); + return std::string(); } // At this point, "authority" has been validated to either be of the form @@ -332,7 +332,7 @@ origin_url.has_username() || origin_url.has_password() || (origin_url.has_path() && origin_url.path_piece() != "/") || origin_url.has_query() || origin_url.has_ref()) { - return QuicString(); + return std::string(); } // Attempt to parse the path. @@ -344,7 +344,7 @@ // fragment to the query. GURL full_url(spec); if (!full_url.is_valid() || full_url.has_ref()) { - return QuicString(); + return std::string(); } return full_url.spec();
diff --git a/quic/core/http/spdy_utils.h b/quic/core/http/spdy_utils.h index 073eeeb..f356767 100644 --- a/quic/core/http/spdy_utils.h +++ b/quic/core/http/spdy_utils.h
@@ -41,11 +41,11 @@ // :path headers of a PUSH_PROMISE. Returns empty string if the headers do not // conform to HTTP/2 spec or if the ":method" header contains a forbidden // method for PUSH_PROMISE. - static QuicString GetPromisedUrlFromHeaders( + static std::string GetPromisedUrlFromHeaders( const spdy::SpdyHeaderBlock& headers); // Returns hostname, or empty string if missing. - static QuicString GetPromisedHostNameFromHeaders( + static std::string GetPromisedHostNameFromHeaders( const spdy::SpdyHeaderBlock& headers); // Returns true if result of |GetPromisedUrlFromHeaders()| is non-empty @@ -54,15 +54,15 @@ // Populates the fields of |headers| to make a GET request of |url|, // which must be fully-qualified. - static bool PopulateHeaderBlockFromUrl(const QuicString url, + static bool PopulateHeaderBlockFromUrl(const std::string url, spdy::SpdyHeaderBlock* headers); // Returns a canonical, valid URL for a PUSH_PROMISE with the specified // ":scheme", ":authority", and ":path" header fields, or an empty // string if the resulting URL is not valid or supported. - static QuicString GetPushPromiseUrl(QuicStringPiece scheme, - QuicStringPiece authority, - QuicStringPiece path); + static std::string GetPushPromiseUrl(QuicStringPiece scheme, + QuicStringPiece authority, + QuicStringPiece path); }; } // namespace quic
diff --git a/quic/core/http/spdy_utils_test.cc b/quic/core/http/spdy_utils_test.cc index 6cd2f1d..5e6fbbf 100644 --- a/quic/core/http/spdy_utils_test.cc +++ b/quic/core/http/spdy_utils_test.cc
@@ -39,7 +39,7 @@ {"cookie", "part3"}, // Already-delimited headers are passed through. - {"passed-through", QuicString("foo\0baz", 7)}, + {"passed-through", std::string("foo\0baz", 7)}, // Other headers are joined on \0. {"joined", "value 1"}, @@ -374,7 +374,7 @@ using PopulateHeaderBlockFromUrl = QuicTest; TEST_F(PopulateHeaderBlockFromUrl, NormalUsage) { - QuicString url = "https://www.google.com/index.html"; + std::string url = "https://www.google.com/index.html"; SpdyHeaderBlock headers; EXPECT_TRUE(SpdyUtils::PopulateHeaderBlockFromUrl(url, &headers)); EXPECT_EQ("https", headers[":scheme"].as_string()); @@ -383,7 +383,7 @@ } TEST_F(PopulateHeaderBlockFromUrl, UrlWithNoPath) { - QuicString url = "https://www.google.com"; + std::string url = "https://www.google.com"; SpdyHeaderBlock headers; EXPECT_TRUE(SpdyUtils::PopulateHeaderBlockFromUrl(url, &headers)); EXPECT_EQ("https", headers[":scheme"].as_string());
diff --git a/quic/core/packet_number_indexed_queue_test.cc b/quic/core/packet_number_indexed_queue_test.cc index 294d2a4..7643fe4 100644 --- a/quic/core/packet_number_indexed_queue_test.cc +++ b/quic/core/packet_number_indexed_queue_test.cc
@@ -18,7 +18,7 @@ PacketNumberIndexedQueueTest() {} protected: - PacketNumberIndexedQueue<QuicString> queue_; + PacketNumberIndexedQueue<std::string> queue_; }; TEST_F(PacketNumberIndexedQueueTest, InitialState) {
diff --git a/quic/core/qpack/fuzzer/qpack_encoder_stream_sender_fuzzer.cc b/quic/core/qpack/fuzzer/qpack_encoder_stream_sender_fuzzer.cc index 501a69f..bc4de90 100644 --- a/quic/core/qpack/fuzzer/qpack_encoder_stream_sender_fuzzer.cc +++ b/quic/core/qpack/fuzzer/qpack_encoder_stream_sender_fuzzer.cc
@@ -35,7 +35,7 @@ uint64_t name_index = provider.ConsumeIntegral<uint64_t>(); uint16_t value_length = provider.ConsumeIntegralInRange<uint16_t>(0, kMaxStringLength); - QuicString value = provider.ConsumeRandomLengthString(value_length); + std::string value = provider.ConsumeRandomLengthString(value_length); sender.SendInsertWithNameReference(is_static, name_index, value); break; @@ -43,10 +43,10 @@ case 1: { uint16_t name_length = provider.ConsumeIntegralInRange<uint16_t>(0, kMaxStringLength); - QuicString name = provider.ConsumeRandomLengthString(name_length); + std::string name = provider.ConsumeRandomLengthString(name_length); uint16_t value_length = provider.ConsumeIntegralInRange<uint16_t>(0, kMaxStringLength); - QuicString value = provider.ConsumeRandomLengthString(value_length); + std::string value = provider.ConsumeRandomLengthString(value_length); sender.SendInsertWithoutNameReference(name, value); break; }
diff --git a/quic/core/qpack/fuzzer/qpack_round_trip_fuzzer.cc b/quic/core/qpack/fuzzer/qpack_round_trip_fuzzer.cc index 7f75a0f..3c21964 100644 --- a/quic/core/qpack/fuzzer/qpack_round_trip_fuzzer.cc +++ b/quic/core/qpack/fuzzer/qpack_round_trip_fuzzer.cc
@@ -32,8 +32,8 @@ break; } - QuicString name; - QuicString value; + std::string name; + std::string value; switch (provider.ConsumeIntegral<uint8_t>()) { case 0: // Static table entry with no header value. @@ -126,7 +126,7 @@ // Encode header list. NoopDecoderStreamErrorDelegate decoder_stream_error_delegate; NoopEncoderStreamSenderDelegate encoder_stream_sender_delegate; - QuicString encoded_header_block = QpackEncode( + std::string encoded_header_block = QpackEncode( &decoder_stream_error_delegate, &encoder_stream_sender_delegate, fragment_size_generator, &header_list);
diff --git a/quic/core/qpack/offline/qpack_offline_decoder.cc b/quic/core/qpack/offline/qpack_offline_decoder.cc index 2b02edd..137ee7c 100644 --- a/quic/core/qpack/offline/qpack_offline_decoder.cc +++ b/quic/core/qpack/offline/qpack_offline_decoder.cc
@@ -107,7 +107,7 @@ QuicStringPiece input_filename) { // Store data in |input_data_storage|; use a QuicStringPiece to efficiently // keep track of remaining portion yet to be decoded. - QuicString input_data_storage; + std::string input_data_storage; ReadFileContents(input_filename, &input_data_storage); QuicStringPiece input_data(input_data_storage); @@ -166,7 +166,7 @@ QuicStringPiece expected_headers_filename) { // Store data in |expected_headers_data_storage|; use a QuicStringPiece to // efficiently keep track of remaining portion yet to be decoded. - QuicString expected_headers_data_storage; + std::string expected_headers_data_storage; ReadFileContents(expected_headers_filename, &expected_headers_data_storage); QuicStringPiece expected_headers_data(expected_headers_data_storage);
diff --git a/quic/core/qpack/offline/qpack_offline_decoder_bin.cc b/quic/core/qpack/offline/qpack_offline_decoder_bin.cc index a0319e6..a4f5373 100644 --- a/quic/core/qpack/offline/qpack_offline_decoder_bin.cc +++ b/quic/core/qpack/offline/qpack_offline_decoder_bin.cc
@@ -15,7 +15,7 @@ const char* usage = "Usage: qpack_offline_decoder input_filename expected_headers_filename " "...."; - std::vector<quic::QuicString> args = + std::vector<std::string> args = quic::QuicParseCommandLineFlags(usage, argc, argv); if (args.size() < 2 || args.size() % 2 != 0) {
diff --git a/quic/core/qpack/qpack_decoded_headers_accumulator.h b/quic/core/qpack/qpack_decoded_headers_accumulator.h index 47d4f63..889769f 100644 --- a/quic/core/qpack/qpack_decoded_headers_accumulator.h +++ b/quic/core/qpack/qpack_decoded_headers_accumulator.h
@@ -56,7 +56,7 @@ size_t uncompressed_header_bytes_; size_t compressed_header_bytes_; bool error_detected_; - QuicString error_message_; + std::string error_message_; }; } // namespace quic
diff --git a/quic/core/qpack/qpack_decoded_headers_accumulator_test.cc b/quic/core/qpack/qpack_decoded_headers_accumulator_test.cc index 0c71b19..27c6fa1 100644 --- a/quic/core/qpack/qpack_decoded_headers_accumulator_test.cc +++ b/quic/core/qpack/qpack_decoded_headers_accumulator_test.cc
@@ -79,7 +79,7 @@ EXPECT_CALL(decoder_stream_sender_delegate_, WriteDecoderStreamData(Eq(kHeaderAcknowledgement))); - QuicString encoded_data(QuicTextUtils::HexDecode("000023666f6f03626172")); + std::string encoded_data(QuicTextUtils::HexDecode("000023666f6f03626172")); EXPECT_TRUE(accumulator_.Decode(encoded_data)); EXPECT_TRUE(accumulator_.EndHeaderBlock());
diff --git a/quic/core/qpack/qpack_decoder_stream_sender.cc b/quic/core/qpack/qpack_decoder_stream_sender.cc index 141b64a..cdb3b35 100644 --- a/quic/core/qpack/qpack_decoder_stream_sender.cc +++ b/quic/core/qpack/qpack_decoder_stream_sender.cc
@@ -23,7 +23,7 @@ instruction_encoder_.Encode(InsertCountIncrementInstruction()); - QuicString output; + std::string output; instruction_encoder_.Next(std::numeric_limits<size_t>::max(), &output); DCHECK(!instruction_encoder_.HasNext()); @@ -37,7 +37,7 @@ instruction_encoder_.Encode(HeaderAcknowledgementInstruction()); - QuicString output; + std::string output; instruction_encoder_.Next(std::numeric_limits<size_t>::max(), &output); DCHECK(!instruction_encoder_.HasNext()); @@ -50,7 +50,7 @@ instruction_encoder_.Encode(StreamCancellationInstruction()); - QuicString output; + std::string output; instruction_encoder_.Next(std::numeric_limits<size_t>::max(), &output); DCHECK(!instruction_encoder_.HasNext());
diff --git a/quic/core/qpack/qpack_decoder_test.cc b/quic/core/qpack/qpack_decoder_test.cc index 7292c50..d6740c8 100644 --- a/quic/core/qpack/qpack_decoder_test.cc +++ b/quic/core/qpack/qpack_decoder_test.cc
@@ -62,8 +62,10 @@ const FragmentMode fragment_mode_; }; -INSTANTIATE_TEST_SUITE_P(, QpackDecoderTest, Values(FragmentMode::kSingleChunk, - FragmentMode::kOctetByOctet)); +INSTANTIATE_TEST_SUITE_P(, + QpackDecoderTest, + Values(FragmentMode::kSingleChunk, + FragmentMode::kOctetByOctet)); TEST_P(QpackDecoderTest, NoPrefix) { EXPECT_CALL(handler_, @@ -119,7 +121,7 @@ TEST_P(QpackDecoderTest, MultipleLiteralEntries) { EXPECT_CALL(handler_, OnHeaderDecoded(Eq("foo"), Eq("bar"))); - QuicString str(127, 'a'); + std::string str(127, 'a'); EXPECT_CALL(handler_, OnHeaderDecoded(Eq("foobaar"), QuicStringPiece(str))); EXPECT_CALL(handler_, OnDecodingCompleted()); EXPECT_CALL(decoder_stream_sender_delegate_, @@ -558,11 +560,11 @@ DecodeEncoderStreamData( QuicTextUtils::HexDecode("6294e7" // Name "foo". "7fd903")); // Value length 600. - QuicString header_value(600, 'Z'); + std::string header_value(600, 'Z'); DecodeEncoderStreamData(header_value); // Duplicate most recent entry 200 times. - DecodeEncoderStreamData(QuicString(200, '\x00')); + DecodeEncoderStreamData(std::string(200, '\x00')); // Now there is only one entry in the dynamic table, with absolute index 200.
diff --git a/quic/core/qpack/qpack_encoder_stream_receiver_test.cc b/quic/core/qpack/qpack_encoder_stream_receiver_test.cc index 5685981..dcb2039 100644 --- a/quic/core/qpack/qpack_encoder_stream_receiver_test.cc +++ b/quic/core/qpack/qpack_encoder_stream_receiver_test.cc
@@ -54,7 +54,7 @@ // Value length does not fit in prefix. // 'Z' would be Huffman encoded to 8 bits, so no Huffman encoding is used. EXPECT_CALL(*delegate(), - OnInsertWithNameReference(false, 42, Eq(QuicString(127, 'Z')))); + OnInsertWithNameReference(false, 42, Eq(std::string(127, 'Z')))); Decode(QuicTextUtils::HexDecode( "c500" @@ -88,8 +88,8 @@ // Not Huffman encoded long strings; length does not fit on prefix. // 'Z' would be Huffman encoded to 8 bits, so no Huffman encoding is used. EXPECT_CALL(*delegate(), - OnInsertWithoutNameReference(Eq(QuicString(31, 'Z')), - Eq(QuicString(127, 'Z')))); + OnInsertWithoutNameReference(Eq(std::string(31, 'Z')), + Eq(std::string(127, 'Z')))); Decode(QuicTextUtils::HexDecode( "4000"
diff --git a/quic/core/qpack/qpack_encoder_stream_sender.cc b/quic/core/qpack/qpack_encoder_stream_sender.cc index fb43046..6cd458a 100644 --- a/quic/core/qpack/qpack_encoder_stream_sender.cc +++ b/quic/core/qpack/qpack_encoder_stream_sender.cc
@@ -28,7 +28,7 @@ instruction_encoder_.Encode(InsertWithNameReferenceInstruction()); - QuicString output; + std::string output; instruction_encoder_.Next(std::numeric_limits<size_t>::max(), &output); DCHECK(!instruction_encoder_.HasNext()); @@ -44,7 +44,7 @@ instruction_encoder_.Encode(InsertWithoutNameReferenceInstruction()); - QuicString output; + std::string output; instruction_encoder_.Next(std::numeric_limits<size_t>::max(), &output); DCHECK(!instruction_encoder_.HasNext()); @@ -57,7 +57,7 @@ instruction_encoder_.Encode(DuplicateInstruction()); - QuicString output; + std::string output; instruction_encoder_.Next(std::numeric_limits<size_t>::max(), &output); DCHECK(!instruction_encoder_.HasNext()); @@ -70,7 +70,7 @@ instruction_encoder_.Encode(SetDynamicTableCapacityInstruction()); - QuicString output; + std::string output; instruction_encoder_.Next(std::numeric_limits<size_t>::max(), &output); DCHECK(!instruction_encoder_.HasNext());
diff --git a/quic/core/qpack/qpack_encoder_stream_sender_test.cc b/quic/core/qpack/qpack_encoder_stream_sender_test.cc index a850f18..a2e7376 100644 --- a/quic/core/qpack/qpack_encoder_stream_sender_test.cc +++ b/quic/core/qpack/qpack_encoder_stream_sender_test.cc
@@ -51,7 +51,7 @@ "5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a" "5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a" "5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a")))); - stream_.SendInsertWithNameReference(false, 42, QuicString(127, 'Z')); + stream_.SendInsertWithNameReference(false, 42, std::string(127, 'Z')); } TEST_F(QpackEncoderStreamSenderTest, InsertWithoutNameReference) { @@ -80,8 +80,8 @@ "5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a" "5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a" "5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a")))); - stream_.SendInsertWithoutNameReference(QuicString(31, 'Z'), - QuicString(127, 'Z')); + stream_.SendInsertWithoutNameReference(std::string(31, 'Z'), + std::string(127, 'Z')); } TEST_F(QpackEncoderStreamSenderTest, Duplicate) {
diff --git a/quic/core/qpack/qpack_encoder_test.cc b/quic/core/qpack/qpack_encoder_test.cc index 6dea968..939856d 100644 --- a/quic/core/qpack/qpack_encoder_test.cc +++ b/quic/core/qpack/qpack_encoder_test.cc
@@ -24,7 +24,7 @@ QpackEncoderTest() : fragment_mode_(GetParam()) {} ~QpackEncoderTest() override = default; - QuicString Encode(const spdy::SpdyHeaderBlock* header_list) { + std::string Encode(const spdy::SpdyHeaderBlock* header_list) { return QpackEncode( &decoder_stream_error_delegate_, &encoder_stream_sender_delegate_, FragmentModeToFragmentSizeGenerator(fragment_mode_), header_list); @@ -44,7 +44,7 @@ TEST_P(QpackEncoderTest, Empty) { spdy::SpdyHeaderBlock header_list; - QuicString output = Encode(&header_list); + std::string output = Encode(&header_list); EXPECT_EQ(QuicTextUtils::HexDecode("0000"), output); } @@ -52,7 +52,7 @@ TEST_P(QpackEncoderTest, EmptyName) { spdy::SpdyHeaderBlock header_list; header_list[""] = "foo"; - QuicString output = Encode(&header_list); + std::string output = Encode(&header_list); EXPECT_EQ(QuicTextUtils::HexDecode("0000208294e7"), output); } @@ -60,7 +60,7 @@ TEST_P(QpackEncoderTest, EmptyValue) { spdy::SpdyHeaderBlock header_list; header_list["foo"] = ""; - QuicString output = Encode(&header_list); + std::string output = Encode(&header_list); EXPECT_EQ(QuicTextUtils::HexDecode("00002a94e700"), output); } @@ -68,7 +68,7 @@ TEST_P(QpackEncoderTest, EmptyNameAndValue) { spdy::SpdyHeaderBlock header_list; header_list[""] = ""; - QuicString output = Encode(&header_list); + std::string output = Encode(&header_list); EXPECT_EQ(QuicTextUtils::HexDecode("00002000"), output); } @@ -76,7 +76,7 @@ TEST_P(QpackEncoderTest, Simple) { spdy::SpdyHeaderBlock header_list; header_list["foo"] = "bar"; - QuicString output = Encode(&header_list); + std::string output = Encode(&header_list); EXPECT_EQ(QuicTextUtils::HexDecode("00002a94e703626172"), output); } @@ -85,8 +85,8 @@ spdy::SpdyHeaderBlock header_list; header_list["foo"] = "bar"; // 'Z' would be Huffman encoded to 8 bits, so no Huffman encoding is used. - header_list["ZZZZZZZ"] = QuicString(127, 'Z'); - QuicString output = Encode(&header_list); + header_list["ZZZZZZZ"] = std::string(127, 'Z'); + std::string output = Encode(&header_list); EXPECT_EQ( QuicTextUtils::HexDecode( @@ -110,7 +110,7 @@ header_list["accept-encoding"] = "gzip, deflate, br"; header_list["location"] = ""; - QuicString output = Encode(&header_list); + std::string output = Encode(&header_list); EXPECT_EQ(QuicTextUtils::HexDecode("0000d1dfcc"), output); } { @@ -119,7 +119,7 @@ header_list["accept-encoding"] = "compress"; header_list["location"] = "foo"; - QuicString output = Encode(&header_list); + std::string output = Encode(&header_list); EXPECT_EQ(QuicTextUtils::HexDecode("0000d45f108621e9aec2a11f5c8294e7"), output); } @@ -128,7 +128,7 @@ header_list[":method"] = "TRACE"; header_list["accept-encoding"] = ""; - QuicString output = Encode(&header_list); + std::string output = Encode(&header_list); EXPECT_EQ(QuicTextUtils::HexDecode("00005f000554524143455f1000"), output); } } @@ -145,7 +145,7 @@ // This indexed header field takes exactly three bytes: // two for the prefix, one for the indexed static entry. - QuicString output; + std::string output; progressive_encoder->Next(3, &output); EXPECT_EQ(QuicTextUtils::HexDecode("0000c1"), output);
diff --git a/quic/core/qpack/qpack_encoder_test_utils.cc b/quic/core/qpack/qpack_encoder_test_utils.cc index b9a3263..dd1ccb3 100644 --- a/quic/core/qpack/qpack_encoder_test_utils.cc +++ b/quic/core/qpack/qpack_encoder_test_utils.cc
@@ -15,7 +15,7 @@ void NoopEncoderStreamSenderDelegate::WriteEncoderStreamData( QuicStringPiece data) {} -QuicString QpackEncode( +std::string QpackEncode( QpackEncoder::DecoderStreamErrorDelegate* decoder_stream_error_delegate, QpackEncoderStreamSender::Delegate* encoder_stream_sender_delegate, const FragmentSizeGenerator& fragment_size_generator, @@ -25,7 +25,7 @@ auto progressive_encoder = encoder.EncodeHeaderList(/* stream_id = */ 1, header_list); - QuicString output; + std::string output; while (progressive_encoder->HasNext()) { progressive_encoder->Next(fragment_size_generator(), &output); }
diff --git a/quic/core/qpack/qpack_encoder_test_utils.h b/quic/core/qpack/qpack_encoder_test_utils.h index 03d05cb..cb27ab5 100644 --- a/quic/core/qpack/qpack_encoder_test_utils.h +++ b/quic/core/qpack/qpack_encoder_test_utils.h
@@ -51,7 +51,7 @@ MOCK_METHOD1(WriteEncoderStreamData, void(QuicStringPiece data)); }; -QuicString QpackEncode( +std::string QpackEncode( QpackEncoder::DecoderStreamErrorDelegate* decoder_stream_error_delegate, QpackEncoderStreamSender::Delegate* encoder_stream_sender_delegate, const FragmentSizeGenerator& fragment_size_generator,
diff --git a/quic/core/qpack/qpack_instruction_decoder.cc b/quic/core/qpack/qpack_instruction_decoder.cc index dbb2076..96d1a61 100644 --- a/quic/core/qpack/qpack_instruction_decoder.cc +++ b/quic/core/qpack/qpack_instruction_decoder.cc
@@ -228,7 +228,7 @@ return; } - QuicString* const string = + std::string* const string = (field_->type == QpackInstructionFieldType::kName) ? &name_ : &value_; string->clear(); @@ -248,7 +248,7 @@ DCHECK(field_->type == QpackInstructionFieldType::kName || field_->type == QpackInstructionFieldType::kValue); - QuicString* const string = + std::string* const string = (field_->type == QpackInstructionFieldType::kName) ? &name_ : &value_; DCHECK_LT(string->size(), string_length_); @@ -267,14 +267,14 @@ DCHECK(field_->type == QpackInstructionFieldType::kName || field_->type == QpackInstructionFieldType::kValue); - QuicString* const string = + std::string* const string = (field_->type == QpackInstructionFieldType::kName) ? &name_ : &value_; DCHECK_EQ(string->size(), string_length_); if (is_huffman_encoded_) { huffman_decoder_.Reset(); // HpackHuffmanDecoder::Decode() cannot perform in-place decoding. - QuicString decoded_value; + std::string decoded_value; huffman_decoder_.Decode(*string, &decoded_value); if (!huffman_decoder_.InputProperlyTerminated()) { OnError("Error in Huffman-encoded string.");
diff --git a/quic/core/qpack/qpack_instruction_decoder.h b/quic/core/qpack/qpack_instruction_decoder.h index 9d674c3..49fb0cc 100644 --- a/quic/core/qpack/qpack_instruction_decoder.h +++ b/quic/core/qpack/qpack_instruction_decoder.h
@@ -61,8 +61,8 @@ bool s_bit() const { return s_bit_; } uint64_t varint() const { return varint_; } uint64_t varint2() const { return varint2_; } - const QuicString& name() const { return name_; } - const QuicString& value() const { return value_; } + const std::string& name() const { return name_; } + const std::string& value() const { return value_; } private: enum class State { @@ -114,8 +114,8 @@ bool s_bit_; uint64_t varint_; uint64_t varint2_; - QuicString name_; - QuicString value_; + std::string name_; + std::string value_; // Whether the currently decoded header name or value is Huffman encoded. bool is_huffman_encoded_; // Length of string being read into |name_| or |value_|.
diff --git a/quic/core/qpack/qpack_instruction_encoder.cc b/quic/core/qpack/qpack_instruction_encoder.cc index 72aa7fd..ff135bb 100644 --- a/quic/core/qpack/qpack_instruction_encoder.cc +++ b/quic/core/qpack/qpack_instruction_encoder.cc
@@ -34,7 +34,7 @@ } void QpackInstructionEncoder::Next(size_t max_encoded_bytes, - QuicString* output) { + std::string* output) { DCHECK(HasNext()); DCHECK_NE(0u, max_encoded_bytes); @@ -108,7 +108,7 @@ } size_t QpackInstructionEncoder::DoVarintStart(size_t max_encoded_bytes, - QuicString* output) { + std::string* output) { DCHECK(field_->type == QpackInstructionFieldType::kVarint || field_->type == QpackInstructionFieldType::kVarint2 || field_->type == QpackInstructionFieldType::kName || @@ -149,7 +149,7 @@ } size_t QpackInstructionEncoder::DoVarintResume(size_t max_encoded_bytes, - QuicString* output) { + std::string* output) { DCHECK(field_->type == QpackInstructionFieldType::kVarint || field_->type == QpackInstructionFieldType::kVarint2 || field_->type == QpackInstructionFieldType::kName || @@ -195,7 +195,7 @@ } size_t QpackInstructionEncoder::DoWriteString(size_t max_encoded_bytes, - QuicString* output) { + std::string* output) { DCHECK(field_->type == QpackInstructionFieldType::kName || field_->type == QpackInstructionFieldType::kValue);
diff --git a/quic/core/qpack/qpack_instruction_encoder.h b/quic/core/qpack/qpack_instruction_encoder.h index 15d908a..c95ceec 100644 --- a/quic/core/qpack/qpack_instruction_encoder.h +++ b/quic/core/qpack/qpack_instruction_encoder.h
@@ -45,7 +45,7 @@ // Encodes the next up to |max_encoded_bytes| octets of the current // instruction, appending to |output|. Must only be called when HasNext() // returns true. |max_encoded_bytes| must be positive. - void Next(size_t max_encoded_bytes, QuicString* output); + void Next(size_t max_encoded_bytes, std::string* output); private: enum class State { @@ -73,10 +73,10 @@ void DoOpcode(); void DoStartField(); void DoStaticBit(); - size_t DoVarintStart(size_t max_encoded_bytes, QuicString* output); - size_t DoVarintResume(size_t max_encoded_bytes, QuicString* output); + size_t DoVarintStart(size_t max_encoded_bytes, std::string* output); + size_t DoVarintResume(size_t max_encoded_bytes, std::string* output); void DoStartString(); - size_t DoWriteString(size_t max_encoded_bytes, QuicString* output); + size_t DoWriteString(size_t max_encoded_bytes, std::string* output); // Storage for field values to be encoded. bool s_bit_; @@ -89,7 +89,7 @@ // Storage for the Huffman encoded string literal to be written if Huffman // encoding is used. - QuicString huffman_encoded_string_; + std::string huffman_encoded_string_; // If Huffman encoding is used, points to a substring of // |huffman_encoded_string_|.
diff --git a/quic/core/qpack/qpack_instruction_encoder_test.cc b/quic/core/qpack/qpack_instruction_encoder_test.cc index 006476f..babbb8c 100644 --- a/quic/core/qpack/qpack_instruction_encoder_test.cc +++ b/quic/core/qpack/qpack_instruction_encoder_test.cc
@@ -23,12 +23,12 @@ ~QpackInstructionEncoderTest() override = default; // Encode |instruction| with fragment sizes dictated by |fragment_mode_|. - QuicString EncodeInstruction(const QpackInstruction* instruction) { + std::string EncodeInstruction(const QpackInstruction* instruction) { EXPECT_FALSE(encoder_.HasNext()); FragmentSizeGenerator fragment_size_generator = FragmentModeToFragmentSizeGenerator(fragment_mode_); - QuicString output; + std::string output; encoder_.Encode(instruction); while (encoder_.HasNext()) { encoder_.Next(fragment_size_generator(), &output);
diff --git a/quic/core/qpack/qpack_progressive_encoder.cc b/quic/core/qpack/qpack_progressive_encoder.cc index 41433ff..497465b 100644 --- a/quic/core/qpack/qpack_progressive_encoder.cc +++ b/quic/core/qpack/qpack_progressive_encoder.cc
@@ -37,7 +37,7 @@ } void QpackProgressiveEncoder::Next(size_t max_encoded_bytes, - QuicString* output) { + std::string* output) { DCHECK_NE(0u, max_encoded_bytes); DCHECK(HasNext());
diff --git a/quic/core/qpack/qpack_progressive_encoder.h b/quic/core/qpack/qpack_progressive_encoder.h index 86cce55..8e204e2 100644 --- a/quic/core/qpack/qpack_progressive_encoder.h +++ b/quic/core/qpack/qpack_progressive_encoder.h
@@ -36,7 +36,7 @@ bool HasNext() const override; // Encodes up to |max_encoded_bytes| octets, appending to |output|. - void Next(size_t max_encoded_bytes, QuicString* output) override; + void Next(size_t max_encoded_bytes, std::string* output) override; private: const QuicStreamId stream_id_;
diff --git a/quic/core/qpack/qpack_round_trip_test.cc b/quic/core/qpack/qpack_round_trip_test.cc index 700ff85..99d55fb 100644 --- a/quic/core/qpack/qpack_round_trip_test.cc +++ b/quic/core/qpack/qpack_round_trip_test.cc
@@ -32,7 +32,7 @@ const spdy::SpdyHeaderBlock& header_list) { NoopDecoderStreamErrorDelegate decoder_stream_error_delegate; NoopEncoderStreamSenderDelegate encoder_stream_sender_delegate; - QuicString encoded_header_block = QpackEncode( + std::string encoded_header_block = QpackEncode( &decoder_stream_error_delegate, &encoder_stream_sender_delegate, FragmentModeToFragmentSizeGenerator(encoding_fragment_mode_), &header_list); @@ -90,8 +90,8 @@ spdy::SpdyHeaderBlock header_list; header_list["foo"] = "bar"; header_list[":path"] = "/"; - header_list["foobaar"] = QuicString(127, 'Z'); - header_list[QuicString(1000, 'b')] = QuicString(1000, 'c'); + header_list["foobaar"] = std::string(127, 'Z'); + header_list[std::string(1000, 'b')] = std::string(1000, 'c'); spdy::SpdyHeaderBlock output = EncodeThenDecode(header_list); EXPECT_EQ(header_list, output);
diff --git a/quic/core/quic_bandwidth.cc b/quic/core/quic_bandwidth.cc index cdcf003..a88e15b 100644 --- a/quic/core/quic_bandwidth.cc +++ b/quic/core/quic_bandwidth.cc
@@ -11,7 +11,7 @@ namespace quic { -QuicString QuicBandwidth::ToDebugValue() const { +std::string QuicBandwidth::ToDebugValue() const { if (bits_per_second_ < 80000) { return QuicStringPrintf("%" PRId64 " bits/s (%" PRId64 " bytes/s)", bits_per_second_, bits_per_second_ / 8);
diff --git a/quic/core/quic_bandwidth.h b/quic/core/quic_bandwidth.h index be3c158..1160d92 100644 --- a/quic/core/quic_bandwidth.h +++ b/quic/core/quic_bandwidth.h
@@ -86,7 +86,7 @@ bits_per_second_); } - QuicString ToDebugValue() const; + std::string ToDebugValue() const; private: explicit constexpr QuicBandwidth(int64_t bits_per_second)
diff --git a/quic/core/quic_buffered_packet_store.cc b/quic/core/quic_buffered_packet_store.cc index 68ebac9..d5637ca 100644 --- a/quic/core/quic_buffered_packet_store.cc +++ b/quic/core/quic_buffered_packet_store.cc
@@ -85,7 +85,7 @@ QuicSocketAddress self_address, QuicSocketAddress peer_address, bool is_chlo, - const QuicString& alpn, + const std::string& alpn, const ParsedQuicVersion& version) { QUIC_BUG_IF(!FLAGS_quic_allow_chlo_buffering) << "Shouldn't buffer packets if disabled via flag.";
diff --git a/quic/core/quic_buffered_packet_store.h b/quic/core/quic_buffered_packet_store.h index f2490ee..f30bacd 100644 --- a/quic/core/quic_buffered_packet_store.h +++ b/quic/core/quic_buffered_packet_store.h
@@ -67,7 +67,7 @@ std::list<BufferedPacket> buffered_packets; QuicTime creation_time; // The alpn from the CHLO, if one was found. - QuicString alpn; + std::string alpn; // Indicating whether this is an IETF QUIC connection. bool ietf_quic; // If buffered_packets contains the CHLO, it is the version of the CHLO. @@ -108,7 +108,7 @@ QuicSocketAddress self_address, QuicSocketAddress peer_address, bool is_chlo, - const QuicString& alpn, + const std::string& alpn, const ParsedQuicVersion& version); // Returns true if there are any packets buffered for |connection_id|.
diff --git a/quic/core/quic_buffered_packet_store_test.cc b/quic/core/quic_buffered_packet_store_test.cc index e214ff1..bee0f13 100644 --- a/quic/core/quic_buffered_packet_store_test.cc +++ b/quic/core/quic_buffered_packet_store_test.cc
@@ -64,7 +64,7 @@ QuicBufferedPacketStore store_; QuicSocketAddress self_address_; QuicSocketAddress peer_address_; - QuicString packet_content_; + std::string packet_content_; QuicTime packet_time_; QuicReceivedPacket packet_; const ParsedQuicVersion invalid_version_;
diff --git a/quic/core/quic_config.cc b/quic/core/quic_config.cc index e53719c..1b70463 100644 --- a/quic/core/quic_config.cc +++ b/quic/core/quic_config.cc
@@ -29,7 +29,7 @@ QuicConfigPresence presence, uint32_t default_value, uint32_t* out, - QuicString* error_details) { + std::string* error_details) { DCHECK(error_details != nullptr); QuicErrorCode error = msg.GetUint32(tag, out); switch (error) { @@ -97,7 +97,7 @@ QuicErrorCode QuicNegotiableUint32::ProcessPeerHello( const CryptoHandshakeMessage& peer_hello, HelloType hello_type, - QuicString* error_details) { + std::string* error_details) { DCHECK(!negotiated()); DCHECK(error_details != nullptr); uint32_t value; @@ -111,7 +111,7 @@ QuicErrorCode QuicNegotiableUint32::ReceiveValue(uint32_t value, HelloType hello_type, - QuicString* error_details) { + std::string* error_details) { if (hello_type == SERVER && value > max_value_) { *error_details = "Invalid value received for " + QuicTagToString(tag_); return QUIC_INVALID_NEGOTIATED_VALUE; @@ -167,7 +167,7 @@ QuicErrorCode QuicFixedUint32::ProcessPeerHello( const CryptoHandshakeMessage& peer_hello, HelloType hello_type, - QuicString* error_details) { + std::string* error_details) { DCHECK(error_details != nullptr); QuicErrorCode error = peer_hello.GetUint32(tag_, &receive_value_); switch (error) { @@ -232,7 +232,7 @@ QuicErrorCode QuicFixedUint128::ProcessPeerHello( const CryptoHandshakeMessage& peer_hello, HelloType hello_type, - QuicString* error_details) { + std::string* error_details) { DCHECK(error_details != nullptr); QuicErrorCode error = peer_hello.GetUint128(tag_, &receive_value_); switch (error) { @@ -302,7 +302,7 @@ QuicErrorCode QuicFixedTagVector::ProcessPeerHello( const CryptoHandshakeMessage& peer_hello, HelloType hello_type, - QuicString* error_details) { + std::string* error_details) { DCHECK(error_details != nullptr); QuicTagVector values; QuicErrorCode error = peer_hello.GetTaglist(tag_, &values); @@ -375,7 +375,7 @@ QuicErrorCode QuicFixedSocketAddress::ProcessPeerHello( const CryptoHandshakeMessage& peer_hello, HelloType hello_type, - QuicString* error_details) { + std::string* error_details) { QuicStringPiece address; if (!peer_hello.GetStringPiece(tag_, &address)) { if (presence_ == PRESENCE_REQUIRED) { @@ -690,7 +690,7 @@ QuicErrorCode QuicConfig::ProcessPeerHello( const CryptoHandshakeMessage& peer_hello, HelloType hello_type, - QuicString* error_details) { + std::string* error_details) { DCHECK(error_details != nullptr); QuicErrorCode error = QUIC_NO_ERROR; @@ -779,7 +779,7 @@ QuicErrorCode QuicConfig::ProcessTransportParameters( const TransportParameters& params, HelloType hello_type, - QuicString* error_details) { + std::string* error_details) { QuicErrorCode error = idle_network_timeout_seconds_.ReceiveValue( params.idle_timeout, hello_type, error_details); if (error != QUIC_NO_ERROR) {
diff --git a/quic/core/quic_config.h b/quic/core/quic_config.h index affc7b9..0037922 100644 --- a/quic/core/quic_config.h +++ b/quic/core/quic_config.h
@@ -55,7 +55,7 @@ virtual QuicErrorCode ProcessPeerHello( const CryptoHandshakeMessage& peer_hello, HelloType hello_type, - QuicString* error_details) = 0; + std::string* error_details) = 0; protected: const QuicTag tag_; @@ -106,7 +106,7 @@ // PRESENCE_OPTIONAL then |negotiated_value_| is set to |default_value_|. QuicErrorCode ProcessPeerHello(const CryptoHandshakeMessage& peer_hello, HelloType hello_type, - QuicString* error_details) override; + std::string* error_details) override; // Takes a value |value| parsed from a handshake message (whether a TLS // ClientHello/ServerHello or a CryptoHandshakeMessage) whose sender was @@ -115,7 +115,7 @@ // an error, details are put in |*error_details|. QuicErrorCode ReceiveValue(uint32_t value, HelloType hello_type, - QuicString* error_details); + std::string* error_details); private: uint32_t max_value_; @@ -147,7 +147,7 @@ // Sets |value_| to the corresponding value from |peer_hello_| if it exists. QuicErrorCode ProcessPeerHello(const CryptoHandshakeMessage& peer_hello, HelloType hello_type, - QuicString* error_details) override; + std::string* error_details) override; private: uint32_t send_value_; @@ -180,7 +180,7 @@ // Sets |value_| to the corresponding value from |peer_hello_| if it exists. QuicErrorCode ProcessPeerHello(const CryptoHandshakeMessage& peer_hello, HelloType hello_type, - QuicString* error_details) override; + std::string* error_details) override; private: QuicUint128 send_value_; @@ -216,7 +216,7 @@ // it exists. QuicErrorCode ProcessPeerHello(const CryptoHandshakeMessage& peer_hello, HelloType hello_type, - QuicString* error_details) override; + std::string* error_details) override; private: QuicTagVector send_values_; @@ -247,7 +247,7 @@ QuicErrorCode ProcessPeerHello(const CryptoHandshakeMessage& peer_hello, HelloType hello_type, - QuicString* error_details) override; + std::string* error_details) override; private: QuicSocketAddress send_value_; @@ -418,7 +418,7 @@ // the corresponding QuicErrorCode and sets detailed error in |error_details|. QuicErrorCode ProcessPeerHello(const CryptoHandshakeMessage& peer_hello, HelloType hello_type, - QuicString* error_details); + std::string* error_details); // FillTransportParameters writes the values to send for ICSL, MIDS, CFCW, and // SFCW to |*params|, returning true if the values could be written and false @@ -431,7 +431,7 @@ // it returns a QuicErrorCode and puts a detailed error in |*error_details|. QuicErrorCode ProcessTransportParameters(const TransportParameters& params, HelloType hello_type, - QuicString* error_details); + std::string* error_details); private: friend class test::QuicConfigPeer;
diff --git a/quic/core/quic_config_test.cc b/quic/core/quic_config_test.cc index 59ad0ef..8b5aad2 100644 --- a/quic/core/quic_config_test.cc +++ b/quic/core/quic_config_test.cc
@@ -67,7 +67,7 @@ CryptoHandshakeMessage msg; client_config.ToHandshakeMessage(&msg); - QuicString error_details; + std::string error_details; QuicTagVector initial_received_options; initial_received_options.push_back(kIW50); EXPECT_TRUE( @@ -115,7 +115,7 @@ server_config.SetStatelessResetTokenToSend(kTestResetToken); CryptoHandshakeMessage msg; server_config.ToHandshakeMessage(&msg); - QuicString error_details; + std::string error_details; const QuicErrorCode error = config_.ProcessPeerHello(msg, SERVER, &error_details); EXPECT_EQ(QUIC_NO_ERROR, error); @@ -142,7 +142,7 @@ msg.SetValue(kMIDS, 1); // No error, as rest are optional. - QuicString error_details; + std::string error_details; const QuicErrorCode error = config_.ProcessPeerHello(msg, CLIENT, &error_details); EXPECT_EQ(QUIC_NO_ERROR, error); @@ -157,7 +157,7 @@ msg.SetValue(kMIDS, 1); // No error, as rest are optional. - QuicString error_details; + std::string error_details; const QuicErrorCode error = config_.ProcessPeerHello(msg, SERVER, &error_details); EXPECT_EQ(QUIC_NO_ERROR, error); @@ -167,7 +167,7 @@ TEST_F(QuicConfigTest, MissingValueInCHLO) { // Server receives CHLO with missing kICSL. CryptoHandshakeMessage msg; - QuicString error_details; + std::string error_details; const QuicErrorCode error = config_.ProcessPeerHello(msg, CLIENT, &error_details); EXPECT_EQ(QUIC_CRYPTO_MESSAGE_PARAMETER_NOT_FOUND, error); @@ -176,7 +176,7 @@ TEST_F(QuicConfigTest, MissingValueInSHLO) { // Client receives SHLO with missing kICSL. CryptoHandshakeMessage msg; - QuicString error_details; + std::string error_details; const QuicErrorCode error = config_.ProcessPeerHello(msg, SERVER, &error_details); EXPECT_EQ(QUIC_CRYPTO_MESSAGE_PARAMETER_NOT_FOUND, error); @@ -190,7 +190,7 @@ CryptoHandshakeMessage msg; server_config.ToHandshakeMessage(&msg); - QuicString error_details; + std::string error_details; const QuicErrorCode error = config_.ProcessPeerHello(msg, SERVER, &error_details); EXPECT_EQ(QUIC_INVALID_NEGOTIATED_VALUE, error); @@ -220,7 +220,7 @@ CryptoHandshakeMessage msg; client_config.ToHandshakeMessage(&msg); - QuicString error_details; + std::string error_details; const QuicErrorCode error = config_.ProcessPeerHello(msg, CLIENT, &error_details); EXPECT_EQ(QUIC_NO_ERROR, error); @@ -241,7 +241,7 @@ CryptoHandshakeMessage msg; client_config.ToHandshakeMessage(&msg); - QuicString error_details; + std::string error_details; const QuicErrorCode error = config_.ProcessPeerHello(msg, CLIENT, &error_details); EXPECT_EQ(QUIC_NO_ERROR, error); @@ -268,7 +268,7 @@ CryptoHandshakeMessage msg; client_config.ToHandshakeMessage(&msg); - QuicString error_details; + std::string error_details; const QuicErrorCode error = config_.ProcessPeerHello(msg, CLIENT, &error_details); EXPECT_EQ(QUIC_NO_ERROR, error);
diff --git a/quic/core/quic_connection.cc b/quic/core/quic_connection.cc index 070191b..b39f617 100644 --- a/quic/core/quic_connection.cc +++ b/quic/core/quic_connection.cc
@@ -564,7 +564,7 @@ if (debug_visitor_ != nullptr) { debug_visitor_->OnPublicResetPacket(packet); } - QuicString error_details = "Received public reset."; + std::string error_details = "Received public reset."; if (perspective_ == Perspective::IS_CLIENT && !packet.endpoint_id.empty()) { QuicStrAppend(&error_details, " From ", packet.endpoint_id, "."); } @@ -580,7 +580,7 @@ QUIC_DLOG(INFO) << ENDPOINT << "Received packet with mismatched version " << ParsedQuicVersionToString(received_version); if (perspective_ == Perspective::IS_CLIENT) { - const QuicString error_details = "Protocol version mismatch."; + const std::string error_details = "Protocol version mismatch."; QUIC_BUG << ENDPOINT << error_details; TearDownLocalConnectionState(QUIC_INTERNAL_ERROR, error_details, ConnectionCloseSource::FROM_SELF); @@ -652,7 +652,7 @@ // here. (Check for a bug regression.) DCHECK_EQ(connection_id_, packet.connection_id); if (perspective_ == Perspective::IS_SERVER) { - const QuicString error_details = + const std::string error_details = "Server receieved version negotiation packet."; QUIC_BUG << error_details; QUIC_CODE_COUNT(quic_tear_down_local_connection_on_version_negotiation); @@ -670,7 +670,7 @@ } if (QuicContainsValue(packet.versions, version())) { - const QuicString error_details = + const std::string error_details = "Server already supports client's version and should have accepted the " "connection."; QUIC_DLOG(WARNING) << error_details; @@ -748,7 +748,7 @@ if (!packet_generator_.IsPendingPacketEmpty()) { // Incoming packets may change a queued ACK frame. - const QuicString error_details = + const std::string error_details = "Pending frames must be serialized before incoming packets are " "processed."; QUIC_BUG << error_details << ", received header: " << header; @@ -780,7 +780,7 @@ if (!header.version_flag) { // Packets should have the version flag till version negotiation is // done. - QuicString error_details = + std::string error_details = QuicStrCat(ENDPOINT, "Packet ", header.packet_number.ToUint64(), " without version flag before version negotiated."); QUIC_DLOG(WARNING) << error_details; @@ -1460,7 +1460,7 @@ const QuicIetfStatelessResetPacket& packet) { // TODO(fayang): Add OnAuthenticatedIetfStatelessResetPacket to // debug_visitor_. - const QuicString error_details = "Received stateless reset."; + const std::string error_details = "Received stateless reset."; QUIC_CODE_COUNT(quic_tear_down_local_connection_on_stateless_reset); TearDownLocalConnectionState(QUIC_PUBLIC_RESET, error_details, ConnectionCloseSource::FROM_PEER); @@ -2491,7 +2491,7 @@ } write_error_occurred_ = true; - const QuicString error_details = QuicStrCat( + const std::string error_details = QuicStrCat( "Write failed with error: ", error_code, " (", strerror(error_code), ")"); QUIC_LOG_FIRST_N(ERROR, 2) << ENDPOINT << error_details; switch (error_code) { @@ -2550,7 +2550,7 @@ } void QuicConnection::OnUnrecoverableError(QuicErrorCode error, - const QuicString& error_details, + const std::string& error_details, ConnectionCloseSource source) { // The packet creator or generator encountered an unrecoverable error: tear // down local connection state immediately. @@ -2842,7 +2842,7 @@ void QuicConnection::CloseConnection( QuicErrorCode error, - const QuicString& error_details, + const std::string& error_details, ConnectionCloseBehavior connection_close_behavior) { DCHECK(!error_details.empty()); if (!connected_) { @@ -2873,7 +2873,7 @@ } void QuicConnection::SendConnectionClosePacket(QuicErrorCode error, - const QuicString& details, + const std::string& details, AckBundling ack_mode) { QUIC_DLOG(INFO) << ENDPOINT << "Sending connection close packet."; if (fix_termination_packets_) { @@ -2895,7 +2895,7 @@ void QuicConnection::TearDownLocalConnectionState( QuicErrorCode error, - const QuicString& error_details, + const std::string& error_details, ConnectionCloseSource source) { if (!connected_) { QUIC_DLOG(INFO) << "Connection is already closed."; @@ -2996,7 +2996,7 @@ << " idle_network_timeout: " << idle_network_timeout_.ToMicroseconds(); if (idle_duration >= idle_network_timeout_) { - const QuicString error_details = "No recent network activity."; + const std::string error_details = "No recent network activity."; QUIC_DVLOG(1) << ENDPOINT << error_details; if ((sent_packet_manager_.GetConsecutiveTlpCount() > 0 || sent_packet_manager_.GetConsecutiveRtoCount() > 0 || @@ -3017,7 +3017,7 @@ << " handshake timeout: " << handshake_timeout_.ToMicroseconds(); if (connected_duration >= handshake_timeout_) { - const QuicString error_details = "Handshake timeout expired."; + const std::string error_details = "Handshake timeout expired."; QUIC_DVLOG(1) << ENDPOINT << error_details; CloseConnection(QUIC_HANDSHAKE_TIMEOUT, error_details, ConnectionCloseBehavior::SEND_CONNECTION_CLOSE_PACKET);
diff --git a/quic/core/quic_connection.h b/quic/core/quic_connection.h index 985e44c..43aa1dd 100644 --- a/quic/core/quic_connection.h +++ b/quic/core/quic_connection.h
@@ -126,7 +126,7 @@ // Called when the connection is closed either locally by the framer, or // remotely by the peer. virtual void OnConnectionClosed(QuicErrorCode error, - const QuicString& error_details, + const std::string& error_details, ConnectionCloseSource source) = 0; // Called when the connection failed to write because the socket was blocked. @@ -276,7 +276,7 @@ // Called when the connection is closed. virtual void OnConnectionClosed(QuicErrorCode error, - const QuicString& error_details, + const std::string& error_details, ConnectionCloseSource source) {} // Called when the version negotiation is successful. @@ -407,7 +407,7 @@ // packet is sent to the peer. virtual void CloseConnection( QuicErrorCode error, - const QuicString& details, + const std::string& details, ConnectionCloseBehavior connection_close_behavior); // Returns statistics tracked for this connection. @@ -519,7 +519,7 @@ // QuicConnectionCloseDelegateInterface void OnUnrecoverableError(QuicErrorCode error, - const QuicString& error_details, + const std::string& error_details, ConnectionCloseSource source) override; // QuicPacketGenerator::DelegateInterface @@ -917,7 +917,7 @@ // TODO(fayang): change |ack_mode| to bool |force_sending_ack| when // deprecating quic_deprecate_ack_bundling_mode. virtual void SendConnectionClosePacket(QuicErrorCode error, - const QuicString& details, + const std::string& details, AckBundling ack_mode); // Returns true if the packet should be discarded and not sent. @@ -952,7 +952,7 @@ // Notifies the visitor of the close and marks the connection as disconnected. // Does not send a connection close frame to the peer. void TearDownLocalConnectionState(QuicErrorCode error, - const QuicString& details, + const std::string& details, ConnectionCloseSource source); // Writes the given packet to socket, encrypted with packet's
diff --git a/quic/core/quic_connection_close_delegate_interface.h b/quic/core/quic_connection_close_delegate_interface.h index c9faab8..321d0e5 100644 --- a/quic/core/quic_connection_close_delegate_interface.h +++ b/quic/core/quic_connection_close_delegate_interface.h
@@ -19,7 +19,7 @@ // Called when an unrecoverable error is encountered. virtual void OnUnrecoverableError(QuicErrorCode error, - const QuicString& error_details, + const std::string& error_details, ConnectionCloseSource source) = 0; };
diff --git a/quic/core/quic_connection_id.cc b/quic/core/quic_connection_id.cc index 25c5b1f..07f3a67 100644 --- a/quic/core/quic_connection_id.cc +++ b/quic/core/quic_connection_id.cc
@@ -64,9 +64,9 @@ data_bytes[0] ^ data_bytes[1] ^ data_bytes[2]); } -QuicString QuicConnectionId::ToString() const { +std::string QuicConnectionId::ToString() const { if (IsEmpty()) { - return QuicString("0"); + return std::string("0"); } return QuicTextUtils::HexEncode(data_, length_); }
diff --git a/quic/core/quic_connection_id.h b/quic/core/quic_connection_id.h index 5a78acd..5a63088 100644 --- a/quic/core/quic_connection_id.h +++ b/quic/core/quic_connection_id.h
@@ -61,7 +61,7 @@ // Generates an ASCII string that represents // the contents of the connection ID, or "0" if it is empty. - QuicString ToString() const; + std::string ToString() const; // operator<< allows easily logging connection IDs. friend QUIC_EXPORT_PRIVATE std::ostream& operator<<(
diff --git a/quic/core/quic_connection_test.cc b/quic/core/quic_connection_test.cc index 62056a0..f991355 100644 --- a/quic/core/quic_connection_test.cc +++ b/quic/core/quic_connection_test.cc
@@ -4148,7 +4148,7 @@ // Send more than MTU worth of data. No acknowledgement was received so far, // so the MTU should be at its old value. - const QuicString data(kDefaultMaxPacketSize + 1, '.'); + const std::string data(kDefaultMaxPacketSize + 1, '.'); QuicByteCount size_before_mtu_change; EXPECT_CALL(*send_algorithm_, OnPacketSent(_, _, _, _, _)) .Times(2) @@ -4578,7 +4578,7 @@ // Create a handshake message that also enables silent close. CryptoHandshakeMessage msg; - QuicString error_details; + std::string error_details; QuicConfig client_config; client_config.SetInitialStreamFlowControlWindowToSend( kInitialStreamFlowControlWindowForTest); @@ -4645,7 +4645,7 @@ // Create a handshake message that also enables silent close. CryptoHandshakeMessage msg; - QuicString error_details; + std::string error_details; QuicConfig client_config; client_config.SetInitialStreamFlowControlWindowToSend( kInitialStreamFlowControlWindowForTest); @@ -4701,7 +4701,7 @@ // Create a handshake message that also enables silent close. CryptoHandshakeMessage msg; - QuicString error_details; + std::string error_details; QuicConfig client_config; client_config.SetInitialStreamFlowControlWindowToSend( kInitialStreamFlowControlWindowForTest); @@ -4941,7 +4941,7 @@ // Queue the first packet. EXPECT_CALL(*send_algorithm_, CanSend(_)).WillOnce(testing::Return(false)); - const QuicString payload(payload_length, 'a'); + const std::string payload(payload_length, 'a'); EXPECT_EQ(0u, connection_.SendStreamDataWithString(3, payload, 0, NO_FIN) .bytes_consumed); EXPECT_EQ(0u, connection_.NumQueuedPackets()); @@ -5000,7 +5000,7 @@ // scope of this test. total_payload_length = total_payload_length + 2; } - const QuicString payload(total_payload_length, 'a'); + const std::string payload(total_payload_length, 'a'); EXPECT_EQ(payload.size(), connection_ @@ -5018,7 +5018,7 @@ QuicPacketCreatorPeer::SetSendVersionInPacket(creator_, false); } // Set up a larger payload than will fit in one packet. - const QuicString payload(connection_.max_packet_length(), 'a'); + const std::string payload(connection_.max_packet_length(), 'a'); EXPECT_CALL(*send_algorithm_, SetFromConfig(_, _)).Times(AnyNumber()); // Now send some packets with no truncation. @@ -7286,7 +7286,7 @@ } TEST_P(QuicConnectionTest, CloseConnectionForStatelessReject) { - QuicString error_details("stateless reject"); + std::string error_details("stateless reject"); EXPECT_CALL(visitor_, OnConnectionClosed( QUIC_CRYPTO_HANDSHAKE_STATELESS_REJECT, error_details, ConnectionCloseSource::FROM_PEER)); @@ -7624,7 +7624,7 @@ if (connection_.transport_version() <= QUIC_VERSION_44) { return; } - QuicString message(connection_.GetLargestMessagePayload() * 2, 'a'); + std::string message(connection_.GetLargestMessagePayload() * 2, 'a'); QuicStringPiece message_data(message); QuicMemSliceStorage storage(nullptr, 0, nullptr, 0); {
diff --git a/quic/core/quic_control_frame_manager.cc b/quic/core/quic_control_frame_manager.cc index 8d4ba53..5fd756f 100644 --- a/quic/core/quic_control_frame_manager.cc +++ b/quic/core/quic_control_frame_manager.cc
@@ -47,7 +47,7 @@ void QuicControlFrameManager::WriteOrBufferGoAway( QuicErrorCode error, QuicStreamId last_good_stream_id, - const QuicString& reason) { + const std::string& reason) { QUIC_DVLOG(1) << "Writing GOAWAY_FRAME"; WriteOrBufferQuicFrame(QuicFrame(new QuicGoAwayFrame( ++last_control_frame_id_, error, last_good_stream_id, reason)));
diff --git a/quic/core/quic_control_frame_manager.h b/quic/core/quic_control_frame_manager.h index 618f3f9..355179a 100644 --- a/quic/core/quic_control_frame_manager.h +++ b/quic/core/quic_control_frame_manager.h
@@ -43,7 +43,7 @@ // immediately. void WriteOrBufferGoAway(QuicErrorCode error, QuicStreamId last_good_stream_id, - const QuicString& reason); + const std::string& reason); // Tries to send a WINDOW_UPDATE_FRAME. Buffers the frame if it cannot be sent // immediately.
diff --git a/quic/core/quic_crypto_client_handshaker.cc b/quic/core/quic_crypto_client_handshaker.cc index 6647061..62b5bdb 100644 --- a/quic/core/quic_crypto_client_handshaker.cc +++ b/quic/core/quic_crypto_client_handshaker.cc
@@ -52,7 +52,7 @@ void QuicCryptoClientHandshaker::ProofVerifierCallbackImpl::Run( bool ok, - const QuicString& error_details, + const std::string& error_details, std::unique_ptr<ProofVerifyDetails>* details) { if (parent_ == nullptr) { return; @@ -161,7 +161,7 @@ return channel_id_source_callback_run_; } -QuicString QuicCryptoClientHandshaker::chlo_hash() const { +std::string QuicCryptoClientHandshaker::chlo_hash() const { return chlo_hash_; } @@ -185,7 +185,7 @@ void QuicCryptoClientHandshaker::HandleServerConfigUpdateMessage( const CryptoHandshakeMessage& server_config_update) { DCHECK(server_config_update.tag() == kSCUP); - QuicString error_details; + std::string error_details; QuicCryptoClientConfig::CachedState* cached = crypto_config_->LookupOrCreate(server_id_); QuicErrorCode error = crypto_config_->ProcessServerConfigUpdate( @@ -350,7 +350,7 @@ DCHECK(!crypto_negotiated_params_->server_nonce.empty()); } - QuicString error_details; + std::string error_details; QuicErrorCode error = crypto_config_->FillClientHello( server_id_, session()->connection()->connection_id(), session()->supported_versions().front(), cached, @@ -433,7 +433,7 @@ session()->NeuterUnencryptedData(); stateless_reject_received_ = in->tag() == kSREJ; - QuicString error_details; + std::string error_details; QuicErrorCode error = crypto_config_->ProcessRejection( *in, session()->connection()->clock()->WallNow(), session()->connection()->transport_version(), chlo_hash_, cached, @@ -613,7 +613,7 @@ return; } - QuicString error_details; + std::string error_details; QuicErrorCode error = crypto_config_->ProcessServerHello( *in, session()->connection()->connection_id(), session()->connection()->version(),
diff --git a/quic/core/quic_crypto_client_handshaker.h b/quic/core/quic_crypto_client_handshaker.h index 5836ea2..d335628 100644 --- a/quic/core/quic_crypto_client_handshaker.h +++ b/quic/core/quic_crypto_client_handshaker.h
@@ -40,7 +40,7 @@ int num_scup_messages_received() const override; bool WasChannelIDSent() const override; bool WasChannelIDSourceCallbackRun() const override; - QuicString chlo_hash() const override; + std::string chlo_hash() const override; bool encryption_established() const override; bool handshake_confirmed() const override; const QuicCryptoNegotiatedParameters& crypto_negotiated_params() @@ -87,7 +87,7 @@ // ProofVerifierCallback interface. void Run(bool ok, - const QuicString& error_details, + const std::string& error_details, std::unique_ptr<ProofVerifyDetails>* details) override; // Cancel causes any future callbacks to be ignored. It must be called on @@ -174,7 +174,7 @@ QuicCryptoClientConfig* const crypto_config_; // SHA-256 hash of the most recently sent CHLO. - QuicString chlo_hash_; + std::string chlo_hash_; // Server's (hostname, port, is_https, privacy_mode) tuple. const QuicServerId server_id_; @@ -213,7 +213,7 @@ // verification. These members must not be used after // STATE_VERIFY_PROOF_COMPLETE. bool verify_ok_; - QuicString verify_error_details_; + std::string verify_error_details_; std::unique_ptr<ProofVerifyDetails> verify_details_; // True if the server responded to a previous CHLO with a stateless
diff --git a/quic/core/quic_crypto_client_handshaker_test.cc b/quic/core/quic_crypto_client_handshaker_test.cc index e21faf3..329f3c3 100644 --- a/quic/core/quic_crypto_client_handshaker_test.cc +++ b/quic/core/quic_crypto_client_handshaker_test.cc
@@ -31,26 +31,26 @@ // ProofVerifier override. QuicAsyncStatus VerifyProof( - const QuicString& hostname, + const std::string& hostname, const uint16_t port, - const QuicString& server_config, + const std::string& server_config, QuicTransportVersion transport_version, QuicStringPiece chlo_hash, - const std::vector<QuicString>& certs, - const QuicString& cert_sct, - const QuicString& signature, + const std::vector<std::string>& certs, + const std::string& cert_sct, + const std::string& signature, const ProofVerifyContext* context, - QuicString* error_details, + std::string* error_details, std::unique_ptr<ProofVerifyDetails>* verify_details, std::unique_ptr<ProofVerifierCallback> callback) override { return QUIC_SUCCESS; } QuicAsyncStatus VerifyCertChain( - const QuicString& hostname, - const std::vector<QuicString>& certs, + const std::string& hostname, + const std::vector<std::string>& certs, const ProofVerifyContext* context, - QuicString* error_details, + std::string* error_details, std::unique_ptr<ProofVerifyDetails>* details, std::unique_ptr<ProofVerifierCallback> callback) override { return QUIC_SUCCESS; @@ -68,8 +68,8 @@ // ProofSource override. void GetProof(const QuicSocketAddress& server_address, - const QuicString& hostname, - const QuicString& server_config, + const std::string& hostname, + const std::string& server_config, QuicTransportVersion transport_version, QuicStringPiece chlo_hash, std::unique_ptr<Callback> callback) override { @@ -83,8 +83,8 @@ QuicReferenceCountedPointer<Chain> GetCertChain( const QuicSocketAddress& server_address, - const QuicString& hostname) override { - std::vector<QuicString> certs; + const std::string& hostname) override { + std::vector<std::string> certs; certs.push_back("Dummy cert"); return QuicReferenceCountedPointer<ProofSource::Chain>( new ProofSource::Chain(certs)); @@ -92,7 +92,7 @@ void ComputeTlsSignature( const QuicSocketAddress& server_address, - const QuicString& hostname, + const std::string& hostname, uint16_t signature_algorithm, QuicStringPiece in, std::unique_ptr<SignatureCallback> callback) override { @@ -157,7 +157,7 @@ QuicCryptoServerConfig::GenerateConfig(helper_.GetRandomGenerator(), helper_.GetClock(), options); state_.Initialize( - config->config(), "sourcetoken", std::vector<QuicString>{"Dummy cert"}, + config->config(), "sourcetoken", std::vector<std::string>{"Dummy cert"}, "", "chlo_hash", "signature", helper_.GetClock()->WallNow(), helper_.GetClock()->WallNow().Add(QuicTime::Delta::FromSeconds(30)));
diff --git a/quic/core/quic_crypto_client_stream.cc b/quic/core/quic_crypto_client_stream.cc index 66bb9e4..52edbc0 100644 --- a/quic/core/quic_crypto_client_stream.cc +++ b/quic/core/quic_crypto_client_stream.cc
@@ -92,7 +92,7 @@ return handshaker_->WasChannelIDSourceCallbackRun(); } -QuicString QuicCryptoClientStream::chlo_hash() const { +std::string QuicCryptoClientStream::chlo_hash() const { return handshaker_->chlo_hash(); }
diff --git a/quic/core/quic_crypto_client_stream.h b/quic/core/quic_crypto_client_stream.h index da149fe..ad6518b 100644 --- a/quic/core/quic_crypto_client_stream.h +++ b/quic/core/quic_crypto_client_stream.h
@@ -90,7 +90,7 @@ // ChannelIDSource operated asynchronously. Intended for testing. virtual bool WasChannelIDSourceCallbackRun() const = 0; - virtual QuicString chlo_hash() const = 0; + virtual std::string chlo_hash() const = 0; // Returns true once any encrypter (initial/0RTT or final/1RTT) has been set // for the connection. @@ -156,7 +156,7 @@ // ChannelIDSource operated asynchronously. Intended for testing. bool WasChannelIDSourceCallbackRun() const; - QuicString chlo_hash() const; + std::string chlo_hash() const; protected: void set_handshaker(std::unique_ptr<HandshakerDelegate> handshaker) {
diff --git a/quic/core/quic_crypto_client_stream_test.cc b/quic/core/quic_crypto_client_stream_test.cc index d9b344a..bd5162b 100644 --- a/quic/core/quic_crypto_client_stream_test.cc +++ b/quic/core/quic_crypto_client_stream_test.cc
@@ -188,10 +188,10 @@ QuicCryptoClientConfig::CachedState* state = crypto_config_.LookupOrCreate(server_id_); - std::vector<QuicString> certs = state->certs(); - QuicString cert_sct = state->cert_sct(); - QuicString signature = state->signature(); - QuicString chlo_hash = state->chlo_hash(); + std::vector<std::string> certs = state->certs(); + std::string cert_sct = state->cert_sct(); + std::string signature = state->signature(); + std::string chlo_hash = state->chlo_hash(); state->SetProof(certs, cert_sct, chlo_hash, signature + signature); EXPECT_CALL(*session_, OnProofVerifyDetailsAvailable(testing::_)) @@ -243,7 +243,7 @@ // Make sure that the STK and SCFG are cached correctly. EXPECT_EQ("xstk", state->source_address_token()); - const QuicString& cached_scfg = state->server_config(); + const std::string& cached_scfg = state->server_config(); test::CompareCharArraysWithHexError( "scfg", cached_scfg.data(), cached_scfg.length(), reinterpret_cast<char*>(scfg), QUIC_ARRAYSIZE(scfg));
diff --git a/quic/core/quic_crypto_server_handshaker.cc b/quic/core/quic_crypto_server_handshaker.cc index 66f3e12..fb24fed 100644 --- a/quic/core/quic_crypto_server_handshaker.cc +++ b/quic/core/quic_crypto_server_handshaker.cc
@@ -24,7 +24,7 @@ void Run( QuicErrorCode error, - const QuicString& error_details, + const std::string& error_details, std::unique_ptr<CryptoHandshakeMessage> message, std::unique_ptr<DiversificationNonce> diversification_nonce, std::unique_ptr<ProofSource::Details> proof_source_details) override { @@ -160,7 +160,7 @@ FinishProcessingHandshakeMessageAfterProcessClientHello( const ValidateClientHelloResultCallback::Result& result, QuicErrorCode error, - const QuicString& error_details, + const std::string& error_details, std::unique_ptr<CryptoHandshakeMessage> reply, std::unique_ptr<DiversificationNonce> diversification_nonce, std::unique_ptr<ProofSource::Details> proof_source_details) { @@ -207,7 +207,7 @@ // session config. QuicConfig* config = session()->config(); OverrideQuicConfigDefaults(config); - QuicString process_error_details; + std::string process_error_details; const QuicErrorCode process_error = config->ProcessPeerHello(message, CLIENT, &process_error_details); if (process_error != QUIC_NO_ERROR) { @@ -354,13 +354,13 @@ } bool QuicCryptoServerHandshaker::GetBase64SHA256ClientChannelID( - QuicString* output) const { + std::string* output) const { if (!encryption_established() || crypto_negotiated_params_->channel_id.empty()) { return false; } - const QuicString& channel_id(crypto_negotiated_params_->channel_id); + const std::string& channel_id(crypto_negotiated_params_->channel_id); uint8_t digest[SHA256_DIGEST_LENGTH]; SHA256(reinterpret_cast<const uint8_t*>(channel_id.data()), channel_id.size(), digest); @@ -392,7 +392,7 @@ std::unique_ptr<ProofSource::Details> proof_source_details, std::unique_ptr<ProcessClientHelloResultCallback> done_cb) { const CryptoHandshakeMessage& message = result->client_hello; - QuicString error_details; + std::string error_details; if (!helper_->CanAcceptClientHello( message, GetClientAddress(), session()->connection()->peer_address(), session()->connection()->self_address(), &error_details)) {
diff --git a/quic/core/quic_crypto_server_handshaker.h b/quic/core/quic_crypto_server_handshaker.h index a1ec99f..544307c 100644 --- a/quic/core/quic_crypto_server_handshaker.h +++ b/quic/core/quic_crypto_server_handshaker.h
@@ -39,7 +39,7 @@ // From HandshakerDelegate void CancelOutstandingCallbacks() override; - bool GetBase64SHA256ClientChannelID(QuicString* output) const override; + bool GetBase64SHA256ClientChannelID(std::string* output) const override; void SendServerConfigUpdate( const CachedNetworkParameters* cached_network_params) override; uint8_t NumHandshakeMessages() const override; @@ -139,7 +139,7 @@ void FinishProcessingHandshakeMessageAfterProcessClientHello( const ValidateClientHelloResultCallback::Result& result, QuicErrorCode error, - const QuicString& error_details, + const std::string& error_details, std::unique_ptr<CryptoHandshakeMessage> reply, std::unique_ptr<DiversificationNonce> diversification_nonce, std::unique_ptr<ProofSource::Details> proof_source_details); @@ -177,7 +177,7 @@ // Hash of the last received CHLO message which can be used for generating // server config update messages. - QuicString chlo_hash_; + std::string chlo_hash_; // Pointer to the helper for this crypto stream. Must outlive this stream. QuicCryptoServerStream::Helper* helper_;
diff --git a/quic/core/quic_crypto_server_stream.cc b/quic/core/quic_crypto_server_stream.cc index aa75c66..02e7b8f 100644 --- a/quic/core/quic_crypto_server_stream.cc +++ b/quic/core/quic_crypto_server_stream.cc
@@ -71,7 +71,7 @@ } bool QuicCryptoServerStream::GetBase64SHA256ClientChannelID( - QuicString* output) const { + std::string* output) const { return handshaker()->GetBase64SHA256ClientChannelID(output); }
diff --git a/quic/core/quic_crypto_server_stream.h b/quic/core/quic_crypto_server_stream.h index 53d4b38..ec339e1 100644 --- a/quic/core/quic_crypto_server_stream.h +++ b/quic/core/quic_crypto_server_stream.h
@@ -41,7 +41,7 @@ // GetBase64SHA256ClientChannelID sets |*output| to the base64 encoded, // SHA-256 hash of the client's ChannelID key and returns true, if the client // presented a ChannelID. Otherwise it returns false. - virtual bool GetBase64SHA256ClientChannelID(QuicString* output) const = 0; + virtual bool GetBase64SHA256ClientChannelID(std::string* output) const = 0; virtual int NumServerConfigUpdateMessagesSent() const = 0; @@ -92,7 +92,7 @@ // GetBase64SHA256ClientChannelID sets |*output| to the base64 encoded, // SHA-256 hash of the client's ChannelID key and returns true, if the // client presented a ChannelID. Otherwise it returns false. - virtual bool GetBase64SHA256ClientChannelID(QuicString* output) const = 0; + virtual bool GetBase64SHA256ClientChannelID(std::string* output) const = 0; // Sends the latest server config and source-address token to the client. virtual void SendServerConfigUpdate( @@ -147,7 +147,7 @@ const QuicSocketAddress& client_address, const QuicSocketAddress& peer_address, const QuicSocketAddress& self_address, - QuicString* error_details) const = 0; + std::string* error_details) const = 0; }; // |crypto_config| must outlive the stream. @@ -165,7 +165,7 @@ // From QuicCryptoServerStreamBase void CancelOutstandingCallbacks() override; - bool GetBase64SHA256ClientChannelID(QuicString* output) const override; + bool GetBase64SHA256ClientChannelID(std::string* output) const override; void SendServerConfigUpdate( const CachedNetworkParameters* cached_network_params) override; uint8_t NumHandshakeMessages() const override;
diff --git a/quic/core/quic_crypto_stream.cc b/quic/core/quic_crypto_stream.cc index aef431d..6a941e7 100644 --- a/quic/core/quic_crypto_stream.cc +++ b/quic/core/quic_crypto_stream.cc
@@ -107,7 +107,7 @@ bool QuicCryptoStream::ExportKeyingMaterial(QuicStringPiece label, QuicStringPiece context, size_t result_len, - QuicString* result) const { + std::string* result) const { if (!handshake_confirmed()) { QUIC_DLOG(ERROR) << "ExportKeyingMaterial was called before forward-secure" << "encryption was established.";
diff --git a/quic/core/quic_crypto_stream.h b/quic/core/quic_crypto_stream.h index d2a729e..e60277b 100644 --- a/quic/core/quic_crypto_stream.h +++ b/quic/core/quic_crypto_stream.h
@@ -63,7 +63,7 @@ bool ExportKeyingMaterial(QuicStringPiece label, QuicStringPiece context, size_t result_len, - QuicString* result) const; + std::string* result) const; // Writes |data| to the QuicStream at level |level|. virtual void WriteCryptoData(EncryptionLevel level, QuicStringPiece data);
diff --git a/quic/core/quic_crypto_stream_test.cc b/quic/core/quic_crypto_stream_test.cc index 26ed335..263910b 100644 --- a/quic/core/quic_crypto_stream_test.cc +++ b/quic/core/quic_crypto_stream_test.cc
@@ -118,7 +118,7 @@ } TEST_F(QuicCryptoStreamTest, ProcessBadData) { - QuicString bad(message_data_->data(), message_data_->length()); + std::string bad(message_data_->data(), message_data_->length()); const int kFirstTagIndex = sizeof(uint32_t) + // message tag sizeof(uint16_t) + // number of tag-value pairs sizeof(uint16_t); // padding @@ -148,7 +148,7 @@ InSequence s; // Send [0, 1350) in ENCRYPTION_NONE. EXPECT_EQ(ENCRYPTION_NONE, connection_->encryption_level()); - QuicString data(1350, 'a'); + std::string data(1350, 'a'); EXPECT_CALL( session_, WritevData(_, @@ -208,7 +208,7 @@ InSequence s; // Send [0, 1350) in ENCRYPTION_NONE. EXPECT_EQ(ENCRYPTION_NONE, connection_->encryption_level()); - QuicString data(1350, 'a'); + std::string data(1350, 'a'); EXPECT_CALL(*connection_, SendCryptoData(ENCRYPTION_NONE, 1350, 0)) .WillOnce(Invoke(connection_, &MockQuicConnection::QuicConnection_SendCryptoData)); @@ -258,7 +258,7 @@ } // Send [0, 1350) in ENCRYPTION_NONE. EXPECT_EQ(ENCRYPTION_NONE, connection_->encryption_level()); - QuicString data(1350, 'a'); + std::string data(1350, 'a'); EXPECT_CALL( session_, WritevData(_, @@ -300,7 +300,7 @@ } // Send [0, 1350) in ENCRYPTION_NONE. EXPECT_EQ(ENCRYPTION_NONE, connection_->encryption_level()); - QuicString data(1350, 'a'); + std::string data(1350, 'a'); EXPECT_CALL(*connection_, SendCryptoData(ENCRYPTION_NONE, 1350, 0)) .WillOnce(Invoke(connection_, &MockQuicConnection::QuicConnection_SendCryptoData)); @@ -344,7 +344,7 @@ InSequence s; // Send [0, 1350) in ENCRYPTION_NONE. EXPECT_EQ(ENCRYPTION_NONE, connection_->encryption_level()); - QuicString data(1350, 'a'); + std::string data(1350, 'a'); EXPECT_CALL( session_, WritevData(_, @@ -417,7 +417,7 @@ InSequence s; // Send [0, 1350) in ENCRYPTION_NONE. EXPECT_EQ(ENCRYPTION_NONE, connection_->encryption_level()); - QuicString data(1350, 'a'); + std::string data(1350, 'a'); EXPECT_CALL(*connection_, SendCryptoData(ENCRYPTION_NONE, 1350, 0)) .WillOnce(Invoke(connection_, &MockQuicConnection::QuicConnection_SendCryptoData)); @@ -473,7 +473,7 @@ if (connection_->transport_version() >= QUIC_VERSION_47) { return; } - QuicString data(1350, 'a'); + std::string data(1350, 'a'); EXPECT_CALL( session_, WritevData(_, @@ -504,7 +504,7 @@ } // Send [0, 1350) in ENCRYPTION_NONE. EXPECT_EQ(ENCRYPTION_NONE, connection_->encryption_level()); - QuicString data(1350, 'a'); + std::string data(1350, 'a'); EXPECT_CALL(*connection_, SendCryptoData(ENCRYPTION_NONE, 1350, 0)) .WillOnce(Invoke(connection_, &MockQuicConnection::QuicConnection_SendCryptoData));
diff --git a/quic/core/quic_data_reader.cc b/quic/core/quic_data_reader.cc index e1fbffe..4200329 100644 --- a/quic/core/quic_data_reader.cc +++ b/quic/core/quic_data_reader.cc
@@ -305,7 +305,7 @@ return true; } -QuicString QuicDataReader::DebugString() const { +std::string QuicDataReader::DebugString() const { return QuicStrCat(" { length: ", len_, ", position: ", pos_, " }"); }
diff --git a/quic/core/quic_data_reader.h b/quic/core/quic_data_reader.h index fff0ffd..6295882 100644 --- a/quic/core/quic_data_reader.h +++ b/quic/core/quic_data_reader.h
@@ -149,7 +149,7 @@ // greater than (2^32)-1. bool ReadVarIntStreamId(QuicStreamId* result); - QuicString DebugString() const; + std::string DebugString() const; private: // Returns true if the underlying buffer has enough room to read the given
diff --git a/quic/core/quic_data_writer.cc b/quic/core/quic_data_writer.cc index c70bbdd..98a173d 100644 --- a/quic/core/quic_data_writer.cc +++ b/quic/core/quic_data_writer.cc
@@ -349,7 +349,7 @@ return true; } -QuicString QuicDataWriter::DebugString() const { +std::string QuicDataWriter::DebugString() const { return QuicStrCat(" { capacity: ", capacity_, ", length: ", length_, " }"); }
diff --git a/quic/core/quic_data_writer.h b/quic/core/quic_data_writer.h index e107fcb..4e6b179 100644 --- a/quic/core/quic_data_writer.h +++ b/quic/core/quic_data_writer.h
@@ -122,7 +122,7 @@ size_t remaining() const { return capacity_ - length_; } - QuicString DebugString() const; + std::string DebugString() const; private: // Returns the location that the data should be written at, or nullptr if
diff --git a/quic/core/quic_dispatcher.cc b/quic/core/quic_dispatcher.cc index 14da558..ce95320 100644 --- a/quic/core/quic_dispatcher.cc +++ b/quic/core/quic_dispatcher.cc
@@ -72,7 +72,7 @@ } void OnUnrecoverableError(QuicErrorCode error, - const QuicString& error_details, + const std::string& error_details, ConnectionCloseSource source) override {} void SaveStatelessRejectFrameData(QuicStringPiece reject) { @@ -135,7 +135,7 @@ // Generates a packet containing a CONNECTION_CLOSE frame specifying // |error_code| and |error_details| and add the connection to time wait. void CloseConnection(QuicErrorCode error_code, - const QuicString& error_details, + const std::string& error_details, bool ietf_quic) { QuicConnectionCloseFrame* frame = new QuicConnectionCloseFrame; frame->error_code = error_code; @@ -211,14 +211,14 @@ const CryptoHandshakeMessage& chlo) override { QuicStringPiece alpn_value; if (chlo.GetStringPiece(kALPN, &alpn_value)) { - alpn_ = QuicString(alpn_value); + alpn_ = std::string(alpn_value); } } - QuicString&& ConsumeAlpn() { return std::move(alpn_); } + std::string&& ConsumeAlpn() { return std::move(alpn_); } private: - QuicString alpn_; + std::string alpn_; }; // Class which sits between the ChloExtractor and the StatelessRejector @@ -255,7 +255,7 @@ bool can_accept() const { return can_accept_; } - const QuicString& error_details() const { return error_details_; } + const std::string& error_details() const { return error_details_; } private: QuicCryptoServerStream::Helper* helper_; // Unowned. @@ -266,7 +266,7 @@ QuicSocketAddress self_address_; StatelessRejector* rejector_; // Unowned. bool can_accept_; - QuicString error_details_; + std::string error_details_; }; } // namespace @@ -653,7 +653,7 @@ void QuicDispatcher::OnConnectionClosed(QuicConnectionId connection_id, QuicErrorCode error, - const QuicString& error_details, + const std::string& error_details, ConnectionCloseSource source) { auto it = session_map_.find(connection_id); if (it == session_map_.end()) { @@ -714,7 +714,7 @@ PacketHeaderFormat format, ParsedQuicVersion version, QuicErrorCode error_code, - const QuicString& error_details, + const std::string& error_details, QuicTimeWaitListManager::TimeWaitAction action) { if (format != IETF_QUIC_LONG_HEADER_PACKET) { QUIC_DVLOG(1) << "Statelessly terminating " << connection_id
diff --git a/quic/core/quic_dispatcher.h b/quic/core/quic_dispatcher.h index 85e6da6..77d4952 100644 --- a/quic/core/quic_dispatcher.h +++ b/quic/core/quic_dispatcher.h
@@ -79,7 +79,7 @@ // Ensure that the closed connection is cleaned up asynchronously. void OnConnectionClosed(QuicConnectionId connection_id, QuicErrorCode error, - const QuicString& error_details, + const std::string& error_details, ConnectionCloseSource source) override; // QuicSession::Visitor interface implementation (via inheritance of @@ -338,7 +338,7 @@ PacketHeaderFormat format, ParsedQuicVersion version, QuicErrorCode error_code, - const QuicString& error_details, + const std::string& error_details, QuicTimeWaitListManager::TimeWaitAction action); // Save/Restore per packet context. Used by async stateless rejector. @@ -453,7 +453,7 @@ QuicSocketAddress current_self_address_; const QuicReceivedPacket* current_packet_; // If |current_packet_| is a CHLO packet, the extracted alpn. - QuicString current_alpn_; + std::string current_alpn_; QuicConnectionId current_connection_id_; // Used to get the supported versions based on flag. Does not own.
diff --git a/quic/core/quic_dispatcher_test.cc b/quic/core/quic_dispatcher_test.cc index e4a42a4..c744505 100644 --- a/quic/core/quic_dispatcher_test.cc +++ b/quic/core/quic_dispatcher_test.cc
@@ -77,7 +77,7 @@ MOCK_METHOD3(OnConnectionClosed, void(QuicErrorCode error, - const QuicString& error_details, + const std::string& error_details, ConnectionCloseSource source)); MOCK_METHOD1(CreateIncomingStream, QuicSpdyStream*(QuicStreamId id)); MOCK_METHOD1(CreateIncomingStream, QuicSpdyStream*(PendingStream pending)); @@ -138,7 +138,7 @@ bool(QuicConnectionId connection_id, bool ietf_quic)); struct TestQuicPerPacketContext : public QuicPerPacketContext { - QuicString custom_packet_context; + std::string custom_packet_context; }; std::unique_ptr<QuicPerPacketContext> GetPerPacketContext() const override { @@ -154,7 +154,7 @@ custom_packet_context_ = test_context->custom_packet_context; } - QuicString custom_packet_context_; + std::string custom_packet_context_; using QuicDispatcher::current_client_address; using QuicDispatcher::current_peer_address; @@ -246,7 +246,7 @@ void ProcessPacket(QuicSocketAddress peer_address, QuicConnectionId connection_id, bool has_version_flag, - const QuicString& data) { + const std::string& data) { ProcessPacket(peer_address, connection_id, has_version_flag, data, CONNECTION_ID_PRESENT, PACKET_4BYTE_PACKET_NUMBER); } @@ -256,7 +256,7 @@ void ProcessPacket(QuicSocketAddress peer_address, QuicConnectionId connection_id, bool has_version_flag, - const QuicString& data, + const std::string& data, QuicConnectionIdIncluded connection_id_included, QuicPacketNumberLength packet_number_length) { ProcessPacket(peer_address, connection_id, has_version_flag, data, @@ -267,7 +267,7 @@ void ProcessPacket(QuicSocketAddress peer_address, QuicConnectionId connection_id, bool has_version_flag, - const QuicString& data, + const std::string& data, QuicConnectionIdIncluded connection_id_included, QuicPacketNumberLength packet_number_length, uint64_t packet_number) { @@ -281,7 +281,7 @@ QuicConnectionId connection_id, bool has_version_flag, ParsedQuicVersion version, - const QuicString& data, + const std::string& data, QuicConnectionIdIncluded connection_id_included, QuicPacketNumberLength packet_number_length, uint64_t packet_number) { @@ -298,11 +298,11 @@ // Add CHLO packet to the beginning to be verified first, because it is // also processed first by new session. data_connection_map_[connection_id].push_front( - QuicString(packet->data(), packet->length())); + std::string(packet->data(), packet->length())); } else { // For non-CHLO, always append to last. data_connection_map_[connection_id].push_back( - QuicString(packet->data(), packet->length())); + std::string(packet->data(), packet->length())); } dispatcher_->ProcessPacket(server_address_, peer_address, *received_packet); } @@ -347,14 +347,14 @@ time_wait_list_manager_); } - QuicString SerializeCHLO() { + std::string SerializeCHLO() { CryptoHandshakeMessage client_hello; client_hello.set_tag(kCHLO); client_hello.SetStringPiece(kALPN, "hq"); - return QuicString(client_hello.GetSerialized().AsStringPiece()); + return std::string(client_hello.GetSerialized().AsStringPiece()); } - QuicString SerializeTlsClientHello() { return ""; } + std::string SerializeTlsClientHello() { return ""; } void MarkSession1Deleted() { session1_ = nullptr; } @@ -368,7 +368,7 @@ MockTimeWaitListManager* time_wait_list_manager_; TestQuicSpdyServerSession* session1_; TestQuicSpdyServerSession* session2_; - std::map<QuicConnectionId, std::list<QuicString>> data_connection_map_; + std::map<QuicConnectionId, std::list<std::string>> data_connection_map_; QuicBufferedPacketStore* store_; }; @@ -499,7 +499,7 @@ ParsedQuicVersion parsed_version(PROTOCOL_QUIC_CRYPTO, version); // Pad the CHLO message with enough data to make the packet large enough // to trigger version negotiation. - QuicString chlo = SerializeCHLO() + QuicString(1200, 'a'); + std::string chlo = SerializeCHLO() + std::string(1200, 'a'); DCHECK_LE(1200u, chlo.length()); ProcessPacket(client_address, TestConnectionId(1), true, parsed_version, chlo, CONNECTION_ID_PRESENT, PACKET_4BYTE_PACKET_NUMBER, 1); @@ -516,11 +516,11 @@ QuicTransportVersion version = static_cast<QuicTransportVersion>(QuicTransportVersionMin() - 1); ParsedQuicVersion parsed_version(PROTOCOL_QUIC_CRYPTO, version); - QuicString chlo = SerializeCHLO() + QuicString(1200, 'a'); + std::string chlo = SerializeCHLO() + std::string(1200, 'a'); // Truncate to 1100 bytes of payload which results in a packet just // under 1200 bytes after framing, packet, and encryption overhead. DCHECK_LE(1200u, chlo.length()); - QuicString truncated_chlo = chlo.substr(0, 1100); + std::string truncated_chlo = chlo.substr(0, 1100); DCHECK_EQ(1100u, truncated_chlo.length()); ProcessPacket(client_address, TestConnectionId(1), true, parsed_version, truncated_chlo, CONNECTION_ID_PRESENT, @@ -542,11 +542,11 @@ QuicTransportVersion version = static_cast<QuicTransportVersion>(QuicTransportVersionMin() - 1); ParsedQuicVersion parsed_version(PROTOCOL_QUIC_CRYPTO, version); - QuicString chlo = SerializeCHLO() + QuicString(1200, 'a'); + std::string chlo = SerializeCHLO() + std::string(1200, 'a'); // Truncate to 1100 bytes of payload which results in a packet just // under 1200 bytes after framing, packet, and encryption overhead. DCHECK_LE(1200u, chlo.length()); - QuicString truncated_chlo = chlo.substr(0, 1100); + std::string truncated_chlo = chlo.substr(0, 1100); DCHECK_EQ(1100u, truncated_chlo.length()); ProcessPacket(client_address, TestConnectionId(1), true, parsed_version, truncated_chlo, CONNECTION_ID_PRESENT, @@ -1167,7 +1167,7 @@ .Times(1); } ProcessPacket(client_address, connection_id, true, - QuicString(client_hello.GetSerialized().AsStringPiece())); + std::string(client_hello.GetSerialized().AsStringPiece())); if (GetParam().enable_stateless_rejects_via_flag) { EXPECT_EQ(true, @@ -1218,7 +1218,7 @@ }))) .RetiresOnSaturation(); ProcessPacket(client_address, connection_id, true, - QuicString(client_hello.GetSerialized().AsStringPiece())); + std::string(client_hello.GetSerialized().AsStringPiece())); EXPECT_FALSE( time_wait_list_manager_->IsConnectionIdInTimeWait(connection_id)); } @@ -1624,8 +1624,8 @@ &full_chlo_); } - QuicString SerializeFullCHLO() { - return QuicString(full_chlo_.GetSerialized().AsStringPiece()); + std::string SerializeFullCHLO() { + return std::string(full_chlo_.GetSerialized().AsStringPiece()); } protected: @@ -2130,16 +2130,16 @@ return static_cast<FakeProofSource*>(crypto_config_peer_.GetProofSource()); } - QuicString SerializeFullCHLO() { - return QuicString(full_chlo_.GetSerialized().AsStringPiece()); + std::string SerializeFullCHLO() { + return std::string(full_chlo_.GetSerialized().AsStringPiece()); } - QuicString SerializeFullCHLOForClient2() { - return QuicString(full_chlo_2_.GetSerialized().AsStringPiece()); + std::string SerializeFullCHLOForClient2() { + return std::string(full_chlo_2_.GetSerialized().AsStringPiece()); } - QuicString SerializeCHLO() { - return QuicString(chlo_.GetSerialized().AsStringPiece()); + std::string SerializeCHLO() { + return std::string(chlo_.GetSerialized().AsStringPiece()); } // Sets up a session, and crypto stream based on the test parameters.
diff --git a/quic/core/quic_framer.cc b/quic/core/quic_framer.cc index 2ffb762..22d0ecf 100644 --- a/quic/core/quic_framer.cc +++ b/quic/core/quic_framer.cc
@@ -1368,7 +1368,7 @@ IpAddressFamily::IP_UNSPEC) { // packet.client_address is non-empty. QuicSocketAddressCoder address_coder(packet.client_address); - QuicString serialized_address = address_coder.Encode(); + std::string serialized_address = address_coder.Encode(); if (serialized_address.empty()) { return nullptr; } @@ -1994,7 +1994,7 @@ QuicStringPiece endpoint_id; if (perspective_ == Perspective::IS_CLIENT && reset->GetStringPiece(kEPID, &endpoint_id)) { - packet.endpoint_id = QuicString(endpoint_id); + packet.endpoint_id = std::string(endpoint_id); packet.endpoint_id += '\0'; } @@ -3724,7 +3724,7 @@ set_detailed_error("Unable to read connection close error details."); return false; } - frame->error_details = QuicString(error_details); + frame->error_details = std::string(error_details); return true; } @@ -3755,7 +3755,7 @@ set_detailed_error("Unable to read goaway reason."); return false; } - frame->reason_phrase = QuicString(reason_phrase); + frame->reason_phrase = std::string(reason_phrase); return true; } @@ -4511,7 +4511,7 @@ set_detailed_error("Unable to read new token data."); return false; } - frame->token = QuicString(data); + frame->token = std::string(data); return true; } @@ -5225,7 +5225,7 @@ set_detailed_error("Unable to read connection close error details."); return false; } - frame->error_details = QuicString(phrase); + frame->error_details = std::string(phrase); return true; } @@ -5250,7 +5250,7 @@ set_detailed_error("Unable to read application close error details."); return false; } - frame->error_details = QuicString(phrase); + frame->error_details = std::string(phrase); return true; }
diff --git a/quic/core/quic_framer.h b/quic/core/quic_framer.h index 168fef5..d6916f6 100644 --- a/quic/core/quic_framer.h +++ b/quic/core/quic_framer.h
@@ -516,7 +516,7 @@ // to ciphertext no larger than |ciphertext_size|. size_t GetMaxPlaintextSize(size_t ciphertext_size); - const QuicString& detailed_error() { return detailed_error_; } + const std::string& detailed_error() { return detailed_error_; } // The minimum packet number length required to represent |packet_number|. static QuicPacketNumberLength GetMinPacketNumberLength( @@ -859,7 +859,7 @@ void set_detailed_error(const char* error) { detailed_error_ = error; } - QuicString detailed_error_; + std::string detailed_error_; QuicFramerVisitorInterface* visitor_; QuicErrorCode error_; // Updated by ProcessPacketHeader when it succeeds decrypting a larger packet.
diff --git a/quic/core/quic_framer_test.cc b/quic/core/quic_framer_test.cc index bcd9db6..527307a 100644 --- a/quic/core/quic_framer_test.cc +++ b/quic/core/quic_framer_test.cc
@@ -92,8 +92,8 @@ size_t* output_length, size_t max_output_length) override { packet_number_ = QuicPacketNumber(packet_number); - associated_data_ = QuicString(associated_data); - plaintext_ = QuicString(plaintext); + associated_data_ = std::string(associated_data); + plaintext_ = std::string(plaintext); memcpy(output, plaintext.data(), plaintext.length()); *output_length = plaintext.length(); return true; @@ -111,8 +111,8 @@ QuicStringPiece GetNoncePrefix() const override { return QuicStringPiece(); } QuicPacketNumber packet_number_; - QuicString associated_data_; - QuicString plaintext_; + std::string associated_data_; + std::string plaintext_; }; class TestDecrypter : public QuicDecrypter { @@ -135,8 +135,8 @@ size_t* output_length, size_t max_output_length) override { packet_number_ = QuicPacketNumber(packet_number); - associated_data_ = QuicString(associated_data); - ciphertext_ = QuicString(ciphertext); + associated_data_ = std::string(associated_data); + ciphertext_ = std::string(ciphertext); memcpy(output, ciphertext.data(), ciphertext.length()); *output_length = ciphertext.length(); return true; @@ -148,8 +148,8 @@ // Use a distinct value starting with 0xFFFFFF, which is never used by TLS. uint32_t cipher_id() const override { return 0xFFFFFFF2; } QuicPacketNumber packet_number_; - QuicString associated_data_; - QuicString ciphertext_; + std::string associated_data_; + std::string ciphertext_; }; class TestQuicVisitor : public QuicFramerVisitorInterface { @@ -220,8 +220,8 @@ bool OnStreamFrame(const QuicStreamFrame& frame) override { ++frame_count_; // Save a copy of the data so it is valid after the packet is processed. - QuicString* string_data = - new QuicString(frame.data_buffer, frame.data_length); + std::string* string_data = + new std::string(frame.data_buffer, frame.data_length); stream_data_.push_back(QuicWrapUnique(string_data)); stream_frames_.push_back(QuicMakeUnique<QuicStreamFrame>( frame.stream_id, frame.fin, frame.offset, *string_data)); @@ -231,8 +231,8 @@ bool OnCryptoFrame(const QuicCryptoFrame& frame) override { ++frame_count_; // Save a copy of the data so it is valid after the packet is processed. - QuicString* string_data = - new QuicString(frame.data_buffer, frame.data_length); + std::string* string_data = + new std::string(frame.data_buffer, frame.data_length); crypto_data_.push_back(QuicWrapUnique(string_data)); crypto_frames_.push_back(QuicMakeUnique<QuicCryptoFrame>( ENCRYPTION_NONE, frame.offset, *string_data)); @@ -407,14 +407,14 @@ QuicNewConnectionIdFrame new_connection_id_; QuicRetireConnectionIdFrame retire_connection_id_; QuicNewTokenFrame new_token_; - std::vector<std::unique_ptr<QuicString>> stream_data_; - std::vector<std::unique_ptr<QuicString>> crypto_data_; + std::vector<std::unique_ptr<std::string>> stream_data_; + std::vector<std::unique_ptr<std::string>> crypto_data_; }; // Simple struct for defining a packet's content, and associated // parse error. struct PacketFragment { - QuicString error_if_missing; + std::string error_if_missing; std::vector<unsigned char> fragment; }; @@ -569,7 +569,7 @@ // Check all the various prefixes of |packet| for the expected // parse error and error code. for (size_t i = 0; i < packet->length(); ++i) { - QuicString expected_error; + std::string expected_error; size_t len = 0; for (const auto& fragment : fragments) { len += fragment.fragment.size(); @@ -588,7 +588,7 @@ void CheckProcessingFails(const QuicEncryptedPacket& packet, size_t len, - QuicString expected_error, + std::string expected_error, QuicErrorCode error_code) { QuicEncryptedPacket encrypted(packet.data(), len, false); EXPECT_FALSE(framer_.ProcessPacket(encrypted)) << "len: " << len; @@ -598,7 +598,7 @@ void CheckProcessingFails(unsigned char* packet, size_t len, - QuicString expected_error, + std::string expected_error, QuicErrorCode error_code) { QuicEncryptedPacket encrypted(AsChars(packet), len, false); EXPECT_FALSE(framer_.ProcessPacket(encrypted)) << "len: " << len; @@ -607,8 +607,8 @@ } // Checks if the supplied string matches data in the supplied StreamFrame. - void CheckStreamFrameData(QuicString str, QuicStreamFrame* frame) { - EXPECT_EQ(str, QuicString(frame->data_buffer, frame->data_length)); + void CheckStreamFrameData(std::string str, QuicStreamFrame* frame) { + EXPECT_EQ(str, std::string(frame->data_buffer, frame->data_length)); } void CheckCalculatePacketNumber(uint64_t expected_packet_number, @@ -6210,7 +6210,8 @@ ASSERT_EQ(1u, visitor_.crypto_frames_.size()); QuicCryptoFrame* frame = visitor_.crypto_frames_[0].get(); EXPECT_EQ(kStreamOffset, frame->offset); - EXPECT_EQ("hello world!", QuicString(frame->data_buffer, frame->data_length)); + EXPECT_EQ("hello world!", + std::string(frame->data_buffer, frame->data_length)); CheckFramingBoundaries(packet, QUIC_INVALID_FRAME_DATA); } @@ -7377,7 +7378,7 @@ } else { close_frame.error_code = static_cast<QuicErrorCode>(0x05060708); } - close_frame.error_details = QuicString(2048, 'A'); + close_frame.error_details = std::string(2048, 'A'); QuicFrames frames = {QuicFrame(&close_frame)}; // clang-format off @@ -7662,7 +7663,7 @@ QuicApplicationCloseFrame app_close_frame; app_close_frame.error_code = static_cast<QuicErrorCode>(0x11); - app_close_frame.error_details = QuicString(2048, 'A'); + app_close_frame.error_details = std::string(2048, 'A'); QuicFrames frames = {QuicFrame(&app_close_frame)}; @@ -7846,7 +7847,7 @@ QuicGoAwayFrame goaway_frame; goaway_frame.error_code = static_cast<QuicErrorCode>(0x05060708); goaway_frame.last_good_stream_id = kStreamId; - goaway_frame.reason_phrase = QuicString(2048, 'A'); + goaway_frame.reason_phrase = std::string(2048, 'A'); QuicFrames frames = {QuicFrame(&goaway_frame)}; @@ -9605,7 +9606,7 @@ return (frame.stream_id == kTestQuicStreamId || frame.stream_id == QuicUtils::GetCryptoStreamId(QUIC_VERSION_99)) && !frame.fin && frame.offset == 0 && - QuicString(frame.data_buffer, frame.data_length) == kTestString; + std::string(frame.data_buffer, frame.data_length) == kTestString; // FIN is hard-coded false in ConstructEncryptedPacket. // Offset 0 is hard-coded in ConstructEncryptedPacket. } @@ -11223,8 +11224,8 @@ uint8_t expected_token_value[] = {0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07}; - QuicNewTokenFrame frame(0, QuicString((const char*)(expected_token_value), - sizeof(expected_token_value))); + QuicNewTokenFrame frame(0, std::string((const char*)(expected_token_value), + sizeof(expected_token_value))); QuicFrames frames = {QuicFrame(&frame)}; @@ -11511,7 +11512,7 @@ QuicFramer::GetRetransmittableControlFrameSize( framer_.transport_version(), QuicFrame(&rst_stream))); - QuicString error_detail(2048, 'e'); + std::string error_detail(2048, 'e'); QuicConnectionCloseFrame connection_close(QUIC_NETWORK_IDLE_TIMEOUT, error_detail); EXPECT_EQ(QuicFramer::GetMinConnectionCloseFrameSize(
diff --git a/quic/core/quic_ietf_framer_test.cc b/quic/core/quic_ietf_framer_test.cc index a959791..9e4f3b0 100644 --- a/quic/core/quic_ietf_framer_test.cc +++ b/quic/core/quic_ietf_framer_test.cc
@@ -796,7 +796,7 @@ NETWORK_BYTE_ORDER); // empty string, - QuicString test_string = "Ich Bin Ein Jelly Donut?"; + std::string test_string = "Ich Bin Ein Jelly Donut?"; QuicConnectionCloseFrame sent_frame; sent_frame.error_code = static_cast<QuicErrorCode>(0); sent_frame.error_details = test_string; @@ -831,7 +831,7 @@ NETWORK_BYTE_ORDER); // empty string, - QuicString test_string = "Ich Bin Ein Jelly Donut?"; + std::string test_string = "Ich Bin Ein Jelly Donut?"; QuicApplicationCloseFrame sent_frame; sent_frame.error_code = static_cast<QuicErrorCode>(0); sent_frame.error_details = test_string;
diff --git a/quic/core/quic_interval_set.h b/quic/core/quic_interval_set.h index e2ca7a5..fe3165b 100644 --- a/quic/core/quic_interval_set.h +++ b/quic/core/quic_interval_set.h
@@ -298,7 +298,7 @@ // where the intervals are in the same order as given by traversal from // begin() to end(). This representation is intended for human consumption; // computer programs should not rely on the output being in exactly this form. - QuicString ToString() const; + std::string ToString() const; QuicIntervalSet& operator=(std::initializer_list<value_type> il) { assign(il.begin(), il.end()); @@ -809,7 +809,7 @@ } template <typename T> -QuicString QuicIntervalSet<T>::ToString() const { +std::string QuicIntervalSet<T>::ToString() const { std::ostringstream os; os << *this; return os.str();
diff --git a/quic/core/quic_interval_set_test.cc b/quic/core/quic_interval_set_test.cc index e823e4f..de45f6f 100644 --- a/quic/core/quic_interval_set_test.cc +++ b/quic/core/quic_interval_set_test.cc
@@ -424,7 +424,7 @@ } TEST_F(QuicIntervalSetTest, QuicIntervalSetIntersectionBothEmpty) { - QuicIntervalSet<QuicString> mine, theirs; + QuicIntervalSet<std::string> mine, theirs; EXPECT_FALSE(mine.Intersects(theirs)); EXPECT_FALSE(theirs.Intersects(mine)); mine.Intersection(theirs); @@ -434,8 +434,8 @@ } TEST_F(QuicIntervalSetTest, QuicIntervalSetIntersectionEmptyMine) { - QuicIntervalSet<QuicString> mine; - QuicIntervalSet<QuicString> theirs("a", "b"); + QuicIntervalSet<std::string> mine; + QuicIntervalSet<std::string> theirs("a", "b"); EXPECT_FALSE(mine.Intersects(theirs)); EXPECT_FALSE(theirs.Intersects(mine)); mine.Intersection(theirs); @@ -445,8 +445,8 @@ } TEST_F(QuicIntervalSetTest, QuicIntervalSetIntersectionEmptyTheirs) { - QuicIntervalSet<QuicString> mine("a", "b"); - QuicIntervalSet<QuicString> theirs; + QuicIntervalSet<std::string> mine("a", "b"); + QuicIntervalSet<std::string> theirs; EXPECT_FALSE(mine.Intersects(theirs)); EXPECT_FALSE(theirs.Intersects(mine)); mine.Intersection(theirs); @@ -456,8 +456,8 @@ } TEST_F(QuicIntervalSetTest, QuicIntervalSetIntersectionTheirsBeforeMine) { - QuicIntervalSet<QuicString> mine("y", "z"); - QuicIntervalSet<QuicString> theirs; + QuicIntervalSet<std::string> mine("y", "z"); + QuicIntervalSet<std::string> theirs; theirs.Add("a", "b"); theirs.Add("c", "d"); EXPECT_FALSE(mine.Intersects(theirs)); @@ -469,10 +469,10 @@ } TEST_F(QuicIntervalSetTest, QuicIntervalSetIntersectionMineBeforeTheirs) { - QuicIntervalSet<QuicString> mine; + QuicIntervalSet<std::string> mine; mine.Add("a", "b"); mine.Add("c", "d"); - QuicIntervalSet<QuicString> theirs("y", "z"); + QuicIntervalSet<std::string> theirs("y", "z"); EXPECT_FALSE(mine.Intersects(theirs)); EXPECT_FALSE(theirs.Intersects(mine)); mine.Intersection(theirs); @@ -682,7 +682,7 @@ } TEST_F(QuicIntervalSetTest, QuicIntervalSetDifferenceEmptyMine) { - QuicIntervalSet<QuicString> mine, theirs; + QuicIntervalSet<std::string> mine, theirs; theirs.Add("a", "b"); mine.Difference(theirs); @@ -690,7 +690,7 @@ } TEST_F(QuicIntervalSetTest, QuicIntervalSetDifferenceEmptyTheirs) { - QuicIntervalSet<QuicString> mine, theirs; + QuicIntervalSet<std::string> mine, theirs; mine.Add("a", "b"); mine.Difference(theirs); @@ -700,7 +700,7 @@ } TEST_F(QuicIntervalSetTest, QuicIntervalSetDifferenceTheirsBeforeMine) { - QuicIntervalSet<QuicString> mine, theirs; + QuicIntervalSet<std::string> mine, theirs; mine.Add("y", "z"); theirs.Add("a", "b"); @@ -711,7 +711,7 @@ } TEST_F(QuicIntervalSetTest, QuicIntervalSetDifferenceMineBeforeTheirs) { - QuicIntervalSet<QuicString> mine, theirs; + QuicIntervalSet<std::string> mine, theirs; mine.Add("a", "b"); theirs.Add("y", "z"); @@ -722,10 +722,10 @@ } TEST_F(QuicIntervalSetTest, QuicIntervalSetDifferenceIdentical) { - QuicIntervalSet<QuicString> mine; + QuicIntervalSet<std::string> mine; mine.Add("a", "b"); mine.Add("c", "d"); - QuicIntervalSet<QuicString> theirs(mine); + QuicIntervalSet<std::string> theirs(mine); mine.Difference(theirs); EXPECT_TRUE(mine.Empty());
diff --git a/quic/core/quic_interval_test.cc b/quic/core/quic_interval_test.cc index 143d417..50e8a50 100644 --- a/quic/core/quic_interval_test.cc +++ b/quic/core/quic_interval_test.cc
@@ -402,7 +402,7 @@ TEST_F(QuicIntervalTest, IntervalOfTypeWithNoOperatorMinus) { // QuicInterval<T> should work even if T does not support operator-(). We // just can't call QuicInterval<T>::Length() for such types. - const QuicInterval<QuicString> d1("a", "b"); + const QuicInterval<std::string> d1("a", "b"); const QuicInterval<std::pair<int, int>> d2({1, 2}, {4, 3}); EXPECT_EQ("a", d1.min()); EXPECT_EQ("b", d1.max());
diff --git a/quic/core/quic_packet_creator.cc b/quic/core/quic_packet_creator.cc index 9d823bc..2fd5203 100644 --- a/quic/core/quic_packet_creator.cc +++ b/quic/core/quic_packet_creator.cc
@@ -188,7 +188,7 @@ if (FLAGS_quic_enforce_single_packet_chlo && StreamFrameStartsWithChlo(frame->stream_frame) && frame->stream_frame.data_length < write_length) { - const QuicString error_details = + const std::string error_details = "Client hello won't fit in a single packet."; QUIC_BUG << error_details << " Constructed stream frame length: " << frame->stream_frame.data_length @@ -380,7 +380,7 @@ void QuicPacketCreator::OnSerializedPacket() { if (packet_.encrypted_buffer == nullptr) { - const QuicString error_details = "Failed to SerializePacket."; + const std::string error_details = "Failed to SerializePacket."; QUIC_BUG << error_details; delegate_->OnUnrecoverableError(QUIC_FAILED_TO_SERIALIZE_PACKET, error_details, @@ -792,7 +792,7 @@ } void QuicPacketCreator::SetRetryToken(QuicStringPiece retry_token) { - retry_token_ = QuicString(retry_token); + retry_token_ = std::string(retry_token); } QuicVariableLengthIntegerLength QuicPacketCreator::GetLengthLength() const { @@ -849,7 +849,7 @@ frame.stream_frame.stream_id != QuicUtils::GetCryptoStreamId(framer_->transport_version()) && packet_.encryption_level == ENCRYPTION_NONE) { - const QuicString error_details = + const std::string error_details = "Cannot send stream data without encryption."; QUIC_BUG << error_details; delegate_->OnUnrecoverableError(
diff --git a/quic/core/quic_packet_creator.h b/quic/core/quic_packet_creator.h index f4512c3..3ff5819 100644 --- a/quic/core/quic_packet_creator.h +++ b/quic/core/quic_packet_creator.h
@@ -390,7 +390,7 @@ SerializedPacket packet_; // Retry token to send over the wire in v99 IETF Initial packets. - QuicString retry_token_; + std::string retry_token_; // Pending padding bytes to send. Pending padding bytes will be sent in next // packet(s) (after all other frames) if current constructed packet does not
diff --git a/quic/core/quic_packet_creator_test.cc b/quic/core/quic_packet_creator_test.cc index c15955c..87b6897 100644 --- a/quic/core/quic_packet_creator_test.cc +++ b/quic/core/quic_packet_creator_test.cc
@@ -179,7 +179,7 @@ void CheckStreamFrame(const QuicFrame& frame, QuicStreamId stream_id, - const QuicString& data, + const std::string& data, QuicStreamOffset offset, bool fin) { EXPECT_EQ(STREAM_FRAME, frame.type); @@ -253,7 +253,7 @@ QuicFramer client_framer_; StrictMock<MockFramerVisitor> framer_visitor_; StrictMock<MockPacketCreatorDelegate> delegate_; - QuicString data_; + std::string data_; struct iovec iov_; TestPacketCreator creator_; SerializedPacket serialized_packet_; @@ -468,7 +468,7 @@ GetStreamFrameOverhead(client_framer_.transport_version()); size_t capacity = kDefaultMaxPacketSize - overhead; for (int delta = -5; delta <= 0; ++delta) { - QuicString data(capacity + delta, 'A'); + std::string data(capacity + delta, 'A'); size_t bytes_free = 0 - delta; QuicFrame frame; @@ -532,7 +532,7 @@ } TEST_P(QuicPacketCreatorTest, ConsumeCryptoData) { - QuicString data = "crypto data"; + std::string data = "crypto data"; QuicFrame frame; ASSERT_TRUE(creator_.ConsumeCryptoData(ENCRYPTION_NONE, data.length(), 0, NOT_RETRANSMISSION, &frame)); @@ -577,7 +577,7 @@ EXPECT_EQ(0u, consumed); CheckStreamFrame( frame, QuicUtils::GetCryptoStreamId(client_framer_.transport_version()), - QuicString(), 0u, true); + std::string(), 0u, true); EXPECT_TRUE(creator_.HasPendingFrames()); } @@ -620,7 +620,7 @@ size_t capacity = kDefaultMaxPacketSize - overhead; // Now, test various sizes around this size. for (int delta = -5; delta <= 5; ++delta) { - QuicString data(capacity + delta, 'A'); + std::string data(capacity + delta, 'A'); size_t bytes_free = delta > 0 ? 0 : 0 - delta; QuicFrame frame; MakeIOVector(data, &iov_); @@ -651,7 +651,7 @@ size_t capacity = kDefaultMaxPacketSize - overhead; // Now, test various sizes around this size. for (int delta = -5; delta <= 5; ++delta) { - QuicString data(capacity + delta, 'A'); + std::string data(capacity + delta, 'A'); size_t bytes_free = delta > 0 ? 0 : 0 - delta; QuicFrame frame; @@ -691,7 +691,7 @@ size_t capacity = kDefaultMaxPacketSize - overhead; // Now, test various sizes around this size. for (int delta = -5; delta <= 5; ++delta) { - QuicString data(capacity + delta, 'A'); + std::string data(capacity + delta, 'A'); size_t bytes_free = delta > 0 ? 0 : 0 - delta; QuicFrame frame; @@ -1128,7 +1128,7 @@ QuicPacketCreatorPeer::GetRetryTokenLengthLength(&creator_), QuicPacketCreatorPeer::GetLengthLength(&creator_), &payload_length)); QuicFrame frame; - const QuicString too_long_payload(payload_length * 2, 'a'); + const std::string too_long_payload(payload_length * 2, 'a'); MakeIOVector(too_long_payload, &iov_); EXPECT_CALL(delegate_, OnSerializedPacket(_)) .WillOnce(Invoke(this, &QuicPacketCreatorTest::SaveSerializedPacket)); @@ -1137,7 +1137,7 @@ 1u, iov_.iov_len, 0u, 0u, true, false, NOT_RETRANSMISSION, &frame)); size_t consumed = frame.stream_frame.data_length; EXPECT_EQ(payload_length, consumed); - const QuicString payload(payload_length, 'a'); + const std::string payload(payload_length, 'a'); CheckStreamFrame( frame, QuicUtils::GetCryptoStreamId(client_framer_.transport_version()), payload, 0u, false); @@ -1510,7 +1510,7 @@ // Verify that there is enough room for the largest message payload. EXPECT_TRUE( creator_.HasRoomForMessageFrame(creator_.GetLargestMessagePayload())); - QuicString message(creator_.GetLargestMessagePayload(), 'a'); + std::string message(creator_.GetLargestMessagePayload(), 'a'); QuicMessageFrame* message_frame = new QuicMessageFrame(1); MakeSpan(&allocator_, message, &storage) .SaveMemSlicesAsMessageData(message_frame); @@ -1555,7 +1555,7 @@ if (client_framer_.transport_version() <= QUIC_VERSION_44) { return; } - QuicString message_data(kDefaultMaxPacketSize, 'a'); + std::string message_data(kDefaultMaxPacketSize, 'a'); QuicStringPiece message_buffer(message_data); QuicMemSliceStorage storage(nullptr, 0, nullptr, 0); // Test all possible size of message frames. @@ -1635,7 +1635,7 @@ 9, 10, 11, 12, 13, 14, 15, 16}; creator_.SetRetryToken( - QuicString(retry_token_bytes, sizeof(retry_token_bytes))); + std::string(retry_token_bytes, sizeof(retry_token_bytes))); frames_.push_back(QuicFrame(QuicStreamFrame( QuicUtils::GetCryptoStreamId(client_framer_.transport_version()), false,
diff --git a/quic/core/quic_packet_generator_test.cc b/quic/core/quic_packet_generator_test.cc index 7b7d6ce..3903984 100644 --- a/quic/core/quic_packet_generator_test.cc +++ b/quic/core/quic_packet_generator_test.cc
@@ -52,7 +52,7 @@ MOCK_METHOD0(GetPacketBuffer, char*()); MOCK_METHOD1(OnSerializedPacket, void(SerializedPacket* packet)); MOCK_METHOD3(OnUnrecoverableError, - void(QuicErrorCode, const QuicString&, ConnectionCloseSource)); + void(QuicErrorCode, const std::string&, ConnectionCloseSource)); void SetCanWriteAnything() { EXPECT_CALL(*this, ShouldGeneratePacket(_, _)).WillRepeatedly(Return(true)); @@ -239,7 +239,7 @@ } QuicGoAwayFrame* CreateGoAwayFrame() { - return new QuicGoAwayFrame(2, QUIC_NO_ERROR, 1, QuicString()); + return new QuicGoAwayFrame(2, QUIC_NO_ERROR, 1, std::string()); } void CheckPacketContains(const PacketContents& contents, @@ -478,7 +478,7 @@ EXPECT_CALL(delegate_, OnSerializedPacket(_)) .WillOnce(Invoke(this, &QuicPacketGeneratorTest::SavePacket)); - QuicString data = "crypto data"; + std::string data = "crypto data"; size_t consumed_bytes = generator_.ConsumeCryptoData(ENCRYPTION_NONE, data, 0); generator_.Flush(); @@ -1350,7 +1350,7 @@ frame->error_code = QUIC_PACKET_WRITE_ERROR; char buf[2000] = {}; QuicStringPiece error_details(buf, 2000); - frame->error_details = QuicString(error_details); + frame->error_details = std::string(error_details); generator_.AddControlFrame(QuicFrame(frame), /*bundle_ack=*/false); EXPECT_TRUE(generator_.HasQueuedFrames()); EXPECT_TRUE(generator_.HasRetransmittableFrames()); @@ -1533,7 +1533,7 @@ MESSAGE_STATUS_SUCCESS, generator_.AddMessageFrame( 2, MakeSpan(&allocator_, - QuicString(generator_.GetLargestMessagePayload(), 'a'), + std::string(generator_.GetLargestMessagePayload(), 'a'), &storage))); EXPECT_TRUE(generator_.HasRetransmittableFrames()); @@ -1543,7 +1543,7 @@ generator_.AddMessageFrame( 3, MakeSpan(&allocator_, - QuicString(generator_.GetLargestMessagePayload() + 10, 'a'), + std::string(generator_.GetLargestMessagePayload() + 10, 'a'), &storage))); }
diff --git a/quic/core/quic_packets.h b/quic/core/quic_packets.h index d2aaf34..509fd08 100644 --- a/quic/core/quic_packets.h +++ b/quic/core/quic_packets.h
@@ -140,7 +140,7 @@ // An arbitrary string to identify an endpoint. Used by clients to // differentiate traffic from Google servers vs Non-google servers. // Will not be used if empty(). - QuicString endpoint_id; + std::string endpoint_id; }; struct QUIC_EXPORT_PRIVATE QuicVersionNegotiationPacket {
diff --git a/quic/core/quic_sent_packet_manager.cc b/quic/core/quic_sent_packet_manager.cc index 6d6710f..bfafe43 100644 --- a/quic/core/quic_sent_packet_manager.cc +++ b/quic/core/quic_sent_packet_manager.cc
@@ -1010,7 +1010,7 @@ return retransmission_delay; } -QuicString QuicSentPacketManager::GetDebugState() const { +std::string QuicSentPacketManager::GetDebugState() const { return send_algorithm_->GetDebugState(); }
diff --git a/quic/core/quic_sent_packet_manager.h b/quic/core/quic_sent_packet_manager.h index aacdc34..873e88b 100644 --- a/quic/core/quic_sent_packet_manager.h +++ b/quic/core/quic_sent_packet_manager.h
@@ -237,7 +237,7 @@ } // Returns debugging information about the state of the congestion controller. - QuicString GetDebugState() const; + std::string GetDebugState() const; // Returns the number of bytes that are considered in-flight, i.e. not lost or // acknowledged.
diff --git a/quic/core/quic_server_id.cc b/quic/core/quic_server_id.cc index ab35d6e..43b94b1 100644 --- a/quic/core/quic_server_id.cc +++ b/quic/core/quic_server_id.cc
@@ -14,10 +14,10 @@ QuicServerId::QuicServerId() : QuicServerId("", 0, false) {} -QuicServerId::QuicServerId(const QuicString& host, uint16_t port) +QuicServerId::QuicServerId(const std::string& host, uint16_t port) : QuicServerId(host, port, false) {} -QuicServerId::QuicServerId(const QuicString& host, +QuicServerId::QuicServerId(const std::string& host, uint16_t port, bool privacy_mode_enabled) : host_(host), port_(port), privacy_mode_enabled_(privacy_mode_enabled) {}
diff --git a/quic/core/quic_server_id.h b/quic/core/quic_server_id.h index 62c0fda..33a0f0a 100644 --- a/quic/core/quic_server_id.h +++ b/quic/core/quic_server_id.h
@@ -17,8 +17,8 @@ class QUIC_EXPORT_PRIVATE QuicServerId { public: QuicServerId(); - QuicServerId(const QuicString& host, uint16_t port); - QuicServerId(const QuicString& host, + QuicServerId(const std::string& host, uint16_t port); + QuicServerId(const std::string& host, uint16_t port, bool privacy_mode_enabled); ~QuicServerId(); @@ -27,7 +27,7 @@ bool operator<(const QuicServerId& other) const; bool operator==(const QuicServerId& other) const; - const QuicString& host() const { return host_; } + const std::string& host() const { return host_; } uint16_t port() const { return port_; } @@ -36,7 +36,7 @@ size_t EstimateMemoryUsage() const; private: - QuicString host_; + std::string host_; uint16_t port_; bool privacy_mode_enabled_; };
diff --git a/quic/core/quic_server_id_test.cc b/quic/core/quic_server_id_test.cc index e7a2abe..01e5a81 100644 --- a/quic/core/quic_server_id_test.cc +++ b/quic/core/quic_server_id_test.cc
@@ -116,7 +116,7 @@ } TEST_F(QuicServerIdTest, EstimateMemoryUsage) { - QuicString host = "this is a rather very quite long hostname"; + std::string host = "this is a rather very quite long hostname"; uint16_t port = 10; bool privacy_mode_enabled = true; QuicServerId server_id(host, port, privacy_mode_enabled);
diff --git a/quic/core/quic_session.cc b/quic/core/quic_session.cc index 09e3865..151fa18 100644 --- a/quic/core/quic_session.cc +++ b/quic/core/quic_session.cc
@@ -289,7 +289,7 @@ } void QuicSession::OnConnectionClosed(QuicErrorCode error, - const QuicString& error_details, + const std::string& error_details, ConnectionCloseSource source) { DCHECK(!connection_->connected()); if (error_ == QUIC_NO_ERROR) { @@ -617,7 +617,7 @@ } void QuicSession::SendGoAway(QuicErrorCode error_code, - const QuicString& reason) { + const std::string& reason) { // GOAWAY frame is not supported in v99. DCHECK_NE(QUIC_VERSION_99, connection_->transport_version()); if (goaway_sent_) {
diff --git a/quic/core/quic_session.h b/quic/core/quic_session.h index 6cd766f..68cc96e 100644 --- a/quic/core/quic_session.h +++ b/quic/core/quic_session.h
@@ -54,7 +54,7 @@ // Called when the connection is closed after the streams have been closed. virtual void OnConnectionClosed(QuicConnectionId connection_id, QuicErrorCode error, - const QuicString& error_details, + const std::string& error_details, ConnectionCloseSource source) = 0; // Called when the session has become write blocked. @@ -106,7 +106,7 @@ void OnWindowUpdateFrame(const QuicWindowUpdateFrame& frame) override; void OnBlockedFrame(const QuicBlockedFrame& frame) override; void OnConnectionClosed(QuicErrorCode error, - const QuicString& error_details, + const std::string& error_details, ConnectionCloseSource source) override; void OnWriteBlocked() override; void OnSuccessfulVersionNegotiation( @@ -203,7 +203,7 @@ QuicStreamOffset bytes_written); // Called when the session wants to go away and not accept any new streams. - virtual void SendGoAway(QuicErrorCode error_code, const QuicString& reason); + virtual void SendGoAway(QuicErrorCode error_code, const std::string& reason); // Sends a BLOCKED frame. virtual void SendBlocked(QuicStreamId id);
diff --git a/quic/core/quic_session_test.cc b/quic/core/quic_session_test.cc index 928f690..fba914f 100644 --- a/quic/core/quic_session_test.cc +++ b/quic/core/quic_session_test.cc
@@ -65,7 +65,7 @@ encryption_established_ = true; handshake_confirmed_ = true; CryptoHandshakeMessage msg; - QuicString error_details; + std::string error_details; session()->config()->SetInitialStreamFlowControlWindowToSend( kInitialStreamFlowControlWindowForTest); session()->config()->SetInitialSessionFlowControlWindowToSend( @@ -717,7 +717,7 @@ EXPECT_CALL(*connection_, SendControlFrame(_)); EXPECT_CALL(*connection_, OnStreamReset(closed_stream_id, _)); stream2->Reset(QUIC_BAD_APPLICATION_PAYLOAD); - QuicString msg = + std::string msg = QuicStrCat("Marking unknown stream ", closed_stream_id, " blocked."); EXPECT_QUIC_BUG(session_.MarkConnectionLevelWriteBlocked(closed_stream_id), msg); @@ -1218,7 +1218,7 @@ // Create a stream, and send enough data to make it flow control blocked. TestStream* stream2 = session_.CreateOutgoingBidirectionalStream(); - QuicString body(kMinimumFlowControlSendWindow, '.'); + std::string body(kMinimumFlowControlSendWindow, '.'); EXPECT_FALSE(stream2->flow_controller()->IsBlocked()); EXPECT_FALSE(session_.IsConnectionFlowControlBlocked()); EXPECT_FALSE(session_.IsStreamFlowControlBlocked()); @@ -1370,7 +1370,7 @@ // adjusting the connection level flow control receive window to take into // account the total number of bytes sent by the peer. const QuicStreamOffset kByteOffset = 5678; - QuicString body = "hello"; + std::string body = "hello"; QuicStreamFrame frame(stream->id(), true, kByteOffset, QuicStringPiece(body)); session_.OnStreamFrame(frame); @@ -1735,7 +1735,7 @@ session_.set_writev_consumes_all_data(true); TestStream* stream2 = session_.CreateOutgoingBidirectionalStream(); - QuicString body(100, '.'); + std::string body(100, '.'); stream2->WriteOrBufferData(body, false, nullptr); EXPECT_TRUE(stream2->IsWaitingForAcks()); EXPECT_EQ(1u, QuicStreamPeer::SendBuffer(stream2).size()); @@ -2023,7 +2023,7 @@ session_.set_writev_consumes_all_data(true); TestStream* stream2 = session_.CreateOutgoingBidirectionalStream(); - QuicString body(100, '.'); + std::string body(100, '.'); stream2->CloseReadSide(); stream2->WriteOrBufferData(body, true, nullptr); EXPECT_TRUE(stream2->IsWaitingForAcks()); @@ -2074,7 +2074,7 @@ TestStream* stream4 = new TestStream(GetNthServerInitiatedUnidirectionalId(1), &session_, WRITE_UNIDIRECTIONAL); session_.ActivateStream(QuicWrapUnique(stream4)); - QuicString body(100, '.'); + std::string body(100, '.'); stream4->WriteOrBufferData(body, false, nullptr); EXPECT_FALSE(QuicContainsKey(session_.zombie_streams(), stream4->id())); stream4->WriteOrBufferData(body, true, nullptr); @@ -2103,7 +2103,7 @@ // Discard all incoming data. stream4->StopReading(); - QuicString data(100, '.'); + std::string data(100, '.'); QuicStreamFrame stream_frame(GetNthClientInitiatedUnidirectionalId(1), false, 0, data); stream4->OnStreamFrame(stream_frame); @@ -2124,7 +2124,7 @@ CloseConnection( QUIC_TRY_TO_WRITE_DATA_ON_READ_UNIDIRECTIONAL_STREAM, _, _)) .Times(1); - QuicString body(100, '.'); + std::string body(100, '.'); stream4->WriteOrBufferData(body, false, nullptr); } @@ -2137,7 +2137,7 @@ CloseConnection( QUIC_TRY_TO_WRITE_DATA_ON_READ_UNIDIRECTIONAL_STREAM, _, _)) .Times(1); - QuicString body(100, '.'); + std::string body(100, '.'); struct iovec iov = {const_cast<char*>(body.data()), body.length()}; QuicMemSliceStorage storage( &iov, 1, session_.connection()->helper()->GetStreamSendBufferAllocator(),
diff --git a/quic/core/quic_socket_address_coder.cc b/quic/core/quic_socket_address_coder.cc index bb1eaea..1cb8ff7 100644 --- a/quic/core/quic_socket_address_coder.cc +++ b/quic/core/quic_socket_address_coder.cc
@@ -23,8 +23,8 @@ QuicSocketAddressCoder::~QuicSocketAddressCoder() {} -QuicString QuicSocketAddressCoder::Encode() const { - QuicString serialized; +std::string QuicSocketAddressCoder::Encode() const { + std::string serialized; uint16_t address_family; switch (address_.host().address_family()) { case IpAddressFamily::IP_V4:
diff --git a/quic/core/quic_socket_address_coder.h b/quic/core/quic_socket_address_coder.h index 6ac5d49..e02fc6e 100644 --- a/quic/core/quic_socket_address_coder.h +++ b/quic/core/quic_socket_address_coder.h
@@ -25,7 +25,7 @@ QuicSocketAddressCoder& operator=(const QuicSocketAddressCoder&) = delete; ~QuicSocketAddressCoder(); - QuicString Encode() const; + std::string Encode() const; bool Decode(const char* data, size_t length);
diff --git a/quic/core/quic_socket_address_coder_test.cc b/quic/core/quic_socket_address_coder_test.cc index eb65efa..b4a51dd 100644 --- a/quic/core/quic_socket_address_coder_test.cc +++ b/quic/core/quic_socket_address_coder_test.cc
@@ -17,8 +17,8 @@ QuicIpAddress ip; ip.FromString("4.31.198.44"); QuicSocketAddressCoder coder(QuicSocketAddress(ip, 0x1234)); - QuicString serialized = coder.Encode(); - QuicString expected("\x02\x00\x04\x1f\xc6\x2c\x34\x12", 8); + std::string serialized = coder.Encode(); + std::string expected("\x02\x00\x04\x1f\xc6\x2c\x34\x12", 8); EXPECT_EQ(expected, serialized); } @@ -26,8 +26,8 @@ QuicIpAddress ip; ip.FromString("2001:700:300:1800::f"); QuicSocketAddressCoder coder(QuicSocketAddress(ip, 0x5678)); - QuicString serialized = coder.Encode(); - QuicString expected( + std::string serialized = coder.Encode(); + std::string expected( "\x0a\x00" "\x20\x01\x07\x00\x03\x00\x18\x00" "\x00\x00\x00\x00\x00\x00\x00\x0f" @@ -37,17 +37,17 @@ } TEST_F(QuicSocketAddressCoderTest, DecodeIPv4) { - QuicString serialized("\x02\x00\x04\x1f\xc6\x2c\x34\x12", 8); + std::string serialized("\x02\x00\x04\x1f\xc6\x2c\x34\x12", 8); QuicSocketAddressCoder coder; ASSERT_TRUE(coder.Decode(serialized.data(), serialized.length())); EXPECT_EQ(IpAddressFamily::IP_V4, coder.ip().address_family()); - QuicString expected_addr("\x04\x1f\xc6\x2c"); + std::string expected_addr("\x04\x1f\xc6\x2c"); EXPECT_EQ(expected_addr, coder.ip().ToPackedString()); EXPECT_EQ(0x1234, coder.port()); } TEST_F(QuicSocketAddressCoderTest, DecodeIPv6) { - QuicString serialized( + std::string serialized( "\x0a\x00" "\x20\x01\x07\x00\x03\x00\x18\x00" "\x00\x00\x00\x00\x00\x00\x00\x0f" @@ -56,7 +56,7 @@ QuicSocketAddressCoder coder; ASSERT_TRUE(coder.Decode(serialized.data(), serialized.length())); EXPECT_EQ(IpAddressFamily::IP_V6, coder.ip().address_family()); - QuicString expected_addr( + std::string expected_addr( "\x20\x01\x07\x00\x03\x00\x18\x00" "\x00\x00\x00\x00\x00\x00\x00\x0f", 16); @@ -65,7 +65,7 @@ } TEST_F(QuicSocketAddressCoderTest, DecodeBad) { - QuicString serialized( + std::string serialized( "\x0a\x00" "\x20\x01\x07\x00\x03\x00\x18\x00" "\x00\x00\x00\x00\x00\x00\x00\x0f" @@ -114,7 +114,7 @@ QuicIpAddress ip; ASSERT_TRUE(ip.FromString(test_case[i].ip_literal)); QuicSocketAddressCoder encoder(QuicSocketAddress(ip, test_case[i].port)); - QuicString serialized = encoder.Encode(); + std::string serialized = encoder.Encode(); QuicSocketAddressCoder decoder; ASSERT_TRUE(decoder.Decode(serialized.data(), serialized.length()));
diff --git a/quic/core/quic_stream.cc b/quic/core/quic_stream.cc index 86207b6..91dace4 100644 --- a/quic/core/quic_stream.cc +++ b/quic/core/quic_stream.cc
@@ -76,7 +76,7 @@ } void PendingStream::CloseConnectionWithDetails(QuicErrorCode error, - const QuicString& details) { + const std::string& details) { session_->connection()->CloseConnection( error, details, ConnectionCloseBehavior::SEND_CONNECTION_CLOSE_PACKET); } @@ -402,7 +402,7 @@ } void QuicStream::CloseConnectionWithDetails(QuicErrorCode error, - const QuicString& details) { + const std::string& details) { session()->connection()->CloseConnection( error, details, ConnectionCloseBehavior::SEND_CONNECTION_CLOSE_PACKET); }
diff --git a/quic/core/quic_stream.h b/quic/core/quic_stream.h index fe0a794..21d57b5 100644 --- a/quic/core/quic_stream.h +++ b/quic/core/quic_stream.h
@@ -59,7 +59,7 @@ void AddBytesConsumed(QuicByteCount bytes) override; void Reset(QuicRstStreamErrorCode error) override; void CloseConnectionWithDetails(QuicErrorCode error, - const QuicString& details) override; + const std::string& details) override; QuicStreamId id() const override; const QuicSocketAddress& PeerAddressOfLatestPacket() const override; @@ -144,7 +144,7 @@ // Called by the subclass or the sequencer to close the entire connection from // this end. void CloseConnectionWithDetails(QuicErrorCode error, - const QuicString& details) override; + const std::string& details) override; // Called by the stream sequencer as bytes are consumed from the buffer. // If the receive window has dropped below the threshold, then send a
diff --git a/quic/core/quic_stream_id_manager.h b/quic/core/quic_stream_id_manager.h index 95951c0..11f8968 100644 --- a/quic/core/quic_stream_id_manager.h +++ b/quic/core/quic_stream_id_manager.h
@@ -44,7 +44,7 @@ // Generate a string suitable for sending to the log/etc to show current state // of the stream ID manager. - QuicString DebugString() const { + std::string DebugString() const { return QuicStrCat( " { max_allowed_outgoing_stream_id: ", max_allowed_outgoing_stream_id_, ", actual_max_allowed_incoming_stream_id_: ",
diff --git a/quic/core/quic_stream_id_manager_test.cc b/quic/core/quic_stream_id_manager_test.cc index 51799e2..2958c89 100644 --- a/quic/core/quic_stream_id_manager_test.cc +++ b/quic/core/quic_stream_id_manager_test.cc
@@ -329,7 +329,7 @@ QuicStreamId stream_id = stream_id_manager_->actual_max_allowed_incoming_stream_id() + kV99StreamIdIncrement; - QuicString error_details = + std::string error_details = GetParam() ? "Stream id 401 above 397" : "Stream id 403 above 399"; EXPECT_CALL(*connection_, CloseConnection(QUIC_INVALID_STREAM_ID, error_details, _)); @@ -603,7 +603,7 @@ // jump is not allowed; make sure. first_dynamic += kV99StreamIdIncrement * 100; expected_max_incoming += kV99StreamIdIncrement * 100; - QuicString bug_detail = + std::string bug_detail = GetParam() ? "allocate 5 got 401" : "allocate 7 got 403"; EXPECT_QUIC_BUG( stream_id_manager_->RegisterStaticStream(first_dynamic), @@ -830,7 +830,7 @@ stream_id_manager_->actual_max_allowed_incoming_stream_id() + kV99StreamIdIncrement * 20; - QuicString error_details = + std::string error_details = GetParam() ? "Stream id 480 above 400" : "Stream id 478 above 398"; EXPECT_CALL(*connection_, CloseConnection(QUIC_INVALID_STREAM_ID, error_details, _));
diff --git a/quic/core/quic_stream_send_buffer_test.cc b/quic/core/quic_stream_send_buffer_test.cc index a58f872..7670152 100644 --- a/quic/core/quic_stream_send_buffer_test.cc +++ b/quic/core/quic_stream_send_buffer_test.cc
@@ -30,8 +30,8 @@ EXPECT_EQ(0u, send_buffer_.size()); EXPECT_EQ(0u, send_buffer_.stream_bytes_written()); EXPECT_EQ(0u, send_buffer_.stream_bytes_outstanding()); - QuicString data1(1536, 'a'); - QuicString data2 = QuicString(256, 'b') + QuicString(256, 'c'); + std::string data1(1536, 'a'); + std::string data2 = std::string(256, 'b') + std::string(256, 'c'); struct iovec iov[2]; iov[0] = MakeIovec(QuicStringPiece(data1)); iov[1] = MakeIovec(QuicStringPiece(data2)); @@ -77,11 +77,11 @@ TEST_F(QuicStreamSendBufferTest, CopyDataToBuffer) { char buf[4000]; QuicDataWriter writer(4000, buf, HOST_BYTE_ORDER); - QuicString copy1(1024, 'a'); - QuicString copy2 = - QuicString(512, 'a') + QuicString(256, 'b') + QuicString(256, 'c'); - QuicString copy3(1024, 'c'); - QuicString copy4(768, 'd'); + std::string copy1(1024, 'a'); + std::string copy2 = + std::string(512, 'a') + std::string(256, 'b') + std::string(256, 'c'); + std::string copy3(1024, 'c'); + std::string copy4(768, 'd'); ASSERT_TRUE(send_buffer_.WriteStreamData(0, 1024, &writer)); EXPECT_EQ(copy1, QuicStringPiece(buf, 1024)); @@ -94,12 +94,12 @@ // Test data piece across boundries. QuicDataWriter writer2(4000, buf, HOST_BYTE_ORDER); - QuicString copy5 = - QuicString(536, 'a') + QuicString(256, 'b') + QuicString(232, 'c'); + std::string copy5 = + std::string(536, 'a') + std::string(256, 'b') + std::string(232, 'c'); ASSERT_TRUE(send_buffer_.WriteStreamData(1000, 1024, &writer2)); EXPECT_EQ(copy5, QuicStringPiece(buf, 1024)); ASSERT_TRUE(send_buffer_.WriteStreamData(2500, 1024, &writer2)); - QuicString copy6 = QuicString(572, 'c') + QuicString(452, 'd'); + std::string copy6 = std::string(572, 'c') + std::string(452, 'd'); EXPECT_EQ(copy6, QuicStringPiece(buf + 1024, 1024)); // Invalid data copy.
diff --git a/quic/core/quic_stream_sequencer.cc b/quic/core/quic_stream_sequencer.cc index 6311dcf..47c7c9f 100644 --- a/quic/core/quic_stream_sequencer.cc +++ b/quic/core/quic_stream_sequencer.cc
@@ -60,12 +60,12 @@ const char* data_buffer) { const size_t previous_readable_bytes = buffered_frames_.ReadableBytes(); size_t bytes_written; - QuicString error_details; + std::string error_details; QuicErrorCode result = buffered_frames_.OnStreamData( byte_offset, QuicStringPiece(data_buffer, data_len), &bytes_written, &error_details); if (result != QUIC_NO_ERROR) { - QuicString details = QuicStrCat( + std::string details = QuicStrCat( "Stream ", stream_->id(), ": ", QuicErrorCodeToString(result), ": ", error_details, "\nPeer Address: ", stream_->PeerAddressOfLatestPacket().ToString()); @@ -161,7 +161,7 @@ return buffered_frames_.PrefetchNextRegion(iov); } -void QuicStreamSequencer::Read(QuicString* buffer) { +void QuicStreamSequencer::Read(std::string* buffer) { DCHECK(!blocked_); buffer->resize(buffer->size() + ReadableBytes()); iovec iov; @@ -172,12 +172,12 @@ int QuicStreamSequencer::Readv(const struct iovec* iov, size_t iov_len) { DCHECK(!blocked_); - QuicString error_details; + std::string error_details; size_t bytes_read; QuicErrorCode read_error = buffered_frames_.Readv(iov, iov_len, &bytes_read, &error_details); if (read_error != QUIC_NO_ERROR) { - QuicString details = + std::string details = QuicStrCat("Stream ", stream_->id(), ": ", error_details); stream_->CloseConnectionWithDetails(read_error, details); return static_cast<int>(bytes_read); @@ -259,7 +259,7 @@ return buffered_frames_.BytesConsumed(); } -const QuicString QuicStreamSequencer::DebugString() const { +const std::string QuicStreamSequencer::DebugString() const { // clang-format off return QuicStrCat("QuicStreamSequencer:", "\n bytes buffered: ", NumBytesBuffered(),
diff --git a/quic/core/quic_stream_sequencer.h b/quic/core/quic_stream_sequencer.h index 3feee5e..120b997 100644 --- a/quic/core/quic_stream_sequencer.h +++ b/quic/core/quic_stream_sequencer.h
@@ -43,7 +43,7 @@ // Called when an error has occurred which should result in the connection // being closed. virtual void CloseConnectionWithDetails(QuicErrorCode error, - const QuicString& details) = 0; + const std::string& details) = 0; // Returns the stream id of this stream. virtual QuicStreamId id() const = 0; @@ -98,7 +98,7 @@ // Appends all of the readable data to |buffer| and marks all of the appended // data as consumed. - void Read(QuicString* buffer); + void Read(std::string* buffer); // Returns true if the sequncer has bytes available for reading. bool HasBytesToRead() const; @@ -153,7 +153,7 @@ void set_stream(StreamInterface* stream) { stream_ = stream; } // Returns string describing internal state. - const QuicString DebugString() const; + const std::string DebugString() const; private: friend class test::QuicStreamSequencerPeer;
diff --git a/quic/core/quic_stream_sequencer_buffer.cc b/quic/core/quic_stream_sequencer_buffer.cc index 485c9dc..75000bd 100644 --- a/quic/core/quic_stream_sequencer_buffer.cc +++ b/quic/core/quic_stream_sequencer_buffer.cc
@@ -71,7 +71,7 @@ QuicStreamOffset starting_offset, QuicStringPiece data, size_t* const bytes_buffered, - QuicString* error_details) { + std::string* error_details) { *bytes_buffered = 0; size_t size = data.size(); if (size == 0) { @@ -158,7 +158,7 @@ bool QuicStreamSequencerBuffer::CopyStreamData(QuicStreamOffset offset, QuicStringPiece data, size_t* bytes_copy, - QuicString* error_details) { + std::string* error_details) { *bytes_copy = 0; size_t source_remaining = data.size(); if (source_remaining == 0) { @@ -236,7 +236,7 @@ QuicErrorCode QuicStreamSequencerBuffer::Readv(const iovec* dest_iov, size_t dest_count, size_t* bytes_read, - QuicString* error_details) { + std::string* error_details) { *bytes_read = 0; for (size_t i = 0; i < dest_count && ReadableBytes() > 0; ++i) { char* dest = reinterpret_cast<char*>(dest_iov[i].iov_base); @@ -500,12 +500,12 @@ } } -QuicString QuicStreamSequencerBuffer::GapsDebugString() { +std::string QuicStreamSequencerBuffer::GapsDebugString() { // TODO(vasilvv): this should return the complement of |bytes_received_|. return bytes_received_.ToString(); } -QuicString QuicStreamSequencerBuffer::ReceivedFramesDebugString() { +std::string QuicStreamSequencerBuffer::ReceivedFramesDebugString() { return bytes_received_.ToString(); }
diff --git a/quic/core/quic_stream_sequencer_buffer.h b/quic/core/quic_stream_sequencer_buffer.h index 7e547a9..683294e 100644 --- a/quic/core/quic_stream_sequencer_buffer.h +++ b/quic/core/quic_stream_sequencer_buffer.h
@@ -27,11 +27,11 @@ // // Expected Use: // QuicStreamSequencerBuffer buffer(2.5 * 8 * 1024); -// QuicString source(1024, 'a'); +// std::string source(1024, 'a'); // QuicStringPiece string_piece(source.data(), source.size()); // size_t written = 0; // buffer.OnStreamData(800, string_piece, GetEpollClockNow(), &written); -// source = QuicString{800, 'b'}; +// source = std::string{800, 'b'}; // QuicStringPiece string_piece1(source.data(), 800); // // Try to write to [1, 801), but should fail due to overlapping, // // res should be QUIC_INVALID_STREAM_DATA @@ -109,14 +109,14 @@ QuicErrorCode OnStreamData(QuicStreamOffset offset, QuicStringPiece data, size_t* bytes_buffered, - QuicString* error_details); + std::string* error_details); // Reads from this buffer into given iovec array, up to number of iov_len // iovec objects and returns the number of bytes read. QuicErrorCode Readv(const struct iovec* dest_iov, size_t dest_count, size_t* bytes_read, - QuicString* error_details); + std::string* error_details); // Returns the readable region of valid data in iovec format. The readable // region is the buffer region where there is valid data not yet read by @@ -173,7 +173,7 @@ bool CopyStreamData(QuicStreamOffset offset, QuicStringPiece data, size_t* bytes_copy, - QuicString* error_details); + std::string* error_details); // Dispose the given buffer block. // After calling this method, blocks_[index] is set to nullptr @@ -213,10 +213,10 @@ QuicStreamOffset NextExpectedByte() const; // Return |gaps_| as a string: [1024, 1500) [1800, 2048)... for debugging. - QuicString GapsDebugString(); + std::string GapsDebugString(); // Return all received frames as a string in same format as GapsDebugString(); - QuicString ReceivedFramesDebugString(); + std::string ReceivedFramesDebugString(); // The maximum total capacity of this buffer in byte, as constructed. const size_t max_buffer_capacity_bytes_;
diff --git a/quic/core/quic_stream_sequencer_buffer_test.cc b/quic/core/quic_stream_sequencer_buffer_test.cc index 7d5947c..d74bc9b 100644 --- a/quic/core/quic_stream_sequencer_buffer_test.cc +++ b/quic/core/quic_stream_sequencer_buffer_test.cc
@@ -74,7 +74,7 @@ std::unique_ptr<QuicStreamSequencerBuffer> buffer_; std::unique_ptr<QuicStreamSequencerBufferPeer> helper_; - QuicString error_details_; + std::string error_details_; }; TEST_F(QuicStreamSequencerBufferTest, InitializeWithMaxRecvWindowSize) { @@ -112,7 +112,7 @@ TEST_F(QuicStreamSequencerBufferTest, OnStreamDataWithinBlock) { EXPECT_FALSE(helper_->IsBufferAllocated()); - QuicString source(1024, 'a'); + std::string source(1024, 'a'); size_t written; EXPECT_EQ(QUIC_NO_ERROR, buffer_->OnStreamData(800, source, &written, &error_details_)); @@ -131,7 +131,7 @@ TEST_F(QuicStreamSequencerBufferTest, Move) { EXPECT_FALSE(helper_->IsBufferAllocated()); - QuicString source(1024, 'a'); + std::string source(1024, 'a'); size_t written; EXPECT_EQ(QUIC_NO_ERROR, buffer_->OnStreamData(800, source, &written, &error_details_)); @@ -168,7 +168,7 @@ } TEST_F(QuicStreamSequencerBufferTest, OnStreamDataWithOverlap) { - QuicString source(1024, 'a'); + std::string source(1024, 'a'); // Write something into [800, 1824) size_t written; EXPECT_EQ(QUIC_NO_ERROR, @@ -182,12 +182,12 @@ TEST_F(QuicStreamSequencerBufferTest, OnStreamDataOverlapAndDuplicateCornerCases) { - QuicString source(1024, 'a'); + std::string source(1024, 'a'); // Write something into [800, 1824) size_t written; buffer_->OnStreamData(800, source, &written, &error_details_); - source = QuicString(800, 'b'); - QuicString one_byte = "c"; + source = std::string(800, 'b'); + std::string one_byte = "c"; // Write [1, 801). EXPECT_EQ(QUIC_NO_ERROR, buffer_->OnStreamData(1, source, &written, &error_details_)); @@ -205,12 +205,12 @@ } TEST_F(QuicStreamSequencerBufferTest, OnStreamDataWithoutOverlap) { - QuicString source(1024, 'a'); + std::string source(1024, 'a'); // Write something into [800, 1824). size_t written; EXPECT_EQ(QUIC_NO_ERROR, buffer_->OnStreamData(800, source, &written, &error_details_)); - source = QuicString(100, 'b'); + source = std::string(100, 'b'); // Write something into [kBlockSizeBytes * 2 - 20, kBlockSizeBytes * 2 + 80). EXPECT_EQ(QUIC_NO_ERROR, buffer_->OnStreamData(kBlockSizeBytes * 2 - 20, source, &written, @@ -228,7 +228,7 @@ // Three new out of order frames arrive. const size_t kBytesToWrite = 100; - QuicString source(kBytesToWrite, 'a'); + std::string source(kBytesToWrite, 'a'); size_t written; // Frame [2^32 + 500, 2^32 + 600). QuicStreamOffset offset = pow(2, 32) + 500; @@ -252,7 +252,7 @@ TEST_F(QuicStreamSequencerBufferTest, OnStreamDataTillEnd) { // Write 50 bytes to the end. const size_t kBytesToWrite = 50; - QuicString source(kBytesToWrite, 'a'); + std::string source(kBytesToWrite, 'a'); size_t written; EXPECT_EQ(QUIC_NO_ERROR, buffer_->OnStreamData(max_capacity_bytes_ - kBytesToWrite, source, @@ -264,7 +264,7 @@ TEST_F(QuicStreamSequencerBufferTest, OnStreamDataTillEndCorner) { // Write 1 byte to the end. const size_t kBytesToWrite = 1; - QuicString source(kBytesToWrite, 'a'); + std::string source(kBytesToWrite, 'a'); size_t written; EXPECT_EQ(QUIC_NO_ERROR, buffer_->OnStreamData(max_capacity_bytes_ - kBytesToWrite, source, @@ -274,7 +274,7 @@ } TEST_F(QuicStreamSequencerBufferTest, OnStreamDataBeyondCapacity) { - QuicString source(60, 'a'); + std::string source(60, 'a'); size_t written; EXPECT_EQ(QUIC_INTERNAL_ERROR, buffer_->OnStreamData(max_capacity_bytes_ - 50, source, &written, @@ -308,12 +308,12 @@ } TEST_F(QuicStreamSequencerBufferTest, Readv100Bytes) { - QuicString source(1024, 'a'); + std::string source(1024, 'a'); // Write something into [kBlockSizeBytes, kBlockSizeBytes + 1024). size_t written; buffer_->OnStreamData(kBlockSizeBytes, source, &written, &error_details_); EXPECT_FALSE(buffer_->HasBytesToRead()); - source = QuicString(100, 'b'); + source = std::string(100, 'b'); // Write something into [0, 100). buffer_->OnStreamData(0, source, &written, &error_details_); EXPECT_TRUE(buffer_->HasBytesToRead()); @@ -325,14 +325,14 @@ QUIC_LOG(ERROR) << error_details_; EXPECT_EQ(100u, read); EXPECT_EQ(100u, buffer_->BytesConsumed()); - EXPECT_EQ(source, QuicString(dest, read)); + EXPECT_EQ(source, std::string(dest, read)); // The first block should be released as its data has been read out. EXPECT_EQ(nullptr, helper_->GetBlock(0)); EXPECT_TRUE(helper_->CheckBufferInvariants()); } TEST_F(QuicStreamSequencerBufferTest, ReadvAcrossBlocks) { - QuicString source(kBlockSizeBytes + 50, 'a'); + std::string source(kBlockSizeBytes + 50, 'a'); // Write 1st block to full and extand 50 bytes to next block. size_t written; buffer_->OnStreamData(0, source, &written, &error_details_); @@ -346,7 +346,7 @@ EXPECT_EQ(QUIC_NO_ERROR, buffer_->Readv(iovecs, 2, &read, &error_details_)); } // The last read only reads the rest 50 bytes in 2nd block. - EXPECT_EQ(QuicString(50, 'a'), QuicString(dest, 50)); + EXPECT_EQ(std::string(50, 'a'), std::string(dest, 50)); EXPECT_EQ(0, dest[50]) << "Dest[50] shouln't be filled."; EXPECT_EQ(source.size(), buffer_->BytesConsumed()); EXPECT_TRUE(buffer_->Empty()); @@ -354,7 +354,7 @@ } TEST_F(QuicStreamSequencerBufferTest, ClearAfterRead) { - QuicString source(kBlockSizeBytes + 50, 'a'); + std::string source(kBlockSizeBytes + 50, 'a'); // Write 1st block to full with 'a'. size_t written; buffer_->OnStreamData(0, source, &written, &error_details_); @@ -371,7 +371,7 @@ TEST_F(QuicStreamSequencerBufferTest, OnStreamDataAcrossLastBlockAndFillCapacity) { - QuicString source(kBlockSizeBytes + 50, 'a'); + std::string source(kBlockSizeBytes + 50, 'a'); // Write 1st block to full with 'a'. size_t written; buffer_->OnStreamData(0, source, &written, &error_details_); @@ -384,7 +384,7 @@ // Write more than half block size of bytes in the last block with 'b', which // will wrap to the beginning and reaches the full capacity. - source = QuicString(0.5 * kBlockSizeBytes + 512, 'b'); + source = std::string(0.5 * kBlockSizeBytes + 512, 'b'); EXPECT_EQ(QUIC_NO_ERROR, buffer_->OnStreamData(2 * kBlockSizeBytes, source, &written, &error_details_)); EXPECT_EQ(source.size(), written); @@ -393,7 +393,7 @@ TEST_F(QuicStreamSequencerBufferTest, OnStreamDataAcrossLastBlockAndExceedCapacity) { - QuicString source(kBlockSizeBytes + 50, 'a'); + std::string source(kBlockSizeBytes + 50, 'a'); // Write 1st block to full. size_t written; buffer_->OnStreamData(0, source, &written, &error_details_); @@ -405,7 +405,7 @@ // Try to write from [max_capacity_bytes_ - 0.5 * kBlockSizeBytes, // max_capacity_bytes_ + 512 + 1). But last bytes exceeds current capacity. - source = QuicString(0.5 * kBlockSizeBytes + 512 + 1, 'b'); + source = std::string(0.5 * kBlockSizeBytes + 512 + 1, 'b'); EXPECT_EQ(QUIC_INTERNAL_ERROR, buffer_->OnStreamData(2 * kBlockSizeBytes, source, &written, &error_details_)); @@ -415,14 +415,14 @@ TEST_F(QuicStreamSequencerBufferTest, ReadvAcrossLastBlock) { // Write to full capacity and read out 512 bytes at beginning and continue // appending 256 bytes. - QuicString source(max_capacity_bytes_, 'a'); + std::string source(max_capacity_bytes_, 'a'); size_t written; buffer_->OnStreamData(0, source, &written, &error_details_); char dest[512]{0}; const iovec iov{dest, 512}; size_t read; EXPECT_EQ(QUIC_NO_ERROR, buffer_->Readv(&iov, 1, &read, &error_details_)); - source = QuicString(256, 'b'); + source = std::string(256, 'b'); buffer_->OnStreamData(max_capacity_bytes_, source, &written, &error_details_); EXPECT_TRUE(helper_->CheckBufferInvariants()); @@ -456,7 +456,7 @@ TEST_F(QuicStreamSequencerBufferTest, ReleaseWholeBuffer) { // Tests that buffer is not deallocated unless ReleaseWholeBuffer() is called. - QuicString source(100, 'b'); + std::string source(100, 'b'); // Write something into [0, 100). size_t written; buffer_->OnStreamData(0, source, &written, &error_details_); @@ -475,7 +475,7 @@ TEST_F(QuicStreamSequencerBufferTest, GetReadableRegionsBlockedByGap) { // Write into [1, 1024). - QuicString source(1023, 'a'); + std::string source(1023, 'a'); size_t written; buffer_->OnStreamData(1, source, &written, &error_details_); // Try to get readable regions, but none is there. @@ -487,7 +487,7 @@ TEST_F(QuicStreamSequencerBufferTest, GetReadableRegionsTillEndOfBlock) { // Write first block to full with [0, 256) 'a' and the rest 'b' then read out // [0, 256) - QuicString source(kBlockSizeBytes, 'a'); + std::string source(kBlockSizeBytes, 'a'); size_t written; buffer_->OnStreamData(0, source, &written, &error_details_); char dest[256]; @@ -496,14 +496,14 @@ iovec iovs[2]; int iov_count = buffer_->GetReadableRegions(iovs, 2); EXPECT_EQ(1, iov_count); - EXPECT_EQ(QuicString(kBlockSizeBytes - 256, 'a'), - QuicString(reinterpret_cast<const char*>(iovs[0].iov_base), - iovs[0].iov_len)); + EXPECT_EQ(std::string(kBlockSizeBytes - 256, 'a'), + std::string(reinterpret_cast<const char*>(iovs[0].iov_base), + iovs[0].iov_len)); } TEST_F(QuicStreamSequencerBufferTest, GetReadableRegionsWithinOneBlock) { // Write into [0, 1024) and then read out [0, 256) - QuicString source(1024, 'a'); + std::string source(1024, 'a'); size_t written; buffer_->OnStreamData(0, source, &written, &error_details_); char dest[256]; @@ -512,15 +512,15 @@ iovec iovs[2]; int iov_count = buffer_->GetReadableRegions(iovs, 2); EXPECT_EQ(1, iov_count); - EXPECT_EQ(QuicString(1024 - 256, 'a'), - QuicString(reinterpret_cast<const char*>(iovs[0].iov_base), - iovs[0].iov_len)); + EXPECT_EQ(std::string(1024 - 256, 'a'), + std::string(reinterpret_cast<const char*>(iovs[0].iov_base), + iovs[0].iov_len)); } TEST_F(QuicStreamSequencerBufferTest, GetReadableRegionsAcrossBlockWithLongIOV) { // Write into [0, 2 * kBlockSizeBytes + 1024) and then read out [0, 1024) - QuicString source(2 * kBlockSizeBytes + 1024, 'a'); + std::string source(2 * kBlockSizeBytes + 1024, 'a'); size_t written; buffer_->OnStreamData(0, source, &written, &error_details_); char dest[1024]; @@ -538,13 +538,13 @@ GetReadableRegionsWithMultipleIOVsAcrossEnd) { // Write into [0, 2 * kBlockSizeBytes + 1024) and then read out [0, 1024) // and then append 1024 + 512 bytes. - QuicString source(2.5 * kBlockSizeBytes - 1024, 'a'); + std::string source(2.5 * kBlockSizeBytes - 1024, 'a'); size_t written; buffer_->OnStreamData(0, source, &written, &error_details_); char dest[1024]; helper_->Read(dest, 1024); // Write across the end. - source = QuicString(1024 + 512, 'b'); + source = std::string(1024 + 512, 'b'); buffer_->OnStreamData(2.5 * kBlockSizeBytes - 1024, source, &written, &error_details_); // Use short iovec's. @@ -558,9 +558,9 @@ EXPECT_EQ(4, buffer_->GetReadableRegions(iovs1, 5)); EXPECT_EQ(0.5 * kBlockSizeBytes, iovs1[2].iov_len); EXPECT_EQ(512u, iovs1[3].iov_len); - EXPECT_EQ(QuicString(512, 'b'), - QuicString(reinterpret_cast<const char*>(iovs1[3].iov_base), - iovs1[3].iov_len)); + EXPECT_EQ(std::string(512, 'b'), + std::string(reinterpret_cast<const char*>(iovs1[3].iov_base), + iovs1[3].iov_len)); } TEST_F(QuicStreamSequencerBufferTest, GetReadableRegionEmpty) { @@ -572,7 +572,7 @@ TEST_F(QuicStreamSequencerBufferTest, GetReadableRegionBeforeGap) { // Write into [1, 1024). - QuicString source(1023, 'a'); + std::string source(1023, 'a'); size_t written; buffer_->OnStreamData(1, source, &written, &error_details_); // GetReadableRegion should return false because range [0,1) hasn't been @@ -583,7 +583,7 @@ TEST_F(QuicStreamSequencerBufferTest, GetReadableRegionTillEndOfBlock) { // Write into [0, kBlockSizeBytes + 1) and then read out [0, 256) - QuicString source(kBlockSizeBytes + 1, 'a'); + std::string source(kBlockSizeBytes + 1, 'a'); size_t written; buffer_->OnStreamData(0, source, &written, &error_details_); char dest[256]; @@ -592,13 +592,13 @@ iovec iov; EXPECT_TRUE(buffer_->GetReadableRegion(&iov)); EXPECT_EQ( - QuicString(kBlockSizeBytes - 256, 'a'), - QuicString(reinterpret_cast<const char*>(iov.iov_base), iov.iov_len)); + std::string(kBlockSizeBytes - 256, 'a'), + std::string(reinterpret_cast<const char*>(iov.iov_base), iov.iov_len)); } TEST_F(QuicStreamSequencerBufferTest, GetReadableRegionTillGap) { // Write into [0, kBlockSizeBytes - 1) and then read out [0, 256) - QuicString source(kBlockSizeBytes - 1, 'a'); + std::string source(kBlockSizeBytes - 1, 'a'); size_t written; buffer_->OnStreamData(0, source, &written, &error_details_); char dest[256]; @@ -607,8 +607,8 @@ iovec iov; EXPECT_TRUE(buffer_->GetReadableRegion(&iov)); EXPECT_EQ( - QuicString(kBlockSizeBytes - 1 - 256, 'a'), - QuicString(reinterpret_cast<const char*>(iov.iov_base), iov.iov_len)); + std::string(kBlockSizeBytes - 1 - 256, 'a'), + std::string(reinterpret_cast<const char*>(iov.iov_base), iov.iov_len)); } TEST_F(QuicStreamSequencerBufferTest, PrefetchEmptyBuffer) { @@ -617,89 +617,89 @@ } TEST_F(QuicStreamSequencerBufferTest, PrefetchInitialBuffer) { - QuicString source(kBlockSizeBytes, 'a'); + std::string source(kBlockSizeBytes, 'a'); size_t written; buffer_->OnStreamData(0, source, &written, &error_details_); iovec iov; EXPECT_TRUE(buffer_->PrefetchNextRegion(&iov)); - EXPECT_EQ(source, QuicString(reinterpret_cast<const char*>(iov.iov_base), - iov.iov_len)); + EXPECT_EQ(source, std::string(reinterpret_cast<const char*>(iov.iov_base), + iov.iov_len)); } TEST_F(QuicStreamSequencerBufferTest, PrefetchBufferWithOffset) { - QuicString source(1024, 'a'); + std::string source(1024, 'a'); size_t written; buffer_->OnStreamData(0, source, &written, &error_details_); iovec iov; EXPECT_TRUE(buffer_->PrefetchNextRegion(&iov)); - EXPECT_EQ(source, QuicString(reinterpret_cast<const char*>(iov.iov_base), - iov.iov_len)); + EXPECT_EQ(source, std::string(reinterpret_cast<const char*>(iov.iov_base), + iov.iov_len)); // The second frame goes into the same bucket. - QuicString source2(800, 'a'); + std::string source2(800, 'a'); buffer_->OnStreamData(1024, source2, &written, &error_details_); EXPECT_TRUE(buffer_->PrefetchNextRegion(&iov)); - EXPECT_EQ(source2, QuicString(reinterpret_cast<const char*>(iov.iov_base), - iov.iov_len)); + EXPECT_EQ(source2, std::string(reinterpret_cast<const char*>(iov.iov_base), + iov.iov_len)); } TEST_F(QuicStreamSequencerBufferTest, PrefetchBufferWithMultipleBucket) { const size_t data_size = 1024; - QuicString source(data_size, 'a'); + std::string source(data_size, 'a'); size_t written; buffer_->OnStreamData(0, source, &written, &error_details_); iovec iov; EXPECT_TRUE(buffer_->PrefetchNextRegion(&iov)); - EXPECT_EQ(source, QuicString(reinterpret_cast<const char*>(iov.iov_base), - iov.iov_len)); - QuicString source2(kBlockSizeBytes, 'b'); + EXPECT_EQ(source, std::string(reinterpret_cast<const char*>(iov.iov_base), + iov.iov_len)); + std::string source2(kBlockSizeBytes, 'b'); buffer_->OnStreamData(data_size, source2, &written, &error_details_); EXPECT_TRUE(buffer_->PrefetchNextRegion(&iov)); EXPECT_EQ( - QuicString(kBlockSizeBytes - data_size, 'b'), - QuicString(reinterpret_cast<const char*>(iov.iov_base), iov.iov_len)); + std::string(kBlockSizeBytes - data_size, 'b'), + std::string(reinterpret_cast<const char*>(iov.iov_base), iov.iov_len)); EXPECT_TRUE(buffer_->PrefetchNextRegion(&iov)); EXPECT_EQ( - QuicString(data_size, 'b'), - QuicString(reinterpret_cast<const char*>(iov.iov_base), iov.iov_len)); + std::string(data_size, 'b'), + std::string(reinterpret_cast<const char*>(iov.iov_base), iov.iov_len)); } TEST_F(QuicStreamSequencerBufferTest, PrefetchBufferAfterBlockRetired) { - QuicString source(kBlockSizeBytes, 'a'); + std::string source(kBlockSizeBytes, 'a'); size_t written; buffer_->OnStreamData(0, source, &written, &error_details_); iovec iov; EXPECT_TRUE(buffer_->PrefetchNextRegion(&iov)); - EXPECT_EQ(source, QuicString(reinterpret_cast<const char*>(iov.iov_base), - iov.iov_len)); + EXPECT_EQ(source, std::string(reinterpret_cast<const char*>(iov.iov_base), + iov.iov_len)); // Read the whole block so it's retired. char dest[kBlockSizeBytes]; helper_->Read(dest, kBlockSizeBytes); - QuicString source2(300, 'b'); + std::string source2(300, 'b'); buffer_->OnStreamData(kBlockSizeBytes, source2, &written, &error_details_); EXPECT_TRUE(buffer_->PrefetchNextRegion(&iov)); - EXPECT_EQ(source2, QuicString(reinterpret_cast<const char*>(iov.iov_base), - iov.iov_len)); + EXPECT_EQ(source2, std::string(reinterpret_cast<const char*>(iov.iov_base), + iov.iov_len)); } TEST_F(QuicStreamSequencerBufferTest, PrefetchContinously) { - QuicString source(kBlockSizeBytes, 'a'); + std::string source(kBlockSizeBytes, 'a'); size_t written; buffer_->OnStreamData(0, source, &written, &error_details_); iovec iov; EXPECT_TRUE(buffer_->PrefetchNextRegion(&iov)); - EXPECT_EQ(source, QuicString(reinterpret_cast<const char*>(iov.iov_base), - iov.iov_len)); - QuicString source2(kBlockSizeBytes, 'b'); + EXPECT_EQ(source, std::string(reinterpret_cast<const char*>(iov.iov_base), + iov.iov_len)); + std::string source2(kBlockSizeBytes, 'b'); buffer_->OnStreamData(kBlockSizeBytes, source2, &written, &error_details_); EXPECT_TRUE(buffer_->PrefetchNextRegion(&iov)); - EXPECT_EQ(source2, QuicString(reinterpret_cast<const char*>(iov.iov_base), - iov.iov_len)); + EXPECT_EQ(source2, std::string(reinterpret_cast<const char*>(iov.iov_base), + iov.iov_len)); } TEST_F(QuicStreamSequencerBufferTest, ConsumeMoreThanPrefetch) { - QuicString source(100, 'a'); + std::string source(100, 'a'); size_t written; buffer_->OnStreamData(0, source, &written, &error_details_); char dest[30]; @@ -707,32 +707,32 @@ iovec iov; EXPECT_TRUE(buffer_->PrefetchNextRegion(&iov)); EXPECT_EQ( - QuicString(70, 'a'), - QuicString(reinterpret_cast<const char*>(iov.iov_base), iov.iov_len)); - QuicString source2(100, 'b'); + std::string(70, 'a'), + std::string(reinterpret_cast<const char*>(iov.iov_base), iov.iov_len)); + std::string source2(100, 'b'); buffer_->OnStreamData(100, source2, &written, &error_details_); buffer_->MarkConsumed(100); EXPECT_TRUE(buffer_->PrefetchNextRegion(&iov)); EXPECT_EQ( - QuicString(70, 'b'), - QuicString(reinterpret_cast<const char*>(iov.iov_base), iov.iov_len)); + std::string(70, 'b'), + std::string(reinterpret_cast<const char*>(iov.iov_base), iov.iov_len)); } TEST_F(QuicStreamSequencerBufferTest, PrefetchMoreThanBufferHas) { - QuicString source(100, 'a'); + std::string source(100, 'a'); size_t written; buffer_->OnStreamData(0, source, &written, &error_details_); iovec iov; EXPECT_TRUE(buffer_->PrefetchNextRegion(&iov)); EXPECT_EQ( - QuicString(100, 'a'), - QuicString(reinterpret_cast<const char*>(iov.iov_base), iov.iov_len)); + std::string(100, 'a'), + std::string(reinterpret_cast<const char*>(iov.iov_base), iov.iov_len)); EXPECT_FALSE(buffer_->PrefetchNextRegion(&iov)); } TEST_F(QuicStreamSequencerBufferTest, MarkConsumedInOneBlock) { // Write into [0, 1024) and then read out [0, 256) - QuicString source(1024, 'a'); + std::string source(1024, 'a'); size_t written; buffer_->OnStreamData(0, source, &written, &error_details_); char dest[256]; @@ -748,7 +748,7 @@ TEST_F(QuicStreamSequencerBufferTest, MarkConsumedNotEnoughBytes) { // Write into [0, 1024) and then read out [0, 256) - QuicString source(1024, 'a'); + std::string source(1024, 'a'); size_t written; buffer_->OnStreamData(0, source, &written, &error_details_); char dest[256]; @@ -768,7 +768,7 @@ TEST_F(QuicStreamSequencerBufferTest, MarkConsumedAcrossBlock) { // Write into [0, 2 * kBlockSizeBytes + 1024) and then read out [0, 1024) - QuicString source(2 * kBlockSizeBytes + 1024, 'a'); + std::string source(2 * kBlockSizeBytes + 1024, 'a'); size_t written; buffer_->OnStreamData(0, source, &written, &error_details_); char dest[1024]; @@ -783,12 +783,12 @@ TEST_F(QuicStreamSequencerBufferTest, MarkConsumedAcrossEnd) { // Write into [0, 2.5 * kBlockSizeBytes - 1024) and then read out [0, 1024) // and then append 1024 + 512 bytes. - QuicString source(2.5 * kBlockSizeBytes - 1024, 'a'); + std::string source(2.5 * kBlockSizeBytes - 1024, 'a'); size_t written; buffer_->OnStreamData(0, source, &written, &error_details_); char dest[1024]; helper_->Read(dest, 1024); - source = QuicString(1024 + 512, 'b'); + source = std::string(1024 + 512, 'b'); buffer_->OnStreamData(2.5 * kBlockSizeBytes - 1024, source, &written, &error_details_); EXPECT_EQ(1024u, buffer_->BytesConsumed()); @@ -809,14 +809,14 @@ TEST_F(QuicStreamSequencerBufferTest, FlushBufferedFrames) { // Write into [0, 2.5 * kBlockSizeBytes - 1024) and then read out [0, 1024). - QuicString source(max_capacity_bytes_ - 1024, 'a'); + std::string source(max_capacity_bytes_ - 1024, 'a'); size_t written; buffer_->OnStreamData(0, source, &written, &error_details_); char dest[1024]; helper_->Read(dest, 1024); EXPECT_EQ(1024u, buffer_->BytesConsumed()); // Write [1024, 512) to the physical beginning. - source = QuicString(512, 'b'); + source = std::string(512, 'b'); buffer_->OnStreamData(max_capacity_bytes_, source, &written, &error_details_); EXPECT_EQ(512u, written); EXPECT_EQ(max_capacity_bytes_ - 1024 + 512, buffer_->FlushBufferedFrames());
diff --git a/quic/core/quic_stream_sequencer_test.cc b/quic/core/quic_stream_sequencer_test.cc index 989b0f6..a99bd28 100644 --- a/quic/core/quic_stream_sequencer_test.cc +++ b/quic/core/quic_stream_sequencer_test.cc
@@ -33,7 +33,7 @@ MOCK_METHOD0(OnFinRead, void()); MOCK_METHOD0(OnDataAvailable, void()); MOCK_METHOD2(CloseConnectionWithDetails, - void(QuicErrorCode error, const QuicString& details)); + void(QuicErrorCode error, const std::string& details)); MOCK_METHOD1(Reset, void(QuicRstStreamErrorCode error)); MOCK_METHOD0(OnCanWrite, void()); MOCK_METHOD1(AddBytesConsumed, void(QuicByteCount bytes)); @@ -70,28 +70,28 @@ : stream_(), sequencer_(new QuicStreamSequencer(&stream_)) {} // Verify that the data in first region match with the expected[0]. - bool VerifyReadableRegion(const std::vector<QuicString>& expected) { + bool VerifyReadableRegion(const std::vector<std::string>& expected) { return VerifyReadableRegion(*sequencer_, expected); } // Verify that the data in each of currently readable regions match with each // item given in |expected|. - bool VerifyReadableRegions(const std::vector<QuicString>& expected) { + bool VerifyReadableRegions(const std::vector<std::string>& expected) { return VerifyReadableRegions(*sequencer_, expected); } bool VerifyIovecs(iovec* iovecs, size_t num_iovecs, - const std::vector<QuicString>& expected) { + const std::vector<std::string>& expected) { return VerifyIovecs(*sequencer_, iovecs, num_iovecs, expected); } bool VerifyReadableRegion(const QuicStreamSequencer& sequencer, - const std::vector<QuicString>& expected) { + const std::vector<std::string>& expected) { iovec iovecs[1]; if (sequencer.GetReadableRegions(iovecs, 1)) { return (VerifyIovecs(sequencer, iovecs, 1, - std::vector<QuicString>{expected[0]})); + std::vector<std::string>{expected[0]})); } return false; } @@ -99,7 +99,7 @@ // Verify that the data in each of currently readable regions match with each // item given in |expected|. bool VerifyReadableRegions(const QuicStreamSequencer& sequencer, - const std::vector<QuicString>& expected) { + const std::vector<std::string>& expected) { iovec iovecs[5]; size_t num_iovecs = sequencer.GetReadableRegions(iovecs, QUIC_ARRAYSIZE(iovecs)); @@ -110,7 +110,7 @@ bool VerifyIovecs(const QuicStreamSequencer& sequencer, iovec* iovecs, size_t num_iovecs, - const std::vector<QuicString>& expected) { + const std::vector<std::string>& expected) { int start_position = 0; for (size_t i = 0; i < num_iovecs; ++i) { if (!VerifyIovec(iovecs[i], @@ -388,7 +388,7 @@ class QuicSequencerRandomTest : public QuicStreamSequencerTest { public: - typedef std::pair<int, QuicString> Frame; + typedef std::pair<int, std::string> Frame; typedef std::vector<Frame> FrameList; void CreateFrames() { @@ -398,7 +398,7 @@ int size = std::min(OneToN(6), remaining_payload); int index = payload_size - remaining_payload; list_.push_back( - std::make_pair(index, QuicString(kPayload + index, size))); + std::make_pair(index, std::string(kPayload + index, size))); remaining_payload -= size; } } @@ -424,9 +424,9 @@ output_.append(output, bytes_read); } - QuicString output_; + std::string output_; // Data which peek at using GetReadableRegion if we back up. - QuicString peeked_; + std::string peeked_; SimpleRandom random_; FrameList list_; }; @@ -507,8 +507,8 @@ ASSERT_EQ(output_.size(), peeked_.size()); } } - EXPECT_EQ(QuicString(kPayload), output_); - EXPECT_EQ(QuicString(kPayload), peeked_); + EXPECT_EQ(std::string(kPayload), output_); + EXPECT_EQ(std::string(kPayload), peeked_); EXPECT_EQ(QUIC_ARRAYSIZE(kPayload) - 1, total_bytes_consumed); } @@ -525,14 +525,14 @@ EXPECT_EQ(9u, sequencer_->NumBytesBuffered()); // Peek into the data. - std::vector<QuicString> expected = {"abcdefghi"}; + std::vector<std::string> expected = {"abcdefghi"}; ASSERT_TRUE(VerifyReadableRegions(expected)); // Consume 1 byte. EXPECT_CALL(stream_, AddBytesConsumed(1)); sequencer_->MarkConsumed(1); // Verify data. - std::vector<QuicString> expected2 = {"bcdefghi"}; + std::vector<std::string> expected2 = {"bcdefghi"}; ASSERT_TRUE(VerifyReadableRegions(expected2)); EXPECT_EQ(8u, sequencer_->NumBytesBuffered()); @@ -540,7 +540,7 @@ EXPECT_CALL(stream_, AddBytesConsumed(2)); sequencer_->MarkConsumed(2); // Verify data. - std::vector<QuicString> expected3 = {"defghi"}; + std::vector<std::string> expected3 = {"defghi"}; ASSERT_TRUE(VerifyReadableRegions(expected3)); EXPECT_EQ(6u, sequencer_->NumBytesBuffered()); @@ -548,7 +548,7 @@ EXPECT_CALL(stream_, AddBytesConsumed(5)); sequencer_->MarkConsumed(5); // Verify data. - std::vector<QuicString> expected4{"i"}; + std::vector<std::string> expected4{"i"}; ASSERT_TRUE(VerifyReadableRegions(expected4)); EXPECT_EQ(1u, sequencer_->NumBytesBuffered()); } @@ -561,7 +561,7 @@ // Peek into the data. Only the first chunk should be readable because of the // missing data. - std::vector<QuicString> expected{"abc"}; + std::vector<std::string> expected{"abc"}; ASSERT_TRUE(VerifyReadableRegions(expected)); // Now, attempt to mark consumed more data than was readable and expect the @@ -581,7 +581,7 @@ // Missing packet: 6, ghi. OnFrame(9, "jkl"); - std::vector<QuicString> expected = {"abcdef"}; + std::vector<std::string> expected = {"abcdef"}; ASSERT_TRUE(VerifyReadableRegions(expected)); EXPECT_CALL(stream_, AddBytesConsumed(6)); @@ -600,7 +600,7 @@ EXPECT_EQ(9u, sequencer_->NumBytesBuffered()); // Peek into the data. - std::vector<QuicString> expected = {"abcdefghi"}; + std::vector<std::string> expected = {"abcdefghi"}; ASSERT_TRUE(VerifyReadableRegions(expected)); QuicStreamSequencer sequencer2(std::move(*sequencer_)); @@ -624,7 +624,7 @@ TEST_F(QuicStreamSequencerTest, DataAvailableOnOverlappingFrames) { QuicStreamId id = 1; - const QuicString data(1000, '.'); + const std::string data(1000, '.'); // Received [0, 1000). QuicStreamFrame frame1(id, false, 0, data); @@ -693,7 +693,7 @@ TEST_F(QuicStreamSequencerTest, ReadSingleFrame) { EXPECT_CALL(stream_, OnDataAvailable()); OnFrame(0u, "abc"); - QuicString actual; + std::string actual; EXPECT_CALL(stream_, AddBytesConsumed(3)); sequencer_->Read(&actual); EXPECT_EQ("abc", actual); @@ -706,7 +706,7 @@ OnFrame(3u, "def"); OnFrame(6u, "ghi"); OnFrame(10u, "xyz"); // Byte 9 is missing. - QuicString actual; + std::string actual; EXPECT_CALL(stream_, AddBytesConsumed(9)); sequencer_->Read(&actual); EXPECT_EQ("abcdefghi", actual); @@ -717,7 +717,7 @@ EXPECT_CALL(stream_, OnDataAvailable()); OnFrame(0u, "def"); OnFrame(3u, "ghi"); - QuicString actual = "abc"; + std::string actual = "abc"; EXPECT_CALL(stream_, AddBytesConsumed(6)); sequencer_->Read(&actual); EXPECT_EQ("abcdefghi", actual);
diff --git a/quic/core/quic_stream_test.cc b/quic/core/quic_stream_test.cc index d019f71..34f9597 100644 --- a/quic/core/quic_stream_test.cc +++ b/quic/core/quic_stream_test.cc
@@ -66,7 +66,7 @@ using QuicStream::WritevData; private: - QuicString data_; + std::string data_; }; class QuicStreamTestBase : public QuicTestWithParam<ParsedQuicVersion> { @@ -160,7 +160,8 @@ // Index value of 1 has the test run with supported-version[1], which is some // version OTHER than 99. INSTANTIATE_TEST_SUITE_P( - QuicStreamTests, QuicStreamTest, + QuicStreamTests, + QuicStreamTest, ::testing::ValuesIn(ParsedVersionOfIndex(AllSupportedVersions(), 1))); // Make a parameterized version of the QuicStreamTest for those tests @@ -389,7 +390,7 @@ TEST_P(QuicStreamTest, WriteOrBufferDataReachStreamLimit) { Initialize(); - QuicString data("aaaaa"); + std::string data("aaaaa"); QuicStreamPeer::SetStreamBytesWritten(kMaxStreamLength - data.length(), stream_); EXPECT_CALL(*session_, WritevData(_, _, _, _, _)) @@ -574,7 +575,7 @@ .Times(AtLeast(1)) .WillRepeatedly(Invoke(this, &QuicStreamTest::ClearControlFrame)); - QuicString data(1000, 'x'); + std::string data(1000, 'x'); for (QuicStreamOffset offset = 0; offset < 2 * kInitialStreamFlowControlWindowForTest; offset += data.length()) { @@ -968,7 +969,7 @@ set_initial_flow_control_window_bytes(500000); Initialize(); - QuicString data(1024, 'a'); + std::string data(1024, 'a'); EXPECT_TRUE(stream_->CanWriteNewData()); // Testing WriteOrBufferData. @@ -1073,7 +1074,7 @@ TEST_P(QuicStreamTest, WritevDataReachStreamLimit) { Initialize(); - QuicString data("aaaaa"); + std::string data("aaaaa"); QuicStreamPeer::SetStreamBytesWritten(kMaxStreamLength - data.length(), stream_); EXPECT_CALL(*session_, WritevData(_, _, _, _, _)) @@ -1339,7 +1340,7 @@ .WillRepeatedly(Invoke(MockQuicSession::ConsumeData)); EXPECT_CALL(*connection_, SendControlFrame(_)) .WillOnce(Invoke(this, &QuicStreamTest::ClearControlFrame)); - QuicString data(1024, '.'); + std::string data(1024, '.'); stream_->WriteOrBufferData(data, false, nullptr); EXPECT_FALSE(HasWriteBlockedStreams()); @@ -1360,7 +1361,7 @@ set_initial_flow_control_window_bytes(kSmallWindow); Initialize(); - QuicString data(kSmallWindow, '.'); + std::string data(kSmallWindow, '.'); EXPECT_CALL(*session_, WritevData(_, _, _, _, _)) .WillRepeatedly(Invoke(MockQuicSession::ConsumeData)); EXPECT_CALL(*connection_, SendControlFrame(_)) @@ -1419,7 +1420,7 @@ EXPECT_CALL(*session_, WritevData(_, stream_->id(), 200, 0, FIN)) .WillOnce(Invoke(MockQuicSession::ConsumeData)); - QuicString body(200, 'a'); + std::string body(200, 'a'); stream_->WriteOrBufferData(body, true, nullptr); // Set TTL to be 1 s. @@ -1443,7 +1444,7 @@ EXPECT_CALL(*session_, WritevData(_, stream_->id(), 200, 0, FIN)) .WillOnce(Invoke(MockQuicSession::ConsumeData)); - QuicString body(200, 'a'); + std::string body(200, 'a'); stream_->WriteOrBufferData(body, true, nullptr); // Set TTL to be 1 s.
diff --git a/quic/core/quic_tag.cc b/quic/core/quic_tag.cc index 7c9c329..eebe744 100644 --- a/quic/core/quic_tag.cc +++ b/quic/core/quic_tag.cc
@@ -34,7 +34,7 @@ return false; } -QuicString QuicTagToString(QuicTag tag) { +std::string QuicTagToString(QuicTag tag) { char chars[sizeof tag]; bool ascii = true; const QuicTag orig_tag = tag; @@ -53,7 +53,7 @@ } if (ascii) { - return QuicString(chars, sizeof(chars)); + return std::string(chars, sizeof(chars)); } return QuicTextUtils::Uint64ToString(orig_tag);
diff --git a/quic/core/quic_tag.h b/quic/core/quic_tag.h index 1808d9d..03763a7 100644 --- a/quic/core/quic_tag.h +++ b/quic/core/quic_tag.h
@@ -22,7 +22,7 @@ // just a mnemonic for the value 0x504d5845 (little-endian version of the ASCII // string E X M P). typedef uint32_t QuicTag; -typedef std::map<QuicTag, QuicString> QuicTagValueMap; +typedef std::map<QuicTag, std::string> QuicTagValueMap; typedef std::vector<QuicTag> QuicTagVector; // MakeQuicTag returns a value given the four bytes. For example: @@ -46,7 +46,7 @@ // A utility function that converts a tag to a string. It will try to maintain // the human friendly name if possible (i.e. kABCD -> "ABCD"), or will just // treat it as a number if not. -QUIC_EXPORT_PRIVATE QuicString QuicTagToString(QuicTag tag); +QUIC_EXPORT_PRIVATE std::string QuicTagToString(QuicTag tag); } // namespace quic
diff --git a/quic/core/quic_time.cc b/quic/core/quic_time.cc index 92a3eec..e3df0b9 100644 --- a/quic/core/quic_time.cc +++ b/quic/core/quic_time.cc
@@ -13,7 +13,7 @@ namespace quic { -QuicString QuicTime::Delta::ToDebugValue() const { +std::string QuicTime::Delta::ToDebugValue() const { const int64_t one_ms = 1000; const int64_t one_s = 1000 * one_ms;
diff --git a/quic/core/quic_time.h b/quic/core/quic_time.h index 6bd3f68..9624b6f 100644 --- a/quic/core/quic_time.h +++ b/quic/core/quic_time.h
@@ -75,7 +75,7 @@ return time_offset_ == kQuicInfiniteTimeUs; } - QuicString ToDebugValue() const; + std::string ToDebugValue() const; private: friend inline bool operator==(QuicTime::Delta lhs, QuicTime::Delta rhs);
diff --git a/quic/core/quic_time_wait_list_manager.h b/quic/core/quic_time_wait_list_manager.h index 74630ad..db1d1f7 100644 --- a/quic/core/quic_time_wait_list_manager.h +++ b/quic/core/quic_time_wait_list_manager.h
@@ -144,7 +144,7 @@ bool ietf_quic, std::unique_ptr<QuicPerPacketContext> packet_context); - virtual void GetEndpointId(QuicString* endpoint_id) {} + virtual void GetEndpointId(std::string* endpoint_id) {} // Returns a stateless reset token which will be included in the public reset // packet.
diff --git a/quic/core/quic_trace_visitor.cc b/quic/core/quic_trace_visitor.cc index ba2ed7f..3785d53 100644 --- a/quic/core/quic_trace_visitor.cc +++ b/quic/core/quic_trace_visitor.cc
@@ -26,8 +26,8 @@ QuicTraceVisitor::QuicTraceVisitor(const QuicConnection* connection) : connection_(connection), start_time_(connection_->clock()->ApproximateNow()) { - QuicString binary_connection_id(connection->connection_id().data(), - connection->connection_id().length()); + std::string binary_connection_id(connection->connection_id().data(), + connection->connection_id().length()); // We assume that the connection ID in gQUIC is equivalent to the // server-chosen client-selected ID. switch (connection->perspective()) { @@ -263,7 +263,7 @@ void QuicTraceVisitor::OnSuccessfulVersionNegotiation( const ParsedQuicVersion& version) { uint32_t tag = QuicEndian::HostToNet32(CreateQuicVersionLabel(version)); - QuicString binary_tag(reinterpret_cast<const char*>(&tag), sizeof(tag)); + std::string binary_tag(reinterpret_cast<const char*>(&tag), sizeof(tag)); trace_.set_protocol_version(binary_tag); }
diff --git a/quic/core/quic_trace_visitor_test.cc b/quic/core/quic_trace_visitor_test.cc index 008026d..ee179bb 100644 --- a/quic/core/quic_trace_visitor_test.cc +++ b/quic/core/quic_trace_visitor_test.cc
@@ -76,12 +76,12 @@ TEST_F(QuicTraceVisitorTest, ConnectionId) { char expected_cid[] = {0, 0, 0, 0, 0, 0, 0, 42}; - EXPECT_EQ(QuicString(expected_cid, sizeof(expected_cid)), + EXPECT_EQ(std::string(expected_cid, sizeof(expected_cid)), trace_.destination_connection_id()); } TEST_F(QuicTraceVisitorTest, Version) { - QuicString version = trace_.protocol_version(); + std::string version = trace_.protocol_version(); ASSERT_EQ(4u, version.size()); EXPECT_EQ('Q', version[0]); }
diff --git a/quic/core/quic_utils.cc b/quic/core/quic_utils.cc index d83db1c..10854bf 100644 --- a/quic/core/quic_utils.cc +++ b/quic/core/quic_utils.cc
@@ -165,7 +165,7 @@ return "INVALID_TRANSMISSION_TYPE"; } -QuicString QuicUtils::AddressChangeTypeToString(AddressChangeType type) { +std::string QuicUtils::AddressChangeTypeToString(AddressChangeType type) { switch (type) { RETURN_STRING_LITERAL(NO_CHANGE); RETURN_STRING_LITERAL(PORT_CHANGE);
diff --git a/quic/core/quic_utils.h b/quic/core/quic_utils.h index 28ea15b..3ef4788 100644 --- a/quic/core/quic_utils.h +++ b/quic/core/quic_utils.h
@@ -57,7 +57,7 @@ static const char* TransmissionTypeToString(TransmissionType type); // Returns AddressChangeType as a string. - static QuicString AddressChangeTypeToString(AddressChangeType type); + static std::string AddressChangeTypeToString(AddressChangeType type); // Returns SentPacketState as a char*. static const char* SentPacketStateToString(SentPacketState state);
diff --git a/quic/core/quic_utils_test.cc b/quic/core/quic_utils_test.cc index de4c76b..f88a34a 100644 --- a/quic/core/quic_utils_test.cc +++ b/quic/core/quic_utils_test.cc
@@ -18,11 +18,11 @@ class QuicUtilsTest : public QuicTest {}; TEST_F(QuicUtilsTest, DetermineAddressChangeType) { - const QuicString kIPv4String1 = "1.2.3.4"; - const QuicString kIPv4String2 = "1.2.3.5"; - const QuicString kIPv4String3 = "1.1.3.5"; - const QuicString kIPv6String1 = "2001:700:300:1800::f"; - const QuicString kIPv6String2 = "2001:700:300:1800:1:1:1:f"; + const std::string kIPv4String1 = "1.2.3.4"; + const std::string kIPv4String2 = "1.2.3.5"; + const std::string kIPv4String3 = "1.1.3.5"; + const std::string kIPv6String1 = "2001:700:300:1800::f"; + const std::string kIPv6String2 = "2001:700:300:1800:1:1:1:f"; QuicSocketAddress old_address; QuicSocketAddress new_address; QuicIpAddress address; @@ -168,11 +168,11 @@ MockRandom random(33); QuicConnectionId connection_id = QuicUtils::CreateRandomConnectionId(&random); EXPECT_EQ(connection_id.length(), sizeof(uint64_t)); - char connection_id_bytes[sizeof(uint64_t)]; - random.RandBytes(connection_id_bytes, QUIC_ARRAYSIZE(connection_id_bytes)); - EXPECT_EQ(connection_id, - QuicConnectionId(static_cast<char*>(connection_id_bytes), - QUIC_ARRAYSIZE(connection_id_bytes))); + char connection_id_bytes[sizeof(uint64_t)]; + random.RandBytes(connection_id_bytes, QUIC_ARRAYSIZE(connection_id_bytes)); + EXPECT_EQ(connection_id, + QuicConnectionId(static_cast<char*>(connection_id_bytes), + QUIC_ARRAYSIZE(connection_id_bytes))); EXPECT_NE(connection_id, EmptyQuicConnectionId()); EXPECT_NE(connection_id, TestConnectionId()); EXPECT_NE(connection_id, TestConnectionId(1));
diff --git a/quic/core/quic_versions.cc b/quic/core/quic_versions.cc index efc823d..7ea441a 100644 --- a/quic/core/quic_versions.cc +++ b/quic/core/quic_versions.cc
@@ -243,15 +243,15 @@ ParsedQuicVersion(PROTOCOL_QUIC_CRYPTO, transport_version)); } -QuicString QuicVersionLabelToString(QuicVersionLabel version_label) { +std::string QuicVersionLabelToString(QuicVersionLabel version_label) { return QuicTagToString(QuicEndian::HostToNet32(version_label)); } -QuicString QuicVersionLabelVectorToString( +std::string QuicVersionLabelVectorToString( const QuicVersionLabelVector& version_labels, - const QuicString& separator, + const std::string& separator, size_t skip_after_nth_version) { - QuicString result; + std::string result; for (size_t i = 0; i < version_labels.size(); ++i) { if (i != 0) { result.append(separator); @@ -280,7 +280,7 @@ case x: \ return #x -QuicString QuicVersionToString(QuicTransportVersion transport_version) { +std::string QuicVersionToString(QuicTransportVersion transport_version) { switch (transport_version) { RETURN_STRING_LITERAL(QUIC_VERSION_39); RETURN_STRING_LITERAL(QUIC_VERSION_43); @@ -293,13 +293,13 @@ } } -QuicString ParsedQuicVersionToString(ParsedQuicVersion version) { +std::string ParsedQuicVersionToString(ParsedQuicVersion version) { return QuicVersionLabelToString(CreateQuicVersionLabel(version)); } -QuicString QuicTransportVersionVectorToString( +std::string QuicTransportVersionVectorToString( const QuicTransportVersionVector& versions) { - QuicString result = ""; + std::string result = ""; for (size_t i = 0; i < versions.size(); ++i) { if (i != 0) { result.append(","); @@ -309,11 +309,11 @@ return result; } -QuicString ParsedQuicVersionVectorToString( +std::string ParsedQuicVersionVectorToString( const ParsedQuicVersionVector& versions, - const QuicString& separator, + const std::string& separator, size_t skip_after_nth_version) { - QuicString result; + std::string result; for (size_t i = 0; i < versions.size(); ++i) { if (i != 0) { result.append(separator);
diff --git a/quic/core/quic_versions.h b/quic/core/quic_versions.h index c0fa34a..2825c9f 100644 --- a/quic/core/quic_versions.h +++ b/quic/core/quic_versions.h
@@ -244,20 +244,20 @@ QuicVersionToQuicVersionLabel(QuicTransportVersion transport_version); // Helper function which translates from a QuicVersionLabel to a string. -QUIC_EXPORT_PRIVATE QuicString -QuicVersionLabelToString(QuicVersionLabel version_label); +QUIC_EXPORT_PRIVATE std::string QuicVersionLabelToString( + QuicVersionLabel version_label); // Returns |separator|-separated list of string representations of // QuicVersionLabel values in the supplied |version_labels| vector. The values // after the (0-based) |skip_after_nth_version|'th are skipped. -QUIC_EXPORT_PRIVATE QuicString -QuicVersionLabelVectorToString(const QuicVersionLabelVector& version_labels, - const QuicString& separator, - size_t skip_after_nth_version); +QUIC_EXPORT_PRIVATE std::string QuicVersionLabelVectorToString( + const QuicVersionLabelVector& version_labels, + const std::string& separator, + size_t skip_after_nth_version); // Returns comma separated list of string representations of QuicVersionLabel // values in the supplied |version_labels| vector. -QUIC_EXPORT_PRIVATE inline QuicString QuicVersionLabelVectorToString( +QUIC_EXPORT_PRIVATE inline std::string QuicVersionLabelVectorToString( const QuicVersionLabelVector& version_labels) { return QuicVersionLabelVectorToString(version_labels, ",", std::numeric_limits<size_t>::max()); @@ -275,35 +275,35 @@ // Helper function which translates from a QuicTransportVersion to a string. // Returns strings corresponding to enum names (e.g. QUIC_VERSION_6). -QUIC_EXPORT_PRIVATE QuicString -QuicVersionToString(QuicTransportVersion transport_version); +QUIC_EXPORT_PRIVATE std::string QuicVersionToString( + QuicTransportVersion transport_version); // Helper function which translates from a ParsedQuicVersion to a string. // Returns strings corresponding to the on-the-wire tag. -QUIC_EXPORT_PRIVATE QuicString -ParsedQuicVersionToString(ParsedQuicVersion version); +QUIC_EXPORT_PRIVATE std::string ParsedQuicVersionToString( + ParsedQuicVersion version); // Returns comma separated list of string representations of // QuicTransportVersion enum values in the supplied |versions| vector. -QUIC_EXPORT_PRIVATE QuicString -QuicTransportVersionVectorToString(const QuicTransportVersionVector& versions); +QUIC_EXPORT_PRIVATE std::string QuicTransportVersionVectorToString( + const QuicTransportVersionVector& versions); // Returns comma separated list of string representations of ParsedQuicVersion // values in the supplied |versions| vector. -QUIC_EXPORT_PRIVATE QuicString -ParsedQuicVersionVectorToString(const ParsedQuicVersionVector& versions); +QUIC_EXPORT_PRIVATE std::string ParsedQuicVersionVectorToString( + const ParsedQuicVersionVector& versions); // Returns |separator|-separated list of string representations of // ParsedQuicVersion values in the supplied |versions| vector. The values after // the (0-based) |skip_after_nth_version|'th are skipped. -QUIC_EXPORT_PRIVATE QuicString -ParsedQuicVersionVectorToString(const ParsedQuicVersionVector& versions, - const QuicString& separator, - size_t skip_after_nth_version); +QUIC_EXPORT_PRIVATE std::string ParsedQuicVersionVectorToString( + const ParsedQuicVersionVector& versions, + const std::string& separator, + size_t skip_after_nth_version); // Returns comma separated list of string representations of ParsedQuicVersion // values in the supplied |versions| vector. -QUIC_EXPORT_PRIVATE inline QuicString ParsedQuicVersionVectorToString( +QUIC_EXPORT_PRIVATE inline std::string ParsedQuicVersionVectorToString( const ParsedQuicVersionVector& versions) { return ParsedQuicVersionVectorToString(versions, ",", std::numeric_limits<size_t>::max());
diff --git a/quic/core/stateless_rejector.cc b/quic/core/stateless_rejector.cc index 3cf30df..24750d7 100644 --- a/quic/core/stateless_rejector.cc +++ b/quic/core/stateless_rejector.cc
@@ -104,7 +104,7 @@ : rejector_(std::move(rejector)), done_cb_(std::move(done_cb)) {} void Run(QuicErrorCode error, - const QuicString& error_details, + const std::string& error_details, std::unique_ptr<CryptoHandshakeMessage> message, std::unique_ptr<DiversificationNonce> diversification_nonce, std::unique_ptr<ProofSource::Details> /* proof_source_details */) @@ -140,7 +140,7 @@ void StatelessRejector::ProcessClientHelloDone( QuicErrorCode error, - const QuicString& error_details, + const std::string& error_details, std::unique_ptr<CryptoHandshakeMessage> message, std::unique_ptr<StatelessRejector> rejector, std::unique_ptr<StatelessRejector::ProcessDoneCallback> done_cb) {
diff --git a/quic/core/stateless_rejector.h b/quic/core/stateless_rejector.h index d9ff94d..ae0d379 100644 --- a/quic/core/stateless_rejector.h +++ b/quic/core/stateless_rejector.h
@@ -66,7 +66,7 @@ QuicErrorCode error() const { return error_; } // Returns the error details when state() returns FAILED. - QuicString error_details() const { return error_details_; } + std::string error_details() const { return error_details_; } // Returns the connection ID. QuicConnectionId connection_id() const { return connection_id_; } @@ -91,14 +91,14 @@ void ProcessClientHelloDone( QuicErrorCode error, - const QuicString& error_details, + const std::string& error_details, std::unique_ptr<CryptoHandshakeMessage> message, std::unique_ptr<StatelessRejector> rejector, std::unique_ptr<StatelessRejector::ProcessDoneCallback> done_cb); State state_; QuicErrorCode error_; - QuicString error_details_; + std::string error_details_; ParsedQuicVersion version_; ParsedQuicVersionVector versions_; QuicConnectionId connection_id_;
diff --git a/quic/core/stateless_rejector_test.cc b/quic/core/stateless_rejector_test.cc index 19eef64..cf5cdd0 100644 --- a/quic/core/stateless_rejector_test.cc +++ b/quic/core/stateless_rejector_test.cc
@@ -56,7 +56,8 @@ FlagsMode flags; }; -QuicString TestParamToString(const testing::TestParamInfo<TestParams>& params) { +std::string TestParamToString( + const testing::TestParamInfo<TestParams>& params) { return QuicStrCat("v", ParsedQuicVersionToString(params.param.version), "_", FlagsModeToString(params.param.flags)); } @@ -122,7 +123,7 @@ "#" + QuicTextUtils::HexEncode(public_value, sizeof(public_value)); // Generate a client nonce. - QuicString nonce; + std::string nonce; CryptoUtils::GenerateNonce( clock_.WallNow(), QuicRandom::GetInstance(), QuicStringPiece( @@ -135,7 +136,7 @@ SourceAddressTokens previous_tokens; QuicIpAddress ip = QuicIpAddress::Loopback4(); MockRandom rand; - QuicString stk = config_peer_.NewSourceAddressToken( + std::string stk = config_peer_.NewSourceAddressToken( config_peer_.GetPrimaryConfig()->id, previous_tokens, ip, &rand, clock_.WallNow(), nullptr); stk_hex_ = "#" + QuicTextUtils::HexEncode(stk); @@ -162,14 +163,15 @@ std::unique_ptr<StatelessRejector> rejector_; // Values used in CHLO messages - QuicString scid_hex_; - QuicString nonc_hex_; - QuicString pubs_hex_; - QuicString ver_hex_; - QuicString stk_hex_; + std::string scid_hex_; + std::string nonc_hex_; + std::string pubs_hex_; + std::string ver_hex_; + std::string stk_hex_; }; -INSTANTIATE_TEST_SUITE_P(Flags, StatelessRejectorTest, +INSTANTIATE_TEST_SUITE_P(Flags, + StatelessRejectorTest, ::testing::ValuesIn(GetTestParams()), TestParamToString); @@ -252,7 +254,7 @@ TEST_P(StatelessRejectorTest, AcceptChlo) { const uint64_t xlct = crypto_test_utils::LeafCertHashForTesting(); - const QuicString xlct_hex = + const std::string xlct_hex = "#" + QuicTextUtils::HexEncode(reinterpret_cast<const char*>(&xlct), sizeof(xlct)); // clang-format off
diff --git a/quic/core/tls_client_handshaker.cc b/quic/core/tls_client_handshaker.cc index f232dc3..6a76e08 100644 --- a/quic/core/tls_client_handshaker.cc +++ b/quic/core/tls_client_handshaker.cc
@@ -20,7 +20,7 @@ void TlsClientHandshaker::ProofVerifierCallbackImpl::Run( bool ok, - const QuicString& error_details, + const std::string& error_details, std::unique_ptr<ProofVerifyDetails>* details) { if (parent_ == nullptr) { return; @@ -44,7 +44,7 @@ ProofVerifier* proof_verifier, SSL_CTX* ssl_ctx, std::unique_ptr<ProofVerifyContext> verify_context, - const QuicString& user_agent_id) + const std::string& user_agent_id) : TlsHandshaker(stream, session, ssl_ctx), server_id_(server_id), proof_verifier_(proof_verifier), @@ -116,7 +116,7 @@ } bool TlsClientHandshaker::ProcessTransportParameters( - QuicString* error_details) { + std::string* error_details) { TransportParameters params; const uint8_t* param_bytes; size_t param_bytes_len; @@ -166,7 +166,7 @@ return false; } -QuicString TlsClientHandshaker::chlo_hash() const { +std::string TlsClientHandshaker::chlo_hash() const { return ""; } @@ -229,7 +229,7 @@ } void TlsClientHandshaker::CloseConnection(QuicErrorCode error, - const QuicString& reason_phrase) { + const std::string& reason_phrase) { state_ = STATE_CONNECTION_CLOSED; stream()->CloseConnectionWithDetails(error, reason_phrase); } @@ -238,7 +238,7 @@ QUIC_LOG(INFO) << "Client: handshake finished"; state_ = STATE_HANDSHAKE_COMPLETE; - QuicString error_details; + std::string error_details; if (!ProcessTransportParameters(&error_details)) { CloseConnection(QUIC_HANDSHAKE_FAILED, error_details); return; @@ -276,11 +276,11 @@ return ssl_verify_invalid; } // TODO(nharper): Pass the CRYPTO_BUFFERs into the QUIC stack to avoid copies. - std::vector<QuicString> certs; + std::vector<std::string> certs; for (CRYPTO_BUFFER* cert : cert_chain) { certs.push_back( - QuicString(reinterpret_cast<const char*>(CRYPTO_BUFFER_data(cert)), - CRYPTO_BUFFER_len(cert))); + std::string(reinterpret_cast<const char*>(CRYPTO_BUFFER_data(cert)), + CRYPTO_BUFFER_len(cert))); } ProofVerifierCallbackImpl* proof_verify_callback =
diff --git a/quic/core/tls_client_handshaker.h b/quic/core/tls_client_handshaker.h index 3e216f0..106c9c8 100644 --- a/quic/core/tls_client_handshaker.h +++ b/quic/core/tls_client_handshaker.h
@@ -27,7 +27,7 @@ ProofVerifier* proof_verifier, SSL_CTX* ssl_ctx, std::unique_ptr<ProofVerifyContext> verify_context, - const QuicString& user_agent_id); + const std::string& user_agent_id); TlsClientHandshaker(const TlsClientHandshaker&) = delete; TlsClientHandshaker& operator=(const TlsClientHandshaker&) = delete; @@ -43,7 +43,7 @@ int num_scup_messages_received() const override; bool WasChannelIDSent() const override; bool WasChannelIDSourceCallbackRun() const override; - QuicString chlo_hash() const override; + std::string chlo_hash() const override; // From QuicCryptoClientStream::HandshakerDelegate and TlsHandshaker bool encryption_established() const override; @@ -62,7 +62,7 @@ // ProofVerifierCallback interface. void Run(bool ok, - const QuicString& error_details, + const std::string& error_details, std::unique_ptr<ProofVerifyDetails>* details) override; // If called, Cancel causes the pending callback to be a no-op. @@ -81,12 +81,12 @@ } state_ = STATE_IDLE; bool SetTransportParameters(); - bool ProcessTransportParameters(QuicString* error_details); + bool ProcessTransportParameters(std::string* error_details); void FinishHandshake(); void AdvanceHandshake() override; void CloseConnection(QuicErrorCode error, - const QuicString& reason_phrase) override; + const std::string& reason_phrase) override; // Certificate verification functions: @@ -107,14 +107,14 @@ ProofVerifier* proof_verifier_; std::unique_ptr<ProofVerifyContext> verify_context_; - QuicString user_agent_id_; + std::string user_agent_id_; // ProofVerifierCallback used for async certificate verification. This object // is owned by |proof_verifier_|. ProofVerifierCallbackImpl* proof_verify_callback_ = nullptr; std::unique_ptr<ProofVerifyDetails> verify_details_; enum ssl_verify_result_t verify_result_ = ssl_verify_retry; - QuicString cert_verify_error_details_; + std::string cert_verify_error_details_; bool encryption_established_ = false; bool handshake_confirmed_ = false;
diff --git a/quic/core/tls_handshaker.h b/quic/core/tls_handshaker.h index ceba9a9..9658923 100644 --- a/quic/core/tls_handshaker.h +++ b/quic/core/tls_handshaker.h
@@ -38,7 +38,7 @@ bool ProcessInput(QuicStringPiece input, EncryptionLevel level) override; size_t InputBytesRemaining() const override { return 0; } QuicErrorCode error() const override { return parser_error_; } - const QuicString& error_detail() const override { + const std::string& error_detail() const override { return parser_error_detail_; } @@ -53,7 +53,7 @@ virtual void AdvanceHandshake() = 0; virtual void CloseConnection(QuicErrorCode error, - const QuicString& reason_phrase) = 0; + const std::string& reason_phrase) = 0; // Creates an SSL_CTX and configures it with the options that are appropriate // for both client and server. The caller is responsible for ownership of the @@ -135,7 +135,7 @@ QuicSession* session_; QuicErrorCode parser_error_ = QUIC_NO_ERROR; - QuicString parser_error_detail_; + std::string parser_error_detail_; bssl::UniquePtr<SSL> ssl_; };
diff --git a/quic/core/tls_handshaker_test.cc b/quic/core/tls_handshaker_test.cc index 2d678dd..ae9e3fc 100644 --- a/quic/core/tls_handshaker_test.cc +++ b/quic/core/tls_handshaker_test.cc
@@ -26,16 +26,16 @@ : verifier_(crypto_test_utils::ProofVerifierForTesting()) {} QuicAsyncStatus VerifyProof( - const QuicString& hostname, + const std::string& hostname, const uint16_t port, - const QuicString& server_config, + const std::string& server_config, QuicTransportVersion quic_version, QuicStringPiece chlo_hash, - const std::vector<QuicString>& certs, - const QuicString& cert_sct, - const QuicString& signature, + const std::vector<std::string>& certs, + const std::string& cert_sct, + const std::string& signature, const ProofVerifyContext* context, - QuicString* error_details, + std::string* error_details, std::unique_ptr<ProofVerifyDetails>* details, std::unique_ptr<ProofVerifierCallback> callback) override { return verifier_->VerifyProof( @@ -44,10 +44,10 @@ } QuicAsyncStatus VerifyCertChain( - const QuicString& hostname, - const std::vector<QuicString>& certs, + const std::string& hostname, + const std::vector<std::string>& certs, const ProofVerifyContext* context, - QuicString* error_details, + std::string* error_details, std::unique_ptr<ProofVerifyDetails>* details, std::unique_ptr<ProofVerifierCallback> callback) override { if (!active_) { @@ -81,7 +81,7 @@ class FailingProofVerifierCallback : public ProofVerifierCallback { public: void Run(bool ok, - const QuicString& error_details, + const std::string& error_details, std::unique_ptr<ProofVerifyDetails>* details) override { FAIL(); } @@ -89,10 +89,10 @@ class VerifyChainPendingOp { public: - VerifyChainPendingOp(const QuicString& hostname, - const std::vector<QuicString>& certs, + VerifyChainPendingOp(const std::string& hostname, + const std::vector<std::string>& certs, const ProofVerifyContext* context, - QuicString* error_details, + std::string* error_details, std::unique_ptr<ProofVerifyDetails>* details, std::unique_ptr<ProofVerifierCallback> callback, ProofVerifier* delegate) @@ -117,10 +117,10 @@ } private: - QuicString hostname_; - std::vector<QuicString> certs_; + std::string hostname_; + std::vector<std::string> certs_; const ProofVerifyContext* context_; - QuicString* error_details_; + std::string* error_details_; std::unique_ptr<ProofVerifyDetails>* details_; std::unique_ptr<ProofVerifierCallback> callback_; ProofVerifier* delegate_; @@ -158,10 +158,10 @@ } void WriteCryptoData(EncryptionLevel level, QuicStringPiece data) override { - pending_writes_.push_back(std::make_pair(QuicString(data), level)); + pending_writes_.push_back(std::make_pair(std::string(data), level)); } - const std::vector<std::pair<QuicString, EncryptionLevel>>& pending_writes() { + const std::vector<std::pair<std::string, EncryptionLevel>>& pending_writes() { return pending_writes_; } @@ -191,7 +191,7 @@ } private: - std::vector<std::pair<QuicString, EncryptionLevel>> pending_writes_; + std::vector<std::pair<std::string, EncryptionLevel>> pending_writes_; }; class TestQuicCryptoClientStream : public TestQuicCryptoStream {
diff --git a/quic/core/tls_server_handshaker.cc b/quic/core/tls_server_handshaker.cc index 02cc441..b8f9573 100644 --- a/quic/core/tls_server_handshaker.cc +++ b/quic/core/tls_server_handshaker.cc
@@ -21,7 +21,7 @@ : handshaker_(handshaker) {} void TlsServerHandshaker::SignatureCallback::Run(bool ok, - QuicString signature) { + std::string signature) { if (handshaker_ == nullptr) { return; } @@ -91,7 +91,7 @@ } bool TlsServerHandshaker::GetBase64SHA256ClientChannelID( - QuicString* output) const { + std::string* output) const { // Channel ID is not supported when TLS is used in QUIC. return false; } @@ -189,13 +189,13 @@ } void TlsServerHandshaker::CloseConnection(QuicErrorCode error, - const QuicString& reason_phrase) { + const std::string& reason_phrase) { state_ = STATE_CONNECTION_CLOSED; stream()->CloseConnectionWithDetails(error, reason_phrase); } bool TlsServerHandshaker::ProcessTransportParameters( - QuicString* error_details) { + std::string* error_details) { TransportParameters client_params; const uint8_t* client_params_bytes; size_t params_bytes_len; @@ -352,7 +352,7 @@ CRYPTO_BUFFER_free(certs[i]); } - QuicString error_details; + std::string error_details; if (!ProcessTransportParameters(&error_details)) { CloseConnection(QUIC_HANDSHAKE_FAILED, error_details); *out_alert = SSL_AD_INTERNAL_ERROR;
diff --git a/quic/core/tls_server_handshaker.h b/quic/core/tls_server_handshaker.h index c3efc82..4b38a74 100644 --- a/quic/core/tls_server_handshaker.h +++ b/quic/core/tls_server_handshaker.h
@@ -37,7 +37,7 @@ // From QuicCryptoServerStream::HandshakerDelegate void CancelOutstandingCallbacks() override; - bool GetBase64SHA256ClientChannelID(QuicString* output) const override; + bool GetBase64SHA256ClientChannelID(std::string* output) const override; void SendServerConfigUpdate( const CachedNetworkParameters* cached_network_params) override; uint8_t NumHandshakeMessages() const override; @@ -64,7 +64,7 @@ class SignatureCallback : public ProofSource::SignatureCallback { public: explicit SignatureCallback(TlsServerHandshaker* handshaker); - void Run(bool ok, QuicString signature) override; + void Run(bool ok, std::string signature) override; // If called, Cancel causes the pending callback to be a no-op. void Cancel(); @@ -90,15 +90,15 @@ // for the TLS stack to read. void AdvanceHandshake() override; void CloseConnection(QuicErrorCode error, - const QuicString& reason_phrase) override; + const std::string& reason_phrase) override; // Called when the TLS handshake is complete. void FinishHandshake(); - void CloseConnection(const QuicString& reason_phrase); + void CloseConnection(const std::string& reason_phrase); bool SetTransportParameters(); - bool ProcessTransportParameters(QuicString* error_details); + bool ProcessTransportParameters(std::string* error_details); // Calls the instance method PrivateKeySign after looking up the // TlsServerHandshaker from |ssl|. @@ -154,8 +154,8 @@ ProofSource* proof_source_; SignatureCallback* signature_callback_ = nullptr; - QuicString hostname_; - QuicString cert_verify_sig_; + std::string hostname_; + std::string cert_verify_sig_; bool encryption_established_ = false; bool handshake_confirmed_ = false;
diff --git a/quic/core/uber_quic_stream_id_manager_test.cc b/quic/core/uber_quic_stream_id_manager_test.cc index 353e35d..929d0a1 100644 --- a/quic/core/uber_quic_stream_id_manager_test.cc +++ b/quic/core/uber_quic_stream_id_manager_test.cc
@@ -67,7 +67,8 @@ QuicFrame frame_; }; -INSTANTIATE_TEST_SUITE_P(Tests, UberQuicStreamIdManagerTest, +INSTANTIATE_TEST_SUITE_P(Tests, + UberQuicStreamIdManagerTest, ::testing::ValuesIn({Perspective::IS_CLIENT, Perspective::IS_SERVER})); @@ -218,9 +219,9 @@ EXPECT_TRUE(manager_->MaybeIncreaseLargestPeerStreamId( manager_->actual_max_allowed_incoming_unidirectional_stream_id())); - QuicString error_details = GetParam() == Perspective::IS_SERVER - ? "Stream id 404 above 400" - : "Stream id 401 above 397"; + std::string error_details = GetParam() == Perspective::IS_SERVER + ? "Stream id 404 above 400" + : "Stream id 401 above 397"; EXPECT_CALL(*connection_, CloseConnection(QUIC_INVALID_STREAM_ID, error_details, _)); EXPECT_FALSE(manager_->MaybeIncreaseLargestPeerStreamId(
diff --git a/quic/platform/api/quic_file_utils.cc b/quic/platform/api/quic_file_utils.cc index 5492b83..29ec416 100644 --- a/quic/platform/api/quic_file_utils.cc +++ b/quic/platform/api/quic_file_utils.cc
@@ -10,12 +10,12 @@ // Traverses the directory |dirname| and retuns all of the files // it contains. -std::vector<QuicString> ReadFileContents(const QuicString& dirname) { +std::vector<std::string> ReadFileContents(const std::string& dirname) { return ReadFileContentsImpl(dirname); } // Reads the contents of |filename| as a string into |contents|. -void ReadFileContents(QuicStringPiece filename, QuicString* contents) { +void ReadFileContents(QuicStringPiece filename, std::string* contents) { ReadFileContentsImpl(filename, contents); }
diff --git a/quic/platform/api/quic_file_utils.h b/quic/platform/api/quic_file_utils.h index f010aa5..15eef0f 100644 --- a/quic/platform/api/quic_file_utils.h +++ b/quic/platform/api/quic_file_utils.h
@@ -14,12 +14,12 @@ namespace quic { // Traverses the directory |dirname| and returns all of the files it contains. -QUIC_EXPORT_PRIVATE std::vector<QuicString> ReadFileContents( - const QuicString& dirname); +QUIC_EXPORT_PRIVATE std::vector<std::string> ReadFileContents( + const std::string& dirname); // Reads the contents of |filename| as a string into |contents|. QUIC_EXPORT_PRIVATE void ReadFileContents(QuicStringPiece filename, - QuicString* contents); + std::string* contents); } // namespace quic
diff --git a/quic/platform/api/quic_flags.h b/quic/platform/api/quic_flags.h index 45145a7..50bf4db 100644 --- a/quic/platform/api/quic_flags.h +++ b/quic/platform/api/quic_flags.h
@@ -31,7 +31,7 @@ // the command line specifies '-h' or '--help', prints a usage message with flag // descriptions to stdout and exits with status 0. If a flag has an unparsable // value, writes an error message to stderr and exits with status 1. -inline std::vector<QuicString> QuicParseCommandLineFlags( +inline std::vector<std::string> QuicParseCommandLineFlags( const char* usage, int argc, const char* const* argv) {
diff --git a/quic/platform/api/quic_hostname_utils.cc b/quic/platform/api/quic_hostname_utils.cc index d02529f..b7e4642 100644 --- a/quic/platform/api/quic_hostname_utils.cc +++ b/quic/platform/api/quic_hostname_utils.cc
@@ -12,7 +12,7 @@ } // static -QuicString QuicHostnameUtils::NormalizeHostname(QuicStringPiece hostname) { +std::string QuicHostnameUtils::NormalizeHostname(QuicStringPiece hostname) { return QuicHostnameUtilsImpl::NormalizeHostname(hostname); }
diff --git a/quic/platform/api/quic_hostname_utils.h b/quic/platform/api/quic_hostname_utils.h index 7f2b98a..3b068ee 100644 --- a/quic/platform/api/quic_hostname_utils.h +++ b/quic/platform/api/quic_hostname_utils.h
@@ -25,7 +25,7 @@ // Canonicalizes the specified hostname. This involves a wide variety of // transformations, including lowercasing, removing trailing dots and IDNA // conversion. - static QuicString NormalizeHostname(QuicStringPiece hostname); + static std::string NormalizeHostname(QuicStringPiece hostname); }; } // namespace quic
diff --git a/quic/platform/api/quic_hostname_utils_test.cc b/quic/platform/api/quic_hostname_utils_test.cc index 8523384..8389f7d 100644 --- a/quic/platform/api/quic_hostname_utils_test.cc +++ b/quic/platform/api/quic_hostname_utils_test.cc
@@ -78,7 +78,7 @@ // clang-format on for (size_t i = 0; i < QUIC_ARRAYSIZE(tests); ++i) { - EXPECT_EQ(QuicString(tests[i].expected), + EXPECT_EQ(std::string(tests[i].expected), QuicHostnameUtils::NormalizeHostname(tests[i].input)); } }
diff --git a/quic/platform/api/quic_ip_address.cc b/quic/platform/api/quic_ip_address.cc index bf184dd..8710467 100644 --- a/quic/platform/api/quic_ip_address.cc +++ b/quic/platform/api/quic_ip_address.cc
@@ -45,11 +45,11 @@ return impl_.AddressFamilyToInt(); } -QuicString QuicIpAddress::ToPackedString() const { +std::string QuicIpAddress::ToPackedString() const { return impl_.ToPackedString(); } -QuicString QuicIpAddress::ToString() const { +std::string QuicIpAddress::ToString() const { return impl_.ToString(); } @@ -65,7 +65,7 @@ return impl_.FromPackedString(data, length); } -bool QuicIpAddress::FromString(QuicString str) { +bool QuicIpAddress::FromString(std::string str) { return impl_.FromString(str); }
diff --git a/quic/platform/api/quic_ip_address.h b/quic/platform/api/quic_ip_address.h index a8951df..33bd8fc 100644 --- a/quic/platform/api/quic_ip_address.h +++ b/quic/platform/api/quic_ip_address.h
@@ -42,9 +42,9 @@ int AddressFamilyToInt() const; // Returns the address as a sequence of bytes in network-byte-order. IPv4 will // be 4 bytes. IPv6 will be 16 bytes. - QuicString ToPackedString() const; + std::string ToPackedString() const; // Returns string representation of the address. - QuicString ToString() const; + std::string ToString() const; // Normalizes the address representation with respect to IPv4 addresses, i.e, // mapped IPv4 addresses ("::ffff:X.Y.Z.Q") are converted to pure IPv4 // addresses. All other IPv4, IPv6, and empty values are left unchanged. @@ -56,7 +56,7 @@ // unchanged). QuicIpAddress DualStacked() const; bool FromPackedString(const char* data, size_t length); - bool FromString(QuicString str); + bool FromString(std::string str); bool IsIPv4() const; bool IsIPv6() const; bool InSameSubnet(const QuicIpAddress& other, int subnet_length);
diff --git a/quic/platform/api/quic_mem_slice_storage_test.cc b/quic/platform/api/quic_mem_slice_storage_test.cc index 72623e1..d0c2588 100644 --- a/quic/platform/api/quic_mem_slice_storage_test.cc +++ b/quic/platform/api/quic_mem_slice_storage_test.cc
@@ -22,7 +22,7 @@ TEST_F(QuicMemSliceStorageImplTest, SingleIov) { SimpleBufferAllocator allocator; - QuicString body(3, 'c'); + std::string body(3, 'c'); struct iovec iov = {const_cast<char*>(body.data()), body.length()}; QuicMemSliceStorage storage(&iov, 1, &allocator, 1024); auto span = storage.ToSpan(); @@ -32,8 +32,8 @@ TEST_F(QuicMemSliceStorageImplTest, MultipleIovInSingleSlice) { SimpleBufferAllocator allocator; - QuicString body1(3, 'a'); - QuicString body2(4, 'b'); + std::string body1(3, 'a'); + std::string body2(4, 'b'); struct iovec iov[] = {{const_cast<char*>(body1.data()), body1.length()}, {const_cast<char*>(body2.data()), body2.length()}}; @@ -44,8 +44,8 @@ TEST_F(QuicMemSliceStorageImplTest, MultipleIovInMultipleSlice) { SimpleBufferAllocator allocator; - QuicString body1(4, 'a'); - QuicString body2(4, 'b'); + std::string body1(4, 'a'); + std::string body2(4, 'b'); struct iovec iov[] = {{const_cast<char*>(body1.data()), body1.length()}, {const_cast<char*>(body2.data()), body2.length()}};
diff --git a/quic/platform/api/quic_socket_address.cc b/quic/platform/api/quic_socket_address.cc index fd428e5..982ebf9 100644 --- a/quic/platform/api/quic_socket_address.cc +++ b/quic/platform/api/quic_socket_address.cc
@@ -31,7 +31,7 @@ return impl_.IsInitialized(); } -QuicString QuicSocketAddress::ToString() const { +std::string QuicSocketAddress::ToString() const { return impl_.ToString(); }
diff --git a/quic/platform/api/quic_socket_address.h b/quic/platform/api/quic_socket_address.h index 297387f..21f29e4 100644 --- a/quic/platform/api/quic_socket_address.h +++ b/quic/platform/api/quic_socket_address.h
@@ -31,7 +31,7 @@ const QuicSocketAddress& rhs); bool IsInitialized() const; - QuicString ToString() const; + std::string ToString() const; int FromSocket(int fd); QuicSocketAddress Normalized() const;
diff --git a/quic/platform/api/quic_stack_trace.h b/quic/platform/api/quic_stack_trace.h index 1a1a10c..64411f0 100644 --- a/quic/platform/api/quic_stack_trace.h +++ b/quic/platform/api/quic_stack_trace.h
@@ -10,7 +10,7 @@ namespace quic { -inline QuicString QuicStackTrace() { +inline std::string QuicStackTrace() { return QuicStackTraceImpl(); }
diff --git a/quic/platform/api/quic_str_cat.h b/quic/platform/api/quic_str_cat.h index 1720cfd..d5486db 100644 --- a/quic/platform/api/quic_str_cat.h +++ b/quic/platform/api/quic_str_cat.h
@@ -14,12 +14,12 @@ // Merges given strings or numbers with no delimiter. template <typename... Args> -inline QuicString QuicStrCat(const Args&... args) { +inline std::string QuicStrCat(const Args&... args) { return QuicStrCatImpl(std::forward<const Args&>(args)...); } template <typename... Args> -inline QuicString QuicStringPrintf(const Args&... args) { +inline std::string QuicStringPrintf(const Args&... args) { return QuicStringPrintfImpl(std::forward<const Args&>(args)...); }
diff --git a/quic/platform/api/quic_str_cat_test.cc b/quic/platform/api/quic_str_cat_test.cc index c8f1724..2930adf 100644 --- a/quic/platform/api/quic_str_cat_test.cc +++ b/quic/platform/api/quic_str_cat_test.cc
@@ -25,7 +25,7 @@ const size_t size = 8; const intptr_t intptr = -9; const uintptr_t uintptr = 10; - QuicString answer; + std::string answer; answer = QuicStrCat(s, us); EXPECT_EQ(answer, "-12"); answer = QuicStrCat(i, ui); @@ -41,9 +41,9 @@ } TEST_F(QuicStrCatTest, Basics) { - QuicString result; + std::string result; - QuicString strs[] = {"Hello", "Cruel", "World"}; + std::string strs[] = {"Hello", "Cruel", "World"}; QuicStringPiece pieces[] = {"Hello", "Cruel", "World"}; @@ -82,7 +82,7 @@ result = QuicStrCat(ui64s[0], ", ", ui64s[1], "!"); EXPECT_EQ(result, "12345678910, 10987654321!"); - QuicString one = "1"; + std::string one = "1"; result = QuicStrCat("And a ", one.size(), " and a ", &result[2] - &result[0], " and a ", one, " 2 3 4", "!"); EXPECT_EQ(result, "And a 1 and a 2 and a 1 2 3 4!"); @@ -105,7 +105,7 @@ } TEST_F(QuicStrCatTest, MaxArgs) { - QuicString result; + std::string result; // Test 10 up to 26 arguments, the current maximum result = QuicStrCat(1, 2, 3, 4, 5, 6, 7, 8, 9, "a"); EXPECT_EQ(result, "123456789a");
diff --git a/quic/platform/api/quic_string_utils.h b/quic/platform/api/quic_string_utils.h index ce54d61..76a101c 100644 --- a/quic/platform/api/quic_string_utils.h +++ b/quic/platform/api/quic_string_utils.h
@@ -14,7 +14,7 @@ namespace quic { template <typename... Args> -inline void QuicStrAppend(QuicString* output, const Args&... args) { +inline void QuicStrAppend(std::string* output, const Args&... args) { QuicStrAppendImpl(output, std::forward<const Args&>(args)...); }
diff --git a/quic/platform/api/quic_string_utils_test.cc b/quic/platform/api/quic_string_utils_test.cc index 0d3567c..e2f1300 100644 --- a/quic/platform/api/quic_string_utils_test.cc +++ b/quic/platform/api/quic_string_utils_test.cc
@@ -20,7 +20,7 @@ // Single string-like argument. const char kFoo[] = "foo"; - const QuicString string_foo(kFoo); + const std::string string_foo(kFoo); const QuicStringPiece stringpiece_foo(string_foo); EXPECT_EQ("foo", QuicStrCat(kFoo)); EXPECT_EQ("foo", QuicStrCat(string_foo)); @@ -29,7 +29,7 @@ // Two string-like arguments. const char kBar[] = "bar"; const QuicStringPiece stringpiece_bar(kBar); - const QuicString string_bar(kBar); + const std::string string_bar(kBar); EXPECT_EQ("foobar", QuicStrCat(kFoo, kBar)); EXPECT_EQ("foobar", QuicStrCat(kFoo, string_bar)); EXPECT_EQ("foobar", QuicStrCat(kFoo, stringpiece_bar)); @@ -73,13 +73,13 @@ TEST(QuicStringUtilsTest, QuicStrAppend) { // No arguments on empty string. - QuicString output; + std::string output; QuicStrAppend(&output); EXPECT_TRUE(output.empty()); // Single string-like argument. const char kFoo[] = "foo"; - const QuicString string_foo(kFoo); + const std::string string_foo(kFoo); const QuicStringPiece stringpiece_foo(string_foo); QuicStrAppend(&output, kFoo); EXPECT_EQ("foo", output); @@ -97,7 +97,7 @@ // Two string-like arguments. const char kBar[] = "bar"; const QuicStringPiece stringpiece_bar(kBar); - const QuicString string_bar(kBar); + const std::string string_bar(kBar); QuicStrAppend(&output, kFoo, kBar); EXPECT_EQ("foobar", output); QuicStrAppend(&output, kFoo, string_bar);
diff --git a/quic/platform/api/quic_text_utils.h b/quic/platform/api/quic_text_utils.h index 5bf9890..e6c80d3 100644 --- a/quic/platform/api/quic_text_utils.h +++ b/quic/platform/api/quic_text_utils.h
@@ -25,7 +25,7 @@ } // Returns a new string in which |data| has been converted to lower case. - static QuicString ToLower(QuicStringPiece data) { + static std::string ToLower(QuicStringPiece data) { return QuicTextUtilsImpl::ToLower(data); } @@ -59,38 +59,38 @@ } // Returns a new string representing |in|. - static QuicString Uint64ToString(uint64_t in) { + static std::string Uint64ToString(uint64_t in) { return QuicTextUtilsImpl::Uint64ToString(in); } // This converts |length| bytes of binary to a 2*|length|-character // hexadecimal representation. // Return value: 2*|length| characters of ASCII string. - static QuicString HexEncode(const char* data, size_t length) { + static std::string HexEncode(const char* data, size_t length) { return HexEncode(QuicStringPiece(data, length)); } // This converts |data.length()| bytes of binary to a // 2*|data.length()|-character hexadecimal representation. // Return value: 2*|data.length()| characters of ASCII string. - static QuicString HexEncode(QuicStringPiece data) { + static std::string HexEncode(QuicStringPiece data) { return QuicTextUtilsImpl::HexEncode(data); } // This converts a uint32 into an 8-character hexidecimal // representation. Return value: 8 characters of ASCII string. - static QuicString Hex(uint32_t v) { return QuicTextUtilsImpl::Hex(v); } + static std::string Hex(uint32_t v) { return QuicTextUtilsImpl::Hex(v); } // Converts |data| from a hexadecimal ASCII string to a binary string // that is |data.length()/2| bytes long. - static QuicString HexDecode(QuicStringPiece data) { + static std::string HexDecode(QuicStringPiece data) { return QuicTextUtilsImpl::HexDecode(data); } // Base64 encodes with no padding |data_len| bytes of |data| into |output|. static void Base64Encode(const uint8_t* data, size_t data_len, - QuicString* output) { + std::string* output) { return QuicTextUtilsImpl::Base64Encode(data, data_len, output); } @@ -99,7 +99,7 @@ // printed as '.' in the ASCII output. // For example, given the input "Hello, QUIC!\01\02\03\04", returns: // "0x0000: 4865 6c6c 6f2c 2051 5549 4321 0102 0304 Hello,.QUIC!...." - static QuicString HexDump(QuicStringPiece binary_data) { + static std::string HexDump(QuicStringPiece binary_data) { return QuicTextUtilsImpl::HexDump(binary_data); }
diff --git a/quic/platform/api/quic_text_utils_test.cc b/quic/platform/api/quic_text_utils_test.cc index 820343c..49eb9dc 100644 --- a/quic/platform/api/quic_text_utils_test.cc +++ b/quic/platform/api/quic_text_utils_test.cc
@@ -38,7 +38,7 @@ } TEST_F(QuicTextUtilsTest, RemoveLeadingAndTrailingWhitespace) { - QuicString input; + std::string input; for (auto* input : {"text", " text", " text", "text ", "text ", " text ", " text ", "\r\n\ttext", "text\n\r\t"}) { @@ -49,9 +49,9 @@ } TEST_F(QuicTextUtilsTest, StringToNumbers) { - const QuicString kMaxInt32Plus1 = "2147483648"; - const QuicString kMinInt32Minus1 = "-2147483649"; - const QuicString kMaxUint32Plus1 = "4294967296"; + const std::string kMaxInt32Plus1 = "2147483648"; + const std::string kMinInt32Minus1 = "-2147483649"; + const std::string kMaxUint32Plus1 = "4294967296"; { // StringToUint64 @@ -168,8 +168,8 @@ } TEST_F(QuicTextUtilsTest, Base64Encode) { - QuicString output; - QuicString input = "Hello"; + std::string output; + std::string input = "Hello"; QuicTextUtils::Base64Encode(reinterpret_cast<const uint8_t*>(input.data()), input.length(), &output); EXPECT_EQ("SGVsbG8", output);
diff --git a/quic/platform/api/quic_thread.h b/quic/platform/api/quic_thread.h index 75d541c..77ae2e0 100644 --- a/quic/platform/api/quic_thread.h +++ b/quic/platform/api/quic_thread.h
@@ -13,7 +13,7 @@ // A class representing a thread of execution in QUIC. class QuicThread : public QuicThreadImpl { public: - QuicThread(const QuicString& string) : QuicThreadImpl(string) {} + QuicThread(const std::string& string) : QuicThreadImpl(string) {} QuicThread(const QuicThread&) = delete; QuicThread& operator=(const QuicThread&) = delete;
diff --git a/quic/quartc/counting_packet_filter.h b/quic/quartc/counting_packet_filter.h index 0f67008..9df006c 100644 --- a/quic/quartc/counting_packet_filter.h +++ b/quic/quartc/counting_packet_filter.h
@@ -17,7 +17,7 @@ class CountingPacketFilter : public simulator::PacketFilter { public: CountingPacketFilter(simulator::Simulator* simulator, - const QuicString& name, + const std::string& name, simulator::Endpoint* endpoint) : PacketFilter(simulator, name, endpoint) {}
diff --git a/quic/quartc/quartc_crypto_helpers.cc b/quic/quartc/quartc_crypto_helpers.cc index 865fec4..93023e7 100644 --- a/quic/quartc/quartc_crypto_helpers.cc +++ b/quic/quartc/quartc_crypto_helpers.cc
@@ -10,8 +10,8 @@ namespace quic { void DummyProofSource::GetProof(const QuicSocketAddress& server_address, - const QuicString& hostname, - const QuicString& server_config, + const std::string& hostname, + const std::string& server_config, QuicTransportVersion transport_version, QuicStringPiece chlo_hash, std::unique_ptr<Callback> callback) { @@ -25,8 +25,8 @@ QuicReferenceCountedPointer<DummyProofSource::Chain> DummyProofSource::GetCertChain(const QuicSocketAddress& server_address, - const QuicString& hostname) { - std::vector<QuicString> certs; + const std::string& hostname) { + std::vector<std::string> certs; certs.push_back(kDummyCertName); return QuicReferenceCountedPointer<ProofSource::Chain>( new ProofSource::Chain(certs)); @@ -34,7 +34,7 @@ void DummyProofSource::ComputeTlsSignature( const QuicSocketAddress& server_address, - const QuicString& hostname, + const std::string& hostname, uint16_t signature_algorithm, QuicStringPiece in, std::unique_ptr<SignatureCallback> callback) { @@ -42,26 +42,26 @@ } QuicAsyncStatus InsecureProofVerifier::VerifyProof( - const QuicString& hostname, + const std::string& hostname, const uint16_t port, - const QuicString& server_config, + const std::string& server_config, QuicTransportVersion transport_version, QuicStringPiece chlo_hash, - const std::vector<QuicString>& certs, - const QuicString& cert_sct, - const QuicString& signature, + const std::vector<std::string>& certs, + const std::string& cert_sct, + const std::string& signature, const ProofVerifyContext* context, - QuicString* error_details, + std::string* error_details, std::unique_ptr<ProofVerifyDetails>* verify_details, std::unique_ptr<ProofVerifierCallback> callback) { return QUIC_SUCCESS; } QuicAsyncStatus InsecureProofVerifier::VerifyCertChain( - const QuicString& hostname, - const std::vector<QuicString>& certs, + const std::string& hostname, + const std::vector<std::string>& certs, const ProofVerifyContext* context, - QuicString* error_details, + std::string* error_details, std::unique_ptr<ProofVerifyDetails>* details, std::unique_ptr<ProofVerifierCallback> callback) { return QUIC_SUCCESS; @@ -86,7 +86,7 @@ const QuicSocketAddress& client_address, const QuicSocketAddress& peer_address, const QuicSocketAddress& self_address, - QuicString* error_details) const { + std::string* error_details) const { return true; } @@ -114,7 +114,7 @@ char source_address_token_secret[kInputKeyingMaterialLength]; random->RandBytes(source_address_token_secret, kInputKeyingMaterialLength); auto config = QuicMakeUnique<QuicCryptoServerConfig>( - QuicString(source_address_token_secret, kInputKeyingMaterialLength), + std::string(source_address_token_secret, kInputKeyingMaterialLength), random, QuicMakeUnique<DummyProofSource>(), KeyExchangeSource::Default(), TlsServerHandshaker::CreateSslCtx()); @@ -155,7 +155,7 @@ const QuicData& data = message->GetSerialized(); crypto_server_config.serialized_crypto_config = - QuicString(data.data(), data.length()); + std::string(data.data(), data.length()); return crypto_server_config; }
diff --git a/quic/quartc/quartc_crypto_helpers.h b/quic/quartc/quartc_crypto_helpers.h index 2b280b5..c53a58e 100644 --- a/quic/quartc/quartc_crypto_helpers.h +++ b/quic/quartc/quartc_crypto_helpers.h
@@ -26,7 +26,7 @@ struct CryptoServerConfig { std::unique_ptr<QuicCryptoServerConfig> config; - QuicString serialized_crypto_config; + std::string serialized_crypto_config; }; // Length of HKDF input keying material, equal to its number of bytes. @@ -43,19 +43,19 @@ // ProofSource overrides. void GetProof(const QuicSocketAddress& server_address, - const QuicString& hostname, - const QuicString& server_config, + const std::string& hostname, + const std::string& server_config, QuicTransportVersion transport_version, QuicStringPiece chlo_hash, std::unique_ptr<Callback> callback) override; QuicReferenceCountedPointer<Chain> GetCertChain( const QuicSocketAddress& server_address, - const QuicString& hostname) override; + const std::string& hostname) override; void ComputeTlsSignature( const QuicSocketAddress& server_address, - const QuicString& hostname, + const std::string& hostname, uint16_t signature_algorithm, QuicStringPiece in, std::unique_ptr<SignatureCallback> callback) override; @@ -71,24 +71,24 @@ // ProofVerifier overrides. QuicAsyncStatus VerifyProof( - const QuicString& hostname, + const std::string& hostname, const uint16_t port, - const QuicString& server_config, + const std::string& server_config, QuicTransportVersion transport_version, QuicStringPiece chlo_hash, - const std::vector<QuicString>& certs, - const QuicString& cert_sct, - const QuicString& signature, + const std::vector<std::string>& certs, + const std::string& cert_sct, + const std::string& signature, const ProofVerifyContext* context, - QuicString* error_details, + std::string* error_details, std::unique_ptr<ProofVerifyDetails>* verify_details, std::unique_ptr<ProofVerifierCallback> callback) override; QuicAsyncStatus VerifyCertChain( - const QuicString& hostname, - const std::vector<QuicString>& certs, + const std::string& hostname, + const std::vector<std::string>& certs, const ProofVerifyContext* context, - QuicString* error_details, + std::string* error_details, std::unique_ptr<ProofVerifyDetails>* details, std::unique_ptr<ProofVerifierCallback> callback) override; @@ -106,7 +106,7 @@ const QuicSocketAddress& client_address, const QuicSocketAddress& peer_address, const QuicSocketAddress& self_address, - QuicString* error_details) const override; + std::string* error_details) const override; }; std::unique_ptr<QuicCryptoClientConfig> CreateCryptoClientConfig(
diff --git a/quic/quartc/quartc_dispatcher.h b/quic/quartc/quartc_dispatcher.h index e660107..26b52ac 100644 --- a/quic/quartc/quartc_dispatcher.h +++ b/quic/quartc/quartc_dispatcher.h
@@ -57,7 +57,7 @@ // Members owned by QuartcDispatcher but not QuicDispatcher. std::unique_ptr<QuicConfig> owned_quic_config_; std::unique_ptr<QuicCryptoServerConfig> owned_crypto_config_; - QuicString crypto_config_; + std::string crypto_config_; // Delegate invoked when the dispatcher creates a new session. Delegate* delegate_;
diff --git a/quic/quartc/quartc_endpoint.h b/quic/quartc/quartc_endpoint.h index ee856ea..abf056a 100644 --- a/quic/quartc/quartc_endpoint.h +++ b/quic/quartc/quartc_endpoint.h
@@ -43,7 +43,7 @@ // Called if the endpoint fails to establish a session after a call to // Connect. (The most likely cause is a network idle timeout.) virtual void OnConnectError(QuicErrorCode error, - const QuicString& error_details) = 0; + const std::string& error_details) = 0; }; virtual ~QuartcEndpoint() = default; @@ -97,7 +97,7 @@ QuartcEndpoint::Delegate* delegate_; // Server config. If valid, used to perform a 0-RTT connection. - const QuicString serialized_server_config_; + const std::string serialized_server_config_; // Version manager. May be injected to control version negotiation in tests. std::unique_ptr<QuicVersionManager> version_manager_;
diff --git a/quic/quartc/quartc_factory.h b/quic/quartc/quartc_factory.h index 5496387..d568f52 100644 --- a/quic/quartc/quartc_factory.h +++ b/quic/quartc/quartc_factory.h
@@ -28,7 +28,7 @@ struct QuartcSessionConfig { // If a pre-shared cryptographic key is available for this session, specify it // here. This value will only be used if non-empty. - QuicString pre_shared_key; + std::string pre_shared_key; // The maximum size of the packet can be written with the packet writer. // 1200 bytes by default.
diff --git a/quic/quartc/quartc_fakes.h b/quic/quartc/quartc_fakes.h index 16ff9c7..1719065 100644 --- a/quic/quartc/quartc_fakes.h +++ b/quic/quartc/quartc_fakes.h
@@ -29,7 +29,7 @@ } void OnConnectError(QuicErrorCode error, - const QuicString& error_details) override { + const std::string& error_details) override { LOG(FATAL) << "Unexpected error during QuartcEndpoint::Connect(); error=" << error << ", error_details=" << error_details; } @@ -62,7 +62,7 @@ // Called when connection closes locally, or remotely by peer. void OnConnectionClosed(QuicErrorCode error_code, - const QuicString& error_details, + const std::string& error_details, ConnectionCloseSource source) override { connected_ = false; } @@ -84,7 +84,7 @@ QuartcStream* last_incoming_stream() { return last_incoming_stream_; } // Returns all received messages. - const std::vector<QuicString>& incoming_messages() { + const std::vector<std::string>& incoming_messages() { return incoming_messages_; } @@ -94,7 +94,7 @@ private: QuartcStream* last_incoming_stream_; - std::vector<QuicString> incoming_messages_; + std::vector<std::string> incoming_messages_; bool connected_ = true; QuartcStream::Delegate* stream_delegate_; QuicTime writable_time_ = QuicTime::Zero(); @@ -110,8 +110,8 @@ bool fin) override { size_t bytes_consumed = 0; for (size_t i = 0; i < iov_length; ++i) { - received_data_[stream->id()] += - QuicString(static_cast<const char*>(iov[i].iov_base), iov[i].iov_len); + received_data_[stream->id()] += std::string( + static_cast<const char*>(iov[i].iov_base), iov[i].iov_len); bytes_consumed += iov[i].iov_len; } return bytes_consumed; @@ -124,12 +124,12 @@ void OnBufferChanged(QuartcStream* stream) override {} bool has_data() { return !received_data_.empty(); } - std::map<QuicStreamId, QuicString> data() { return received_data_; } + std::map<QuicStreamId, std::string> data() { return received_data_; } QuicRstStreamErrorCode stream_error(QuicStreamId id) { return errors_[id]; } private: - std::map<QuicStreamId, QuicString> received_data_; + std::map<QuicStreamId, std::string> received_data_; std::map<QuicStreamId, QuicRstStreamErrorCode> errors_; };
diff --git a/quic/quartc/quartc_session.cc b/quic/quartc/quartc_session.cc index 8fa8e96..e5b6952 100644 --- a/quic/quartc/quartc_session.cc +++ b/quic/quartc/quartc_session.cc
@@ -41,7 +41,7 @@ GetNextOutgoingBidirectionalStreamId(), QuicStream::kDefaultPriority)); } -bool QuartcSession::SendOrQueueMessage(QuicString message) { +bool QuartcSession::SendOrQueueMessage(std::string message) { if (!CanSendMessage()) { QUIC_LOG(ERROR) << "Quic session does not support SendMessage"; return false; @@ -182,14 +182,14 @@ } void QuartcSession::OnConnectionClosed(QuicErrorCode error, - const QuicString& error_details, + const std::string& error_details, ConnectionCloseSource source) { QuicSession::OnConnectionClosed(error, error_details, source); DCHECK(session_delegate_); session_delegate_->OnConnectionClosed(error, error_details, source); } -void QuartcSession::CloseConnection(const QuicString& details) { +void QuartcSession::CloseConnection(const std::string& details) { connection_->CloseConnection( QuicErrorCode::QUIC_CONNECTION_CANCELLED, details, ConnectionCloseBehavior::SEND_CONNECTION_CLOSE_PACKET_WITH_NO_ACK); @@ -324,7 +324,7 @@ if (!server_config_.empty()) { QuicCryptoServerConfig::ConfigOptions options; - QuicString error; + std::string error; QuicWallTime now = clock()->WallNow(); QuicCryptoClientConfig::CachedState::ServerConfigState result = client_crypto_config_->LookupOrCreate(server_id)->SetServerConfig( @@ -334,7 +334,7 @@ if (result == QuicCryptoClientConfig::CachedState::SERVER_CONFIG_VALID) { DCHECK_EQ(error, ""); client_crypto_config_->LookupOrCreate(server_id)->SetProof( - std::vector<QuicString>{kDummyCertName}, /*cert_sct=*/"", + std::vector<std::string>{kDummyCertName}, /*cert_sct=*/"", /*chlo_hash=*/"", /*signature=*/"anything"); } else { LOG(DFATAL) << "Unable to set server config, error=" << error;
diff --git a/quic/quartc/quartc_session.h b/quic/quartc/quartc_session.h index 7efa186..35df8b6 100644 --- a/quic/quartc/quartc_session.h +++ b/quic/quartc/quartc_session.h
@@ -48,7 +48,7 @@ // support SendMessage API. Other unexpected errors during send will not be // returned, because messages can be sent later if connection is congestion // controlled. - bool SendOrQueueMessage(QuicString message); + bool SendOrQueueMessage(std::string message); // Returns largest message payload acceptable in SendQuartcMessage. QuicPacketLength GetLargestMessagePayload() const { @@ -69,7 +69,7 @@ void OnCanWrite() override; void OnConnectionClosed(QuicErrorCode error, - const QuicString& error_details, + const std::string& error_details, ConnectionCloseSource source) override; // QuartcSession methods. @@ -84,7 +84,7 @@ // // Cleans up the underlying QuicConnection's state. Closing the connection // makes it safe to delete the QuartcSession. - void CloseConnection(const QuicString& details); + void CloseConnection(const std::string& details); // If the given stream is still open, sends a reset frame to cancel it. // Note: This method cancels a stream by QuicStreamId rather than by pointer @@ -122,7 +122,7 @@ // Called when the connection is closed. This means all of the streams will // be closed and no new streams can be created. virtual void OnConnectionClosed(QuicErrorCode error_code, - const QuicString& error_details, + const std::string& error_details, ConnectionCloseSource source) = 0; // Called when message (sent as SendMessage) is received. @@ -189,7 +189,7 @@ // Queue of pending messages sent by SendQuartcMessage that were not sent // yet or blocked by congestion control. Messages are queued in the order // of sent by SendOrQueueMessage(). - QuicDeque<QuicString> send_message_queue_; + QuicDeque<std::string> send_message_queue_; }; class QuartcClientSession : public QuartcSession, @@ -242,7 +242,7 @@ // Client perspective crypto stream. std::unique_ptr<QuicCryptoClientStream> crypto_stream_; - const QuicString server_config_; + const std::string server_config_; }; class QuartcServerSession : public QuartcSession {
diff --git a/quic/quartc/quartc_session_test.cc b/quic/quartc/quartc_session_test.cc index fad4a8f..fc80c8b 100644 --- a/quic/quartc/quartc_session_test.cc +++ b/quic/quartc/quartc_session_test.cc
@@ -208,7 +208,7 @@ // Send messages from peer 1 to peer 2 until required number of messages // are queued in unsent message queue. - std::vector<QuicString> sent_messages; + std::vector<std::string> sent_messages; while (peer_sending->send_message_queue_size() < queue_size) { sent_messages.push_back( QuicStrCat("Sending message, index=", sent_messages.size())); @@ -229,13 +229,13 @@ ASSERT_TRUE(client_peer_->CanSendMessage()); // Send message of maximum allowed length. - QuicString message_max_long = - QuicString(server_peer_->GetLargestMessagePayload(), 'A'); + std::string message_max_long = + std::string(server_peer_->GetLargestMessagePayload(), 'A'); ASSERT_TRUE(server_peer_->SendOrQueueMessage(message_max_long)); // Send long message which should fail. - QuicString message_too_long = - QuicString(server_peer_->GetLargestMessagePayload() + 1, 'B'); + std::string message_too_long = + std::string(server_peer_->GetLargestMessagePayload() + 1, 'B'); ASSERT_FALSE(server_peer_->SendOrQueueMessage(message_too_long)); // Wait for peer 2 to receive message.
diff --git a/quic/quartc/quartc_stream_test.cc b/quic/quartc/quartc_stream_test.cc index edb0ee0..6fa1076 100644 --- a/quic/quartc/quartc_stream_test.cc +++ b/quic/quartc/quartc_stream_test.cc
@@ -53,7 +53,7 @@ public: MockQuicSession(QuicConnection* connection, const QuicConfig& config, - QuicString* write_buffer) + std::string* write_buffer) : QuicSession(connection, nullptr /*visitor*/, config, @@ -121,7 +121,7 @@ private: // Stores written data from ReliableQuicStreamAdapter. - QuicString* write_buffer_; + std::string* write_buffer_; // Whether data is written to write_buffer_. bool writable_ = true; }; @@ -164,7 +164,7 @@ class MockQuartcStreamDelegate : public QuartcStream::Delegate { public: - MockQuartcStreamDelegate(QuicStreamId id, QuicString* read_buffer) + MockQuartcStreamDelegate(QuicStreamId id, std::string* read_buffer) : id_(id), read_buffer_(read_buffer) {} void OnBufferChanged(QuartcStream* stream) override { @@ -199,7 +199,7 @@ protected: QuicStreamId id_; // Data read by the QuicStream. - QuicString* read_buffer_; + std::string* read_buffer_; // Whether the QuicStream is closed. bool closed_ = false; @@ -258,9 +258,9 @@ std::unique_ptr<MockQuartcStreamDelegate> mock_stream_delegate_; std::unique_ptr<MockQuicSession> session_; // Data written by the ReliableQuicStreamAdapterTest. - QuicString write_buffer_; + std::string write_buffer_; // Data read by the ReliableQuicStreamAdapterTest. - QuicString read_buffer_; + std::string read_buffer_; std::unique_ptr<QuicAlarmFactory> alarm_factory_; std::unique_ptr<QuicConnection> connection_; // Used to implement the QuicConnectionHelperInterface.
diff --git a/quic/quartc/simulated_packet_transport.cc b/quic/quartc/simulated_packet_transport.cc index 5c0d374..8e82d98 100644 --- a/quic/quartc/simulated_packet_transport.cc +++ b/quic/quartc/simulated_packet_transport.cc
@@ -10,8 +10,8 @@ SimulatedQuartcPacketTransport::SimulatedQuartcPacketTransport( Simulator* simulator, - const QuicString& name, - const QuicString& peer_name, + const std::string& name, + const std::string& peer_name, QuicByteCount queue_capacity) : Endpoint(simulator, name), peer_name_(peer_name), @@ -34,7 +34,7 @@ last_packet_number_ = info.packet_number; auto packet = QuicMakeUnique<Packet>(); - packet->contents = QuicString(buffer, buf_len); + packet->contents = std::string(buffer, buf_len); packet->size = buf_len; packet->tx_timestamp = clock_->Now(); packet->source = name();
diff --git a/quic/quartc/simulated_packet_transport.h b/quic/quartc/simulated_packet_transport.h index 1b190a0..5216bbb 100644 --- a/quic/quartc/simulated_packet_transport.h +++ b/quic/quartc/simulated_packet_transport.h
@@ -23,8 +23,8 @@ public Queue::ListenerInterface { public: SimulatedQuartcPacketTransport(Simulator* simulator, - const QuicString& name, - const QuicString& peer_name, + const std::string& name, + const std::string& peer_name, QuicByteCount queue_capacity); // QuartcPacketTransport methods. @@ -67,7 +67,7 @@ QuicPacketNumber last_packet_number() { return last_packet_number_; } private: - QuicString peer_name_; + std::string peer_name_; Delegate* delegate_ = nullptr; Queue egress_queue_; QuicPacketNumber last_packet_number_;
diff --git a/quic/quartc/simulated_packet_transport_test.cc b/quic/quartc/simulated_packet_transport_test.cc index 3fbd18b..cae966f 100644 --- a/quic/quartc/simulated_packet_transport_test.cc +++ b/quic/quartc/simulated_packet_transport_test.cc
@@ -36,7 +36,7 @@ void OnTransportCanWrite() override { while (!packets_to_send_.empty()) { - const QuicString& packet = packets_to_send_.front(); + const std::string& packet = packets_to_send_.front(); if (transport_->Write(packet.data(), packet.size(), QuartcPacketTransport::PacketInfo()) < static_cast<int>(packet.size())) { @@ -51,20 +51,20 @@ packets_received_.emplace_back(data, data_len); } - void AddPacketToSend(const QuicString& packet) { + void AddPacketToSend(const std::string& packet) { packets_to_send_.push(packet); } size_t packets_to_send() { return packets_to_send_.size(); } - const std::vector<QuicString>& packets_received() { + const std::vector<std::string>& packets_received() { return packets_received_; } int write_blocked_count() { return write_blocked_count_; } private: QuartcPacketTransport* const transport_ = nullptr; - std::queue<QuicString> packets_to_send_; - std::vector<QuicString> packets_received_; + std::queue<std::string> packets_to_send_; + std::vector<std::string> packets_received_; int write_blocked_count_ = 0; }; @@ -105,8 +105,8 @@ }; TEST_F(SimulatedPacketTransportTest, OneWayTransmission) { - QuicString packet_1(kDefaultPacketSize, 'a'); - QuicString packet_2(kDefaultPacketSize, 'b'); + std::string packet_1(kDefaultPacketSize, 'a'); + std::string packet_2(kDefaultPacketSize, 'b'); client_delegate_.AddPacketToSend(packet_1); client_delegate_.AddPacketToSend(packet_2); @@ -120,10 +120,10 @@ } TEST_F(SimulatedPacketTransportTest, TwoWayTransmission) { - QuicString packet_1(kDefaultPacketSize, 'a'); - QuicString packet_2(kDefaultPacketSize, 'b'); - QuicString packet_3(kDefaultPacketSize, 'c'); - QuicString packet_4(kDefaultPacketSize, 'd'); + std::string packet_1(kDefaultPacketSize, 'a'); + std::string packet_2(kDefaultPacketSize, 'b'); + std::string packet_3(kDefaultPacketSize, 'c'); + std::string packet_4(kDefaultPacketSize, 'd'); client_delegate_.AddPacketToSend(packet_1); client_delegate_.AddPacketToSend(packet_2); @@ -144,9 +144,9 @@ TEST_F(SimulatedPacketTransportTest, TestWriteBlocked) { // Add 10 packets beyond what fits in the egress queue. - std::vector<QuicString> packets; + std::vector<std::string> packets; for (unsigned int i = 0; i < kDefaultQueueLength + 10; ++i) { - packets.push_back(QuicString(kDefaultPacketSize, 'a' + i)); + packets.push_back(std::string(kDefaultPacketSize, 'a' + i)); client_delegate_.AddPacketToSend(packets.back()); }
diff --git a/quic/test_tools/crypto_test_utils.cc b/quic/test_tools/crypto_test_utils.cc index 7179288..3b13e65 100644 --- a/quic/test_tools/crypto_test_utils.cc +++ b/quic/test_tools/crypto_test_utils.cc
@@ -48,7 +48,7 @@ TestChannelIDKey::~TestChannelIDKey() {} bool TestChannelIDKey::Sign(QuicStringPiece signed_data, - QuicString* out_signature) const { + std::string* out_signature) const { bssl::ScopedEVP_MD_CTX md_ctx; if (EVP_DigestSignInit(md_ctx.get(), nullptr, EVP_sha256(), nullptr, ecdsa_key_.get()) != 1) { @@ -87,12 +87,12 @@ } *out_signature = - QuicString(reinterpret_cast<char*>(signature.get()), kSignatureLength); + std::string(reinterpret_cast<char*>(signature.get()), kSignatureLength); return true; } -QuicString TestChannelIDKey::SerializeKey() const { +std::string TestChannelIDKey::SerializeKey() const { // i2d_PublicKey will produce an ANSI X9.62 public key which, for a P-256 // key, is 0x04 (meaning uncompressed) followed by the x and y field // elements as 32-byte, big-endian numbers. @@ -107,13 +107,13 @@ uint8_t* derp = buf; i2d_PublicKey(ecdsa_key_.get(), &derp); - return QuicString(reinterpret_cast<char*>(buf + 1), kExpectedKeyLength - 1); + return std::string(reinterpret_cast<char*>(buf + 1), kExpectedKeyLength - 1); } TestChannelIDSource::~TestChannelIDSource() {} QuicAsyncStatus TestChannelIDSource::GetChannelIDKey( - const QuicString& hostname, + const std::string& hostname, std::unique_ptr<ChannelIDKey>* channel_id_key, ChannelIDSourceCallback* /*callback*/) { *channel_id_key = QuicMakeUnique<TestChannelIDKey>(HostnameToKey(hostname)); @@ -121,7 +121,7 @@ } // static -EVP_PKEY* TestChannelIDSource::HostnameToKey(const QuicString& hostname) { +EVP_PKEY* TestChannelIDSource::HostnameToKey(const std::string& hostname) { // In order to generate a deterministic key for a given hostname the // hostname is hashed with SHA-256 and the resulting digest is treated as a // big-endian number. The most-significant bit is cleared to ensure that @@ -217,7 +217,7 @@ ~AsyncTestChannelIDSource() override {} // ChannelIDSource implementation. - QuicAsyncStatus GetChannelIDKey(const QuicString& hostname, + QuicAsyncStatus GetChannelIDKey(const std::string& hostname, std::unique_ptr<ChannelIDKey>* channel_id_key, ChannelIDSourceCallback* callback) override { // Synchronous mode. @@ -323,7 +323,7 @@ : generator_(generator) {} void Run( QuicErrorCode error, - const QuicString& error_details, + const std::string& error_details, std::unique_ptr<CryptoHandshakeMessage> message, std::unique_ptr<DiversificationNonce> diversification_nonce, std::unique_ptr<ProofSource::Details> proof_source_details) override { @@ -588,10 +588,10 @@ return std::make_pair(client_i, server_i); } -QuicString GetValueForTag(const CryptoHandshakeMessage& message, QuicTag tag) { +std::string GetValueForTag(const CryptoHandshakeMessage& message, QuicTag tag) { auto it = message.tag_value_map().find(tag); if (it == message.tag_value_map().end()) { - return QuicString(); + return std::string(); } return it->second; } @@ -681,7 +681,7 @@ } private: - const QuicString cert_; + const std::string cert_; const uint64_t hash_; const uint32_t index_; }; @@ -782,10 +782,10 @@ const char kSampleLabel[] = "label"; const char kSampleContext[] = "context"; const size_t kSampleOutputLength = 32; - QuicString client_key_extraction; - QuicString server_key_extraction; - QuicString client_tb_ekm; - QuicString server_tb_ekm; + std::string client_key_extraction; + std::string server_key_extraction; + std::string client_tb_ekm; + std::string server_tb_ekm; EXPECT_TRUE(client->ExportKeyingMaterial(kSampleLabel, kSampleContext, kSampleOutputLength, &client_key_extraction)); @@ -876,12 +876,12 @@ } CryptoHandshakeMessage CreateCHLO( - std::vector<std::pair<QuicString, QuicString>> tags_and_values) { + std::vector<std::pair<std::string, std::string>> tags_and_values) { return CreateCHLO(tags_and_values, -1); } CryptoHandshakeMessage CreateCHLO( - std::vector<std::pair<QuicString, QuicString>> tags_and_values, + std::vector<std::pair<std::string, std::string>> tags_and_values, int minimum_size_bytes) { CryptoHandshakeMessage msg; msg.set_tag(MakeQuicTag('C', 'H', 'L', 'O')); @@ -891,15 +891,15 @@ } for (const auto& tag_and_value : tags_and_values) { - const QuicString& tag = tag_and_value.first; - const QuicString& value = tag_and_value.second; + const std::string& tag = tag_and_value.first; + const std::string& value = tag_and_value.second; const QuicTag quic_tag = ParseTag(tag.c_str()); size_t value_len = value.length(); if (value_len > 0 && value[0] == '#') { // This is ascii encoded hex. - QuicString hex_value = + std::string hex_value = QuicTextUtils::HexDecode(QuicStringPiece(&value[1])); msg.SetStringPiece(quic_tag, hex_value); continue; @@ -997,8 +997,8 @@ // clang-format on } -QuicString GenerateClientNonceHex(const QuicClock* clock, - QuicCryptoServerConfig* crypto_config) { +std::string GenerateClientNonceHex(const QuicClock* clock, + QuicCryptoServerConfig* crypto_config) { QuicCryptoServerConfig::ConfigOptions old_config_options; QuicCryptoServerConfig::ConfigOptions new_config_options; old_config_options.id = "old-config-id"; @@ -1012,13 +1012,13 @@ crypto_config->AddConfig(std::move(primary_config), clock->WallNow())); QuicStringPiece orbit; CHECK(msg->GetStringPiece(kORBT, &orbit)); - QuicString nonce; + std::string nonce; CryptoUtils::GenerateNonce(clock->WallNow(), QuicRandom::GetInstance(), orbit, &nonce); return ("#" + QuicTextUtils::HexEncode(nonce)); } -QuicString GenerateClientPublicValuesHex() { +std::string GenerateClientPublicValuesHex() { char public_value[32]; memset(public_value, 42, sizeof(public_value)); return ("#" + QuicTextUtils::HexEncode(public_value, sizeof(public_value)));
diff --git a/quic/test_tools/crypto_test_utils.h b/quic/test_tools/crypto_test_utils.h index 8421895..0afb2aa 100644 --- a/quic/test_tools/crypto_test_utils.h +++ b/quic/test_tools/crypto_test_utils.h
@@ -47,9 +47,9 @@ // ChannelIDKey implementation. bool Sign(QuicStringPiece signed_data, - QuicString* out_signature) const override; + std::string* out_signature) const override; - QuicString SerializeKey() const override; + std::string SerializeKey() const override; private: bssl::UniquePtr<EVP_PKEY> ecdsa_key_; @@ -62,12 +62,12 @@ // ChannelIDSource implementation. QuicAsyncStatus GetChannelIDKey( - const QuicString& hostname, + const std::string& hostname, std::unique_ptr<ChannelIDKey>* channel_id_key, ChannelIDSourceCallback* /*callback*/) override; private: - static EVP_PKEY* HostnameToKey(const QuicString& hostname); + static EVP_PKEY* HostnameToKey(const std::string& hostname); }; namespace crypto_test_utils { @@ -176,7 +176,7 @@ size_t server_i); // Returns the value for the tag |tag| in the tag value map of |message|. -QuicString GetValueForTag(const CryptoHandshakeMessage& message, QuicTag tag); +std::string GetValueForTag(const CryptoHandshakeMessage& message, QuicTag tag); // Returns a new |ProofSource| that serves up test certificates. std::unique_ptr<ProofSource> ProofSourceForTesting(); @@ -218,9 +218,9 @@ // {"SNI", "www.example.com"}}, // optional_minimum_size_bytes); CryptoHandshakeMessage CreateCHLO( - std::vector<std::pair<QuicString, QuicString>> tags_and_values); + std::vector<std::pair<std::string, std::string>> tags_and_values); CryptoHandshakeMessage CreateCHLO( - std::vector<std::pair<QuicString, QuicString>> tags_and_values, + std::vector<std::pair<std::string, std::string>> tags_and_values, int minimum_size_bytes); // ChannelIDSourceForTesting returns a ChannelIDSource that generates keys @@ -262,11 +262,11 @@ QuicCryptoServerStream* server); // Return a CHLO nonce in hexadecimal. -QuicString GenerateClientNonceHex(const QuicClock* clock, - QuicCryptoServerConfig* crypto_config); +std::string GenerateClientNonceHex(const QuicClock* clock, + QuicCryptoServerConfig* crypto_config); // Return a CHLO PUBS in hexadecimal. -QuicString GenerateClientPublicValuesHex(); +std::string GenerateClientPublicValuesHex(); } // namespace crypto_test_utils
diff --git a/quic/test_tools/crypto_test_utils_test.cc b/quic/test_tools/crypto_test_utils_test.cc index cecdaa2..19fdfbb 100644 --- a/quic/test_tools/crypto_test_utils_test.cc +++ b/quic/test_tools/crypto_test_utils_test.cc
@@ -73,7 +73,7 @@ : shlo_verifier_(shlo_verifier) {} void Run( QuicErrorCode error, - const QuicString& error_details, + const std::string& error_details, std::unique_ptr<CryptoHandshakeMessage> message, std::unique_ptr<DiversificationNonce> diversification_nonce, std::unique_ptr<ProofSource::Details> proof_source_details) override { @@ -135,14 +135,14 @@ crypto_config.AddConfig(std::move(primary_config), clock.WallNow())); QuicStringPiece orbit; ASSERT_TRUE(msg->GetStringPiece(kORBT, &orbit)); - QuicString nonce; + std::string nonce; CryptoUtils::GenerateNonce(clock.WallNow(), QuicRandom::GetInstance(), orbit, &nonce); - QuicString nonce_hex = "#" + QuicTextUtils::HexEncode(nonce); + std::string nonce_hex = "#" + QuicTextUtils::HexEncode(nonce); char public_value[32]; memset(public_value, 42, sizeof(public_value)); - QuicString pub_hex = + std::string pub_hex = "#" + QuicTextUtils::HexEncode(public_value, sizeof(public_value)); QuicTransportVersion version(AllSupportedTransportVersions().front());
diff --git a/quic/test_tools/failing_proof_source.cc b/quic/test_tools/failing_proof_source.cc index 2db5717..339b793 100644 --- a/quic/test_tools/failing_proof_source.cc +++ b/quic/test_tools/failing_proof_source.cc
@@ -8,8 +8,8 @@ namespace test { void FailingProofSource::GetProof(const QuicSocketAddress& server_address, - const QuicString& hostname, - const QuicString& server_config, + const std::string& hostname, + const std::string& server_config, QuicTransportVersion transport_version, QuicStringPiece chlo_hash, std::unique_ptr<Callback> callback) { @@ -18,13 +18,13 @@ QuicReferenceCountedPointer<ProofSource::Chain> FailingProofSource::GetCertChain(const QuicSocketAddress& server_address, - const QuicString& hostname) { + const std::string& hostname) { return QuicReferenceCountedPointer<Chain>(); } void FailingProofSource::ComputeTlsSignature( const QuicSocketAddress& server_address, - const QuicString& hostname, + const std::string& hostname, uint16_t signature_algorithm, QuicStringPiece in, std::unique_ptr<SignatureCallback> callback) {
diff --git a/quic/test_tools/failing_proof_source.h b/quic/test_tools/failing_proof_source.h index 4427c4c..10f9971 100644 --- a/quic/test_tools/failing_proof_source.h +++ b/quic/test_tools/failing_proof_source.h
@@ -14,19 +14,19 @@ class FailingProofSource : public ProofSource { public: void GetProof(const QuicSocketAddress& server_address, - const QuicString& hostname, - const QuicString& server_config, + const std::string& hostname, + const std::string& server_config, QuicTransportVersion transport_version, QuicStringPiece chlo_hash, std::unique_ptr<Callback> callback) override; QuicReferenceCountedPointer<Chain> GetCertChain( const QuicSocketAddress& server_address, - const QuicString& hostname) override; + const std::string& hostname) override; void ComputeTlsSignature( const QuicSocketAddress& server_address, - const QuicString& hostname, + const std::string& hostname, uint16_t signature_algorithm, QuicStringPiece in, std::unique_ptr<SignatureCallback> callback) override;
diff --git a/quic/test_tools/fake_proof_source.cc b/quic/test_tools/fake_proof_source.cc index 3a02cd5..8f1cd37 100644 --- a/quic/test_tools/fake_proof_source.cc +++ b/quic/test_tools/fake_proof_source.cc
@@ -20,10 +20,10 @@ FakeProofSource::GetProofOp::GetProofOp( const QuicSocketAddress& server_addr, - QuicString hostname, - QuicString server_config, + std::string hostname, + std::string server_config, QuicTransportVersion transport_version, - QuicString chlo_hash, + std::string chlo_hash, std::unique_ptr<ProofSource::Callback> callback, ProofSource* delegate) : server_address_(server_addr), @@ -44,7 +44,7 @@ FakeProofSource::ComputeSignatureOp::ComputeSignatureOp( const QuicSocketAddress& server_address, - QuicString hostname, + std::string hostname, uint16_t sig_alg, QuicStringPiece in, std::unique_ptr<ProofSource::SignatureCallback> callback, @@ -69,8 +69,8 @@ void FakeProofSource::GetProof( const QuicSocketAddress& server_address, - const QuicString& hostname, - const QuicString& server_config, + const std::string& hostname, + const std::string& server_config, QuicTransportVersion transport_version, QuicStringPiece chlo_hash, std::unique_ptr<ProofSource::Callback> callback) { @@ -82,18 +82,18 @@ pending_ops_.push_back(QuicMakeUnique<GetProofOp>( server_address, hostname, server_config, transport_version, - QuicString(chlo_hash), std::move(callback), delegate_.get())); + std::string(chlo_hash), std::move(callback), delegate_.get())); } QuicReferenceCountedPointer<ProofSource::Chain> FakeProofSource::GetCertChain( const QuicSocketAddress& server_address, - const QuicString& hostname) { + const std::string& hostname) { return delegate_->GetCertChain(server_address, hostname); } void FakeProofSource::ComputeTlsSignature( const QuicSocketAddress& server_address, - const QuicString& hostname, + const std::string& hostname, uint16_t signature_algorithm, QuicStringPiece in, std::unique_ptr<ProofSource::SignatureCallback> callback) {
diff --git a/quic/test_tools/fake_proof_source.h b/quic/test_tools/fake_proof_source.h index 27f63a3..62c3b29 100644 --- a/quic/test_tools/fake_proof_source.h +++ b/quic/test_tools/fake_proof_source.h
@@ -32,17 +32,17 @@ // ProofSource interface void GetProof(const QuicSocketAddress& server_address, - const QuicString& hostname, - const QuicString& server_config, + const std::string& hostname, + const std::string& server_config, QuicTransportVersion transport_version, QuicStringPiece chlo_hash, std::unique_ptr<ProofSource::Callback> callback) override; QuicReferenceCountedPointer<Chain> GetCertChain( const QuicSocketAddress& server_address, - const QuicString& hostname) override; + const std::string& hostname) override; void ComputeTlsSignature( const QuicSocketAddress& server_address, - const QuicString& hostname, + const std::string& hostname, uint16_t signature_algorithm, QuicStringPiece in, std::unique_ptr<ProofSource::SignatureCallback> callback) override; @@ -67,10 +67,10 @@ class GetProofOp : public PendingOp { public: GetProofOp(const QuicSocketAddress& server_addr, - QuicString hostname, - QuicString server_config, + std::string hostname, + std::string server_config, QuicTransportVersion transport_version, - QuicString chlo_hash, + std::string chlo_hash, std::unique_ptr<ProofSource::Callback> callback, ProofSource* delegate); ~GetProofOp() override; @@ -79,10 +79,10 @@ private: QuicSocketAddress server_address_; - QuicString hostname_; - QuicString server_config_; + std::string hostname_; + std::string server_config_; QuicTransportVersion transport_version_; - QuicString chlo_hash_; + std::string chlo_hash_; std::unique_ptr<ProofSource::Callback> callback_; ProofSource* delegate_; }; @@ -90,7 +90,7 @@ class ComputeSignatureOp : public PendingOp { public: ComputeSignatureOp(const QuicSocketAddress& server_address, - QuicString hostname, + std::string hostname, uint16_t sig_alg, QuicStringPiece in, std::unique_ptr<ProofSource::SignatureCallback> callback, @@ -101,9 +101,9 @@ private: QuicSocketAddress server_address_; - QuicString hostname_; + std::string hostname_; uint16_t sig_alg_; - QuicString in_; + std::string in_; std::unique_ptr<ProofSource::SignatureCallback> callback_; ProofSource* delegate_; };
diff --git a/quic/test_tools/mock_quic_client_promised_info.cc b/quic/test_tools/mock_quic_client_promised_info.cc index 4400b03..5b78104 100644 --- a/quic/test_tools/mock_quic_client_promised_info.cc +++ b/quic/test_tools/mock_quic_client_promised_info.cc
@@ -10,7 +10,7 @@ MockQuicClientPromisedInfo::MockQuicClientPromisedInfo( QuicSpdyClientSessionBase* session, QuicStreamId id, - QuicString url) + std::string url) : QuicClientPromisedInfo(session, id, url) {} MockQuicClientPromisedInfo::~MockQuicClientPromisedInfo() {}
diff --git a/quic/test_tools/mock_quic_client_promised_info.h b/quic/test_tools/mock_quic_client_promised_info.h index a157ac5..5b718c0 100644 --- a/quic/test_tools/mock_quic_client_promised_info.h +++ b/quic/test_tools/mock_quic_client_promised_info.h
@@ -19,7 +19,7 @@ public: MockQuicClientPromisedInfo(QuicSpdyClientSessionBase* session, QuicStreamId id, - QuicString url); + std::string url); ~MockQuicClientPromisedInfo() override; MOCK_METHOD2(HandleClientRequest,
diff --git a/quic/test_tools/mock_quic_session_visitor.h b/quic/test_tools/mock_quic_session_visitor.h index fb01da6..31f4eaa 100644 --- a/quic/test_tools/mock_quic_session_visitor.h +++ b/quic/test_tools/mock_quic_session_visitor.h
@@ -22,7 +22,7 @@ MOCK_METHOD4(OnConnectionClosed, void(QuicConnectionId connection_id, QuicErrorCode error, - const QuicString& error_details, + const std::string& error_details, ConnectionCloseSource source)); MOCK_METHOD1(OnWriteBlocked, void(QuicBlockedWriterInterface* blocked_writer)); @@ -48,7 +48,7 @@ const QuicSocketAddress& client_address, const QuicSocketAddress& peer_address, const QuicSocketAddress& self_address, - QuicString* error_details)); + std::string* error_details)); }; } // namespace test
diff --git a/quic/test_tools/packet_dropping_test_writer.h b/quic/test_tools/packet_dropping_test_writer.h index 9537944..2843979 100644 --- a/quic/test_tools/packet_dropping_test_writer.h +++ b/quic/test_tools/packet_dropping_test_writer.h
@@ -141,7 +141,7 @@ DelayedWrite& operator=(DelayedWrite&&) = default; ~DelayedWrite(); - QuicString buffer; + std::string buffer; QuicIpAddress self_address; QuicSocketAddress peer_address; std::unique_ptr<PerPacketOptions> options;
diff --git a/quic/test_tools/packet_reordering_writer.cc b/quic/test_tools/packet_reordering_writer.cc index a8385d8..5fa5659 100644 --- a/quic/test_tools/packet_reordering_writer.cc +++ b/quic/test_tools/packet_reordering_writer.cc
@@ -33,7 +33,7 @@ } // Still have packet to wait. DCHECK_LT(0u, num_packets_to_wait_) << "Only allow one packet to be delayed"; - delayed_data_ = QuicString(buffer, buf_len); + delayed_data_ = std::string(buffer, buf_len); delayed_self_address_ = self_address; delayed_peer_address_ = peer_address; if (options != nullptr) {
diff --git a/quic/test_tools/packet_reordering_writer.h b/quic/test_tools/packet_reordering_writer.h index ec49269..31cbd80 100644 --- a/quic/test_tools/packet_reordering_writer.h +++ b/quic/test_tools/packet_reordering_writer.h
@@ -33,7 +33,7 @@ private: bool delay_next_ = false; size_t num_packets_to_wait_ = 0; - QuicString delayed_data_; + std::string delayed_data_; QuicIpAddress delayed_self_address_; QuicSocketAddress delayed_peer_address_; std::unique_ptr<PerPacketOptions> delayed_options_;
diff --git a/quic/test_tools/quic_crypto_server_config_peer.cc b/quic/test_tools/quic_crypto_server_config_peer.cc index 048e6bb..be2d338 100644 --- a/quic/test_tools/quic_crypto_server_config_peer.cc +++ b/quic/test_tools/quic_crypto_server_config_peer.cc
@@ -19,7 +19,7 @@ } QuicReferenceCountedPointer<QuicCryptoServerConfig::Config> -QuicCryptoServerConfigPeer::GetConfig(QuicString config_id) { +QuicCryptoServerConfigPeer::GetConfig(std::string config_id) { QuicReaderMutexLock locked(&server_config_->configs_lock_); if (config_id == "<primary>") { return QuicReferenceCountedPointer<QuicCryptoServerConfig::Config>( @@ -38,8 +38,8 @@ server_config_->proof_source_ = std::move(proof_source); } -QuicString QuicCryptoServerConfigPeer::NewSourceAddressToken( - QuicString config_id, +std::string QuicCryptoServerConfigPeer::NewSourceAddressToken( + std::string config_id, SourceAddressTokens previous_tokens, const QuicIpAddress& ip, QuicRandom* rand, @@ -51,7 +51,7 @@ } HandshakeFailureReason QuicCryptoServerConfigPeer::ValidateSourceAddressTokens( - QuicString config_id, + std::string config_id, QuicStringPiece srct, const QuicIpAddress& ip, QuicWallTime now, @@ -84,7 +84,7 @@ } void QuicCryptoServerConfigPeer::CheckConfigs( - std::vector<std::pair<QuicString, bool>> expected_ids_and_status) { + std::vector<std::pair<std::string, bool>> expected_ids_and_status) { QuicReaderMutexLock locked(&server_config_->configs_lock_); ASSERT_EQ(expected_ids_and_status.size(), server_config_->configs_.size()) @@ -109,14 +109,14 @@ } } -// ConfigsDebug returns a QuicString that contains debugging information about +// ConfigsDebug returns a std::string that contains debugging information about // the set of Configs loaded in |server_config_| and their status. -QuicString QuicCryptoServerConfigPeer::ConfigsDebug() { +std::string QuicCryptoServerConfigPeer::ConfigsDebug() { if (server_config_->configs_.empty()) { return "No Configs in QuicCryptoServerConfig"; } - QuicString s; + std::string s; for (const auto& i : server_config_->configs_) { const QuicReferenceCountedPointer<QuicCryptoServerConfig::Config> config = @@ -139,11 +139,11 @@ QuicWallTime::FromUNIXSeconds(seconds)); } -QuicString QuicCryptoServerConfigPeer::CompressChain( +std::string QuicCryptoServerConfigPeer::CompressChain( QuicCompressedCertsCache* compressed_certs_cache, const QuicReferenceCountedPointer<ProofSource::Chain>& chain, - const QuicString& client_common_set_hashes, - const QuicString& client_cached_cert_hashes, + const std::string& client_common_set_hashes, + const std::string& client_cached_cert_hashes, const CommonCertSets* common_sets) { return QuicCryptoServerConfig::CompressChain( compressed_certs_cache, chain, client_common_set_hashes,
diff --git a/quic/test_tools/quic_crypto_server_config_peer.h b/quic/test_tools/quic_crypto_server_config_peer.h index 0034c4b..3f5a984 100644 --- a/quic/test_tools/quic_crypto_server_config_peer.h +++ b/quic/test_tools/quic_crypto_server_config_peer.h
@@ -23,7 +23,7 @@ // Returns the config associated with |config_id|. QuicReferenceCountedPointer<QuicCryptoServerConfig::Config> GetConfig( - QuicString config_id); + std::string config_id); // Returns a pointer to the ProofSource object. ProofSource* GetProofSource() const; @@ -32,8 +32,8 @@ void ResetProofSource(std::unique_ptr<ProofSource> proof_source); // Generates a new valid source address token. - QuicString NewSourceAddressToken( - QuicString config_id, + std::string NewSourceAddressToken( + std::string config_id, SourceAddressTokens previous_tokens, const QuicIpAddress& ip, QuicRandom* rand, @@ -42,7 +42,7 @@ // Attempts to validate the tokens in |tokens|. HandshakeFailureReason ValidateSourceAddressTokens( - QuicString config_id, + std::string config_id, QuicStringPiece tokens, const QuicIpAddress& ip, QuicWallTime now, @@ -70,18 +70,18 @@ void CheckConfigs( std::vector<std::pair<ServerConfigID, bool>> expected_ids_and_status); - // ConfigsDebug returns a QuicString that contains debugging information about - // the set of Configs loaded in |server_config_| and their status. - QuicString ConfigsDebug() + // ConfigsDebug returns a std::string that contains debugging information + // about the set of Configs loaded in |server_config_| and their status. + std::string ConfigsDebug() SHARED_LOCKS_REQUIRED(server_config_->configs_lock_); void SelectNewPrimaryConfig(int seconds); - static QuicString CompressChain( + static std::string CompressChain( QuicCompressedCertsCache* compressed_certs_cache, const QuicReferenceCountedPointer<ProofSource::Chain>& chain, - const QuicString& client_common_set_hashes, - const QuicString& client_cached_cert_hashes, + const std::string& client_common_set_hashes, + const std::string& client_cached_cert_hashes, const CommonCertSets* common_sets); uint32_t source_address_token_future_secs();
diff --git a/quic/test_tools/quic_stream_sequencer_buffer_peer.cc b/quic/test_tools/quic_stream_sequencer_buffer_peer.cc index 9c96c82..36d2b04 100644 --- a/quic/test_tools/quic_stream_sequencer_buffer_peer.cc +++ b/quic/test_tools/quic_stream_sequencer_buffer_peer.cc
@@ -27,7 +27,7 @@ iovec dest; dest.iov_base = dest_buffer, dest.iov_len = size; size_t bytes_read; - QuicString error_details; + std::string error_details; EXPECT_EQ(QUIC_NO_ERROR, buffer_->Readv(&dest, 1, &bytes_read, &error_details)); return bytes_read;
diff --git a/quic/test_tools/quic_test_client.cc b/quic/test_tools/quic_test_client.cc index a0068d5..fb76f7a 100644 --- a/quic/test_tools/quic_test_client.cc +++ b/quic/test_tools/quic_test_client.cc
@@ -44,16 +44,16 @@ // ProofVerifier interface. QuicAsyncStatus VerifyProof( - const QuicString& hostname, + const std::string& hostname, const uint16_t port, - const QuicString& server_config, + const std::string& server_config, QuicTransportVersion transport_version, QuicStringPiece chlo_hash, - const std::vector<QuicString>& certs, - const QuicString& cert_sct, - const QuicString& signature, + const std::vector<std::string>& certs, + const std::string& cert_sct, + const std::string& signature, const ProofVerifyContext* context, - QuicString* error_details, + std::string* error_details, std::unique_ptr<ProofVerifyDetails>* details, std::unique_ptr<ProofVerifierCallback> callback) override { common_name_.clear(); @@ -90,10 +90,10 @@ } QuicAsyncStatus VerifyCertChain( - const QuicString& hostname, - const std::vector<QuicString>& certs, + const std::string& hostname, + const std::vector<std::string>& certs, const ProofVerifyContext* context, - QuicString* error_details, + std::string* error_details, std::unique_ptr<ProofVerifyDetails>* details, std::unique_ptr<ProofVerifierCallback> callback) override { return QUIC_SUCCESS; @@ -103,14 +103,14 @@ return verifier_ != nullptr ? verifier_->CreateDefaultContext() : nullptr; } - const QuicString& common_name() const { return common_name_; } + const std::string& common_name() const { return common_name_; } - const QuicString& cert_sct() const { return cert_sct_; } + const std::string& cert_sct() const { return cert_sct_; } private: std::unique_ptr<ProofVerifier> verifier_; - QuicString common_name_; - QuicString cert_sct_; + std::string common_name_; + std::string cert_sct_; }; } // namespace @@ -256,7 +256,7 @@ QuicTestClient::QuicTestClient( QuicSocketAddress server_address, - const QuicString& server_hostname, + const std::string& server_hostname, const ParsedQuicVersionVector& supported_versions) : QuicTestClient(server_address, server_hostname, @@ -265,7 +265,7 @@ QuicTestClient::QuicTestClient( QuicSocketAddress server_address, - const QuicString& server_hostname, + const std::string& server_hostname, const QuicConfig& config, const ParsedQuicVersionVector& supported_versions) : client_(new MockableQuicClient( @@ -279,7 +279,7 @@ QuicTestClient::QuicTestClient( QuicSocketAddress server_address, - const QuicString& server_hostname, + const std::string& server_hostname, const QuicConfig& config, const ParsedQuicVersionVector& supported_versions, std::unique_ptr<ProofVerifier> proof_verifier) @@ -316,11 +316,11 @@ } } -void QuicTestClient::SetUserAgentID(const QuicString& user_agent_id) { +void QuicTestClient::SetUserAgentID(const std::string& user_agent_id) { client_->SetUserAgentID(user_agent_id); } -ssize_t QuicTestClient::SendRequest(const QuicString& uri) { +ssize_t QuicTestClient::SendRequest(const std::string& uri) { spdy::SpdyHeaderBlock headers; if (!PopulateHeaderBlockFromUrl(uri, &headers)) { return 0; @@ -328,7 +328,7 @@ return SendMessage(headers, ""); } -ssize_t QuicTestClient::SendRequestAndRstTogether(const QuicString& uri) { +ssize_t QuicTestClient::SendRequestAndRstTogether(const std::string& uri) { spdy::SpdyHeaderBlock headers; if (!PopulateHeaderBlockFromUrl(uri, &headers)) { return 0; @@ -346,8 +346,8 @@ } void QuicTestClient::SendRequestsAndWaitForResponses( - const std::vector<QuicString>& url_list) { - for (const QuicString& url : url_list) { + const std::vector<std::string>& url_list) { + for (const std::string& url : url_list) { SendRequest(url); } while (client()->WaitForEvents()) { @@ -393,7 +393,7 @@ ret = stream->SendRequest(std::move(spdy_headers), body, fin); ++num_requests_; } else { - stream->WriteOrBufferBody(QuicString(body), fin); + stream->WriteOrBufferBody(std::string(body), fin); ret = body.length(); } if (GetQuicReloadableFlag(enable_quic_stateless_reject_support)) { @@ -435,12 +435,12 @@ return ret; } -ssize_t QuicTestClient::SendData(const QuicString& data, bool last_data) { +ssize_t QuicTestClient::SendData(const std::string& data, bool last_data) { return SendData(data, last_data, nullptr); } ssize_t QuicTestClient::SendData( - const QuicString& data, + const std::string& data, bool last_data, QuicReferenceCountedPointer<QuicAckListenerInterface> ack_listener) { return GetOrCreateStreamAndSendRequest(nullptr, QuicStringPiece(data), @@ -463,13 +463,13 @@ buffer_body_ = buffer_body; } -const QuicString& QuicTestClient::response_body() const { +const std::string& QuicTestClient::response_body() const { return response_; } -QuicString QuicTestClient::SendCustomSynchronousRequest( +std::string QuicTestClient::SendCustomSynchronousRequest( const spdy::SpdyHeaderBlock& headers, - const QuicString& body) { + const std::string& body) { // Clear connection state here and only track this synchronous request. ClearPerConnectionState(); if (SendMessage(headers, body) == 0) { @@ -483,7 +483,7 @@ return response_; } -QuicString QuicTestClient::SendSynchronousRequest(const QuicString& uri) { +std::string QuicTestClient::SendSynchronousRequest(const std::string& uri) { spdy::SpdyHeaderBlock headers; if (!PopulateHeaderBlockFromUrl(uri, &headers)) { return ""; @@ -535,12 +535,12 @@ return client_.get(); } -const QuicString& QuicTestClient::cert_common_name() const { +const std::string& QuicTestClient::cert_common_name() const { return reinterpret_cast<RecordingProofVerifier*>(client_->proof_verifier()) ->common_name(); } -const QuicString& QuicTestClient::cert_sct() const { +const std::string& QuicTestClient::cert_sct() const { return reinterpret_cast<RecordingProofVerifier*>(client_->proof_verifier()) ->cert_sct(); } @@ -637,7 +637,7 @@ } ssize_t QuicTestClient::Send(const void* buffer, size_t size) { - return SendData(QuicString(static_cast<const char*>(buffer), size), false); + return SendData(std::string(static_cast<const char*>(buffer), size), false); } bool QuicTestClient::response_headers_complete() const { @@ -829,7 +829,7 @@ bool response_headers_complete, const spdy::SpdyHeaderBlock& response_headers, const spdy::SpdyHeaderBlock& preliminary_headers, - const QuicString& response, + const std::string& response, const spdy::SpdyHeaderBlock& response_trailers, uint64_t bytes_read, uint64_t bytes_written, @@ -848,9 +848,9 @@ QuicTestClient::PerStreamState::~PerStreamState() = default; bool QuicTestClient::PopulateHeaderBlockFromUrl( - const QuicString& uri, + const std::string& uri, spdy::SpdyHeaderBlock* headers) { - QuicString url; + std::string url; if (QuicTextUtils::StartsWith(uri, "https://") || QuicTextUtils::StartsWith(uri, "http://")) { url = uri;
diff --git a/quic/test_tools/quic_test_client.h b/quic/test_tools/quic_test_client.h index f9cc532..0967271 100644 --- a/quic/test_tools/quic_test_client.h +++ b/quic/test_tools/quic_test_client.h
@@ -81,14 +81,14 @@ public QuicClientPushPromiseIndex::Delegate { public: QuicTestClient(QuicSocketAddress server_address, - const QuicString& server_hostname, + const std::string& server_hostname, const ParsedQuicVersionVector& supported_versions); QuicTestClient(QuicSocketAddress server_address, - const QuicString& server_hostname, + const std::string& server_hostname, const QuicConfig& config, const ParsedQuicVersionVector& supported_versions); QuicTestClient(QuicSocketAddress server_address, - const QuicString& server_hostname, + const std::string& server_hostname, const QuicConfig& config, const ParsedQuicVersionVector& supported_versions, std::unique_ptr<ProofVerifier> proof_verifier); @@ -96,25 +96,26 @@ ~QuicTestClient() override; // Sets the |user_agent_id| of the |client_|. - void SetUserAgentID(const QuicString& user_agent_id); + void SetUserAgentID(const std::string& user_agent_id); // Wraps data in a quic packet and sends it. - ssize_t SendData(const QuicString& data, bool last_data); + ssize_t SendData(const std::string& data, bool last_data); // As above, but |delegate| will be notified when |data| is ACKed. ssize_t SendData( - const QuicString& data, + const std::string& data, bool last_data, QuicReferenceCountedPointer<QuicAckListenerInterface> ack_listener); // Clears any outstanding state and sends a simple GET of 'uri' to the // server. Returns 0 if the request failed and no bytes were written. - ssize_t SendRequest(const QuicString& uri); + ssize_t SendRequest(const std::string& uri); // Send a request R and a RST_FRAME which resets R, in the same packet. - ssize_t SendRequestAndRstTogether(const QuicString& uri); + ssize_t SendRequestAndRstTogether(const std::string& uri); // Sends requests for all the urls and waits for the responses. To process // the individual responses as they are returned, the caller should use the // set the response_listener on the client(). - void SendRequestsAndWaitForResponses(const std::vector<QuicString>& url_list); + void SendRequestsAndWaitForResponses( + const std::vector<std::string>& url_list); // Sends a request containing |headers| and |body| and returns the number of // bytes sent (the size of the serialized request headers and body). ssize_t SendMessage(const spdy::SpdyHeaderBlock& headers, @@ -135,11 +136,11 @@ bool flush); // Sends a request containing |headers| and |body|, waits for the response, // and returns the response body. - QuicString SendCustomSynchronousRequest(const spdy::SpdyHeaderBlock& headers, - const QuicString& body); + std::string SendCustomSynchronousRequest(const spdy::SpdyHeaderBlock& headers, + const std::string& body); // Sends a GET request for |uri|, waits for the response, and returns the // response body. - QuicString SendSynchronousRequest(const QuicString& uri); + std::string SendSynchronousRequest(const std::string& uri); void SendConnectivityProbing(); void Connect(); void ResetConnection(); @@ -160,7 +161,7 @@ const spdy::SpdyHeaderBlock& response_trailers() const; bool response_complete() const; int64_t response_body_size() const; - const QuicString& response_body() const; + const std::string& response_body() const; // Group 2. bool response_headers_complete() const; const spdy::SpdyHeaderBlock* response_headers() const; @@ -241,12 +242,12 @@ MockableQuicClient* client(); // cert_common_name returns the common name value of the server's certificate, - // or the empty QuicString if no certificate was presented. - const QuicString& cert_common_name() const; + // or the empty std::string if no certificate was presented. + const std::string& cert_common_name() const; // cert_sct returns the signed timestamp of the server's certificate, - // or the empty QuicString if no signed timestamp was presented. - const QuicString& cert_sct() const; + // or the empty std::string if no signed timestamp was presented. + const std::string& cert_sct() const; // Get the server config map. QuicTagValueMap GetServerConfig() const; @@ -273,7 +274,7 @@ // Explicitly set the SNI value for this client, overriding the default // behavior which extracts the SNI value from the request URL. - void OverrideSni(const QuicString& sni) { + void OverrideSni(const std::string& sni) { override_sni_set_ = true; override_sni_ = sni; } @@ -285,7 +286,7 @@ // Given |uri|, populates the fields in |headers| for a simple GET // request. If |uri| is a relative URL, the QuicServerId will be // use to specify the authority. - bool PopulateHeaderBlockFromUrl(const QuicString& uri, + bool PopulateHeaderBlockFromUrl(const std::string& uri, spdy::SpdyHeaderBlock* headers); // Waits for a period of time that is long enough to receive all delayed acks @@ -328,7 +329,7 @@ bool response_headers_complete, const spdy::SpdyHeaderBlock& response_headers, const spdy::SpdyHeaderBlock& preliminary_headers, - const QuicString& response, + const std::string& response, const spdy::SpdyHeaderBlock& response_trailers, uint64_t bytes_read, uint64_t bytes_written, @@ -340,7 +341,7 @@ bool response_headers_complete; spdy::SpdyHeaderBlock response_headers; spdy::SpdyHeaderBlock preliminary_headers; - QuicString response; + std::string response; spdy::SpdyHeaderBlock response_trailers; uint64_t bytes_read; uint64_t bytes_written; @@ -378,7 +379,7 @@ spdy::SpdyHeaderBlock response_trailers_; spdy::SpdyPriority priority_; - QuicString response_; + std::string response_; // bytes_read_ and bytes_written_ are updated only when stream_ is released; // prefer bytes_read() and bytes_written() member functions. uint64_t bytes_read_; @@ -403,7 +404,7 @@ // If set, this value is used for the connection SNI, overriding the usual // logic which extracts the SNI from the request URL. bool override_sni_set_ = false; - QuicString override_sni_; + std::string override_sni_; }; } // namespace test
diff --git a/quic/test_tools/quic_test_utils.cc b/quic/test_tools/quic_test_utils.cc index 6e3c2a5..ca2d9ff 100644 --- a/quic/test_tools/quic_test_utils.cc +++ b/quic/test_tools/quic_test_utils.cc
@@ -131,15 +131,15 @@ header.length_length); } -QuicString Sha1Hash(QuicStringPiece data) { +std::string Sha1Hash(QuicStringPiece data) { char buffer[SHA_DIGEST_LENGTH]; SHA1(reinterpret_cast<const uint8_t*>(data.data()), data.size(), reinterpret_cast<uint8_t*>(buffer)); - return QuicString(buffer, QUIC_ARRAYSIZE(buffer)); + return std::string(buffer, QUIC_ARRAYSIZE(buffer)); } uint64_t SimpleRandom::RandUint64() { - QuicString hash = + std::string hash = Sha1Hash(QuicStringPiece(reinterpret_cast<char*>(&seed_), sizeof(seed_))); DCHECK_EQ(static_cast<size_t>(SHA_DIGEST_LENGTH), hash.length()); memcpy(&seed_, hash.data(), sizeof(seed_)); @@ -650,7 +650,7 @@ TestQuicSpdyClientSession::~TestQuicSpdyClientSession() {} -bool TestQuicSpdyClientSession::IsAuthorized(const QuicString& authority) { +bool TestQuicSpdyClientSession::IsAuthorized(const std::string& authority) { return true; } @@ -714,10 +714,10 @@ namespace { -QuicString HexDumpWithMarks(const char* data, - int length, - const bool* marks, - int mark_length) { +std::string HexDumpWithMarks(const char* data, + int length, + const bool* marks, + int mark_length) { static const char kHexChars[] = "0123456789abcdef"; static const int kColumns = 4; @@ -728,7 +728,7 @@ mark_length = std::min(mark_length, kSizeLimit); } - QuicString hex; + std::string hex; for (const char* row = data; length > 0; row += kColumns, length -= kColumns) { for (const char* p = row; p < row + 4; ++p) { @@ -782,7 +782,7 @@ bool version_flag, bool reset_flag, uint64_t packet_number, - const QuicString& data) { + const std::string& data) { return ConstructEncryptedPacket( destination_connection_id, source_connection_id, version_flag, reset_flag, packet_number, data, CONNECTION_ID_PRESENT, CONNECTION_ID_ABSENT, @@ -795,7 +795,7 @@ bool version_flag, bool reset_flag, uint64_t packet_number, - const QuicString& data, + const std::string& data, QuicConnectionIdIncluded destination_connection_id_included, QuicConnectionIdIncluded source_connection_id_included, QuicPacketNumberLength packet_number_length) { @@ -811,7 +811,7 @@ bool version_flag, bool reset_flag, uint64_t packet_number, - const QuicString& data, + const std::string& data, QuicConnectionIdIncluded destination_connection_id_included, QuicConnectionIdIncluded source_connection_id_included, QuicPacketNumberLength packet_number_length, @@ -828,7 +828,7 @@ bool version_flag, bool reset_flag, uint64_t packet_number, - const QuicString& data, + const std::string& data, QuicConnectionIdIncluded destination_connection_id_included, QuicConnectionIdIncluded source_connection_id_included, QuicPacketNumberLength packet_number_length, @@ -894,7 +894,7 @@ bool version_flag, bool reset_flag, uint64_t packet_number, - const QuicString& data, + const std::string& data, QuicConnectionIdIncluded destination_connection_id_included, QuicConnectionIdIncluded source_connection_id_included, QuicPacketNumberLength packet_number_length, @@ -939,7 +939,7 @@ return new QuicEncryptedPacket(buffer, encrypted_length, true); } -void CompareCharArraysWithHexError(const QuicString& description, +void CompareCharArraysWithHexError(const std::string& description, const char* actual, const int actual_len, const char* expected,
diff --git a/quic/test_tools/quic_test_utils.h b/quic/test_tools/quic_test_utils.h index 2cca768..dc608d5 100644 --- a/quic/test_tools/quic_test_utils.h +++ b/quic/test_tools/quic_test_utils.h
@@ -79,7 +79,7 @@ bool version_flag, bool reset_flag, uint64_t packet_number, - const QuicString& data, + const std::string& data, QuicConnectionIdIncluded destination_connection_id_included, QuicConnectionIdIncluded source_connection_id_included, QuicPacketNumberLength packet_number_length, @@ -96,7 +96,7 @@ bool version_flag, bool reset_flag, uint64_t packet_number, - const QuicString& data, + const std::string& data, QuicConnectionIdIncluded destination_connection_id_included, QuicConnectionIdIncluded source_connection_id_included, QuicPacketNumberLength packet_number_length, @@ -109,7 +109,7 @@ bool version_flag, bool reset_flag, uint64_t packet_number, - const QuicString& data, + const std::string& data, QuicConnectionIdIncluded destination_connection_id_included, QuicConnectionIdIncluded source_connection_id_included, QuicPacketNumberLength packet_number_length); @@ -123,7 +123,7 @@ bool version_flag, bool reset_flag, uint64_t packet_number, - const QuicString& data); + const std::string& data); // Constructs a received packet for testing. The caller must take ownership of // the returned pointer. @@ -142,14 +142,14 @@ bool version_flag, bool reset_flag, uint64_t packet_number, - const QuicString& data, + const std::string& data, QuicConnectionIdIncluded destination_connection_id_included, QuicConnectionIdIncluded source_connection_id_included, QuicPacketNumberLength packet_number_length, ParsedQuicVersionVector* versions, Perspective perspective); -void CompareCharArraysWithHexError(const QuicString& description, +void CompareCharArraysWithHexError(const std::string& description, const char* actual, const int actual_len, const char* expected, @@ -220,8 +220,8 @@ const QuicFrames& frames, size_t packet_size); -// Compute SHA-1 hash of the supplied QuicString. -QuicString Sha1Hash(QuicStringPiece data); +// Compute SHA-1 hash of the supplied std::string. +std::string Sha1Hash(QuicStringPiece data); // Simple random number generator used to compute random numbers suitable // for pseudo-randomly dropping packets in tests. It works by computing @@ -371,7 +371,7 @@ MOCK_METHOD1(OnMessageReceived, void(QuicStringPiece message)); MOCK_METHOD3(OnConnectionClosed, void(QuicErrorCode error, - const QuicString& error_details, + const std::string& error_details, ConnectionCloseSource source)); MOCK_METHOD0(OnWriteBlocked, void()); MOCK_METHOD0(OnCanWrite, void()); @@ -486,11 +486,11 @@ MOCK_METHOD1(SendConnectionClose, void(QuicErrorCode error)); MOCK_METHOD3(CloseConnection, void(QuicErrorCode error, - const QuicString& details, + const std::string& details, ConnectionCloseBehavior connection_close_behavior)); MOCK_METHOD3(SendConnectionClosePacket, void(QuicErrorCode error, - const QuicString& details, + const std::string& details, AckBundling ack_mode)); MOCK_METHOD3(SendRstStream, void(QuicStreamId id, @@ -499,7 +499,7 @@ MOCK_METHOD3(SendGoAway, void(QuicErrorCode error, QuicStreamId last_good_stream_id, - const QuicString& reason)); + const std::string& reason)); MOCK_METHOD1(SendBlocked, void(QuicStreamId id)); MOCK_METHOD2(SendWindowUpdate, void(QuicStreamId id, QuicStreamOffset byte_offset)); @@ -520,7 +520,7 @@ MOCK_METHOD2(SendMessage, MessageStatus(QuicMessageId, QuicMemSliceSpan)); MOCK_METHOD3(OnConnectionClosed, void(QuicErrorCode error, - const QuicString& error_details, + const std::string& error_details, ConnectionCloseSource source)); MOCK_METHOD1(OnError, void(QuicFramer* framer)); @@ -530,7 +530,7 @@ void ReallyCloseConnection( QuicErrorCode error, - const QuicString& details, + const std::string& details, ConnectionCloseBehavior connection_close_behavior) { QuicConnection::CloseConnection(error, details, connection_close_behavior); } @@ -608,7 +608,7 @@ MOCK_METHOD3(OnConnectionClosed, void(QuicErrorCode error, - const QuicString& error_details, + const std::string& error_details, ConnectionCloseSource source)); MOCK_METHOD1(CreateIncomingStream, QuicStream*(QuicStreamId id)); MOCK_METHOD1(CreateIncomingStream, QuicSpdyStream*(PendingStream stream)); @@ -686,7 +686,7 @@ // From QuicSession. MOCK_METHOD3(OnConnectionClosed, void(QuicErrorCode error, - const QuicString& error_details, + const std::string& error_details, ConnectionCloseSource source)); MOCK_METHOD1(CreateIncomingStream, QuicSpdyStream*(QuicStreamId id)); MOCK_METHOD1(CreateIncomingStream, QuicSpdyStream*(PendingStream stream)); @@ -813,7 +813,7 @@ delete; ~TestQuicSpdyClientSession() override; - bool IsAuthorized(const QuicString& authority) override; + bool IsAuthorized(const std::string& authority) override; // QuicSpdyClientSessionBase MOCK_METHOD1(OnProofValid, @@ -912,7 +912,7 @@ MOCK_CONST_METHOD0(HasReliableBandwidthEstimate, bool()); MOCK_METHOD1(OnRttUpdated, void(QuicPacketNumber)); MOCK_CONST_METHOD0(GetCongestionWindow, QuicByteCount()); - MOCK_CONST_METHOD0(GetDebugState, QuicString()); + MOCK_CONST_METHOD0(GetDebugState, std::string()); MOCK_CONST_METHOD0(InSlowStart, bool()); MOCK_CONST_METHOD0(InRecovery, bool()); MOCK_CONST_METHOD0(ShouldSendProbingPacket, bool()); @@ -1046,7 +1046,7 @@ MOCK_METHOD3(OnUnrecoverableError, void(QuicErrorCode, - const QuicString&, + const std::string&, ConnectionCloseSource source)); }; @@ -1062,7 +1062,7 @@ MOCK_METHOD1(OnSerializedPacket, void(SerializedPacket* packet)); MOCK_METHOD3(OnUnrecoverableError, void(QuicErrorCode, - const QuicString&, + const std::string&, ConnectionCloseSource source)); };
diff --git a/quic/test_tools/simple_quic_framer.cc b/quic/test_tools/simple_quic_framer.cc index bf7184e..ca82c7c 100644 --- a/quic/test_tools/simple_quic_framer.cc +++ b/quic/test_tools/simple_quic_framer.cc
@@ -59,8 +59,8 @@ bool OnStreamFrame(const QuicStreamFrame& frame) override { // Save a copy of the data so it is valid after the packet is processed. - QuicString* string_data = - new QuicString(frame.data_buffer, frame.data_length); + std::string* string_data = + new std::string(frame.data_buffer, frame.data_length); stream_data_.push_back(QuicWrapUnique(string_data)); // TODO(ianswett): A pointer isn't necessary with emplace_back. stream_frames_.push_back(QuicMakeUnique<QuicStreamFrame>( @@ -71,8 +71,8 @@ bool OnCryptoFrame(const QuicCryptoFrame& frame) override { // Save a copy of the data so it is valid after the packet is processed. - QuicString* string_data = - new QuicString(frame.data_buffer, frame.data_length); + std::string* string_data = + new std::string(frame.data_buffer, frame.data_length); crypto_data_.push_back(QuicWrapUnique(string_data)); crypto_frames_.push_back(QuicMakeUnique<QuicCryptoFrame>( frame.level, frame.offset, QuicStringPiece(*string_data))); @@ -284,8 +284,8 @@ std::vector<QuicRetireConnectionIdFrame> retire_connection_id_frames_; std::vector<QuicNewTokenFrame> new_token_frames_; std::vector<QuicMessageFrame> message_frames_; - std::vector<std::unique_ptr<QuicString>> stream_data_; - std::vector<std::unique_ptr<QuicString>> crypto_data_; + std::vector<std::unique_ptr<std::string>> stream_data_; + std::vector<std::unique_ptr<std::string>> crypto_data_; EncryptionLevel last_decrypted_level_; };
diff --git a/quic/test_tools/simulator/actor.cc b/quic/test_tools/simulator/actor.cc index 546875d..578b894 100644 --- a/quic/test_tools/simulator/actor.cc +++ b/quic/test_tools/simulator/actor.cc
@@ -8,7 +8,7 @@ namespace quic { namespace simulator { -Actor::Actor(Simulator* simulator, QuicString name) +Actor::Actor(Simulator* simulator, std::string name) : simulator_(simulator), clock_(simulator->GetClock()), name_(std::move(name)) {
diff --git a/quic/test_tools/simulator/actor.h b/quic/test_tools/simulator/actor.h index 0c24913..9e06a7e 100644 --- a/quic/test_tools/simulator/actor.h +++ b/quic/test_tools/simulator/actor.h
@@ -29,7 +29,7 @@ // will not be called again unless Schedule() is called. class Actor { public: - Actor(Simulator* simulator, QuicString name); + Actor(Simulator* simulator, std::string name); virtual ~Actor(); // Trigger all the events the actor can potentially handle at this point. @@ -37,7 +37,7 @@ // to schedule the next call manually. virtual void Act() = 0; - inline QuicString name() const { return name_; } + inline std::string name() const { return name_; } inline Simulator* simulator() const { return simulator_; } protected: @@ -49,7 +49,7 @@ Simulator* simulator_; const QuicClock* clock_; - QuicString name_; + std::string name_; private: // Since the Actor object registers itself with a simulator using a pointer to
diff --git a/quic/test_tools/simulator/alarm_factory.cc b/quic/test_tools/simulator/alarm_factory.cc index 736f9ea..e748da5 100644 --- a/quic/test_tools/simulator/alarm_factory.cc +++ b/quic/test_tools/simulator/alarm_factory.cc
@@ -15,7 +15,7 @@ class Alarm : public QuicAlarm { public: Alarm(Simulator* simulator, - QuicString name, + std::string name, QuicArenaScopedPtr<QuicAlarm::Delegate> delegate) : QuicAlarm(std::move(delegate)), adapter_(simulator, name, this) {} ~Alarm() override {} @@ -33,7 +33,7 @@ // interfaces. class Adapter : public Actor { public: - Adapter(Simulator* simulator, QuicString name, Alarm* parent) + Adapter(Simulator* simulator, std::string name, Alarm* parent) : Actor(simulator, name), parent_(parent) {} ~Adapter() override {} @@ -51,12 +51,12 @@ Adapter adapter_; }; -AlarmFactory::AlarmFactory(Simulator* simulator, QuicString name) +AlarmFactory::AlarmFactory(Simulator* simulator, std::string name) : simulator_(simulator), name_(std::move(name)), counter_(0) {} AlarmFactory::~AlarmFactory() {} -QuicString AlarmFactory::GetNewAlarmName() { +std::string AlarmFactory::GetNewAlarmName() { ++counter_; return QuicStringPrintf("%s (alarm %i)", name_.c_str(), counter_); }
diff --git a/quic/test_tools/simulator/alarm_factory.h b/quic/test_tools/simulator/alarm_factory.h index 535095a..d765175 100644 --- a/quic/test_tools/simulator/alarm_factory.h +++ b/quic/test_tools/simulator/alarm_factory.h
@@ -14,7 +14,7 @@ // AlarmFactory allows to schedule QuicAlarms using the simulation event queue. class AlarmFactory : public QuicAlarmFactory { public: - AlarmFactory(Simulator* simulator, QuicString name); + AlarmFactory(Simulator* simulator, std::string name); AlarmFactory(const AlarmFactory&) = delete; AlarmFactory& operator=(const AlarmFactory&) = delete; ~AlarmFactory() override; @@ -26,10 +26,10 @@ private: // Automatically generate a name for a new alarm. - QuicString GetNewAlarmName(); + std::string GetNewAlarmName(); Simulator* simulator_; - QuicString name_; + std::string name_; int counter_; };
diff --git a/quic/test_tools/simulator/link.cc b/quic/test_tools/simulator/link.cc index 879de26..a016b89 100644 --- a/quic/test_tools/simulator/link.cc +++ b/quic/test_tools/simulator/link.cc
@@ -14,7 +14,7 @@ const uint64_t kMaxRandomDelayUs = 10; OneWayLink::OneWayLink(Simulator* simulator, - QuicString name, + std::string name, UnconstrainedPortInterface* sink, QuicBandwidth bandwidth, QuicTime::Delta propagation_delay) @@ -85,7 +85,7 @@ } SymmetricLink::SymmetricLink(Simulator* simulator, - QuicString name, + std::string name, UnconstrainedPortInterface* sink_a, UnconstrainedPortInterface* sink_b, QuicBandwidth bandwidth,
diff --git a/quic/test_tools/simulator/link.h b/quic/test_tools/simulator/link.h index 4553324..103afa0 100644 --- a/quic/test_tools/simulator/link.h +++ b/quic/test_tools/simulator/link.h
@@ -20,7 +20,7 @@ class OneWayLink : public Actor, public ConstrainedPortInterface { public: OneWayLink(Simulator* simulator, - QuicString name, + std::string name, UnconstrainedPortInterface* sink, QuicBandwidth bandwidth, QuicTime::Delta propagation_delay); @@ -66,7 +66,7 @@ class SymmetricLink { public: SymmetricLink(Simulator* simulator, - QuicString name, + std::string name, UnconstrainedPortInterface* sink_a, UnconstrainedPortInterface* sink_b, QuicBandwidth bandwidth,
diff --git a/quic/test_tools/simulator/packet_filter.cc b/quic/test_tools/simulator/packet_filter.cc index 8ee038a..ad03903 100644 --- a/quic/test_tools/simulator/packet_filter.cc +++ b/quic/test_tools/simulator/packet_filter.cc
@@ -8,7 +8,7 @@ namespace simulator { PacketFilter::PacketFilter(Simulator* simulator, - QuicString name, + std::string name, Endpoint* input) : Endpoint(simulator, name), input_(input) { input_->SetTxPort(this);
diff --git a/quic/test_tools/simulator/packet_filter.h b/quic/test_tools/simulator/packet_filter.h index e79b2cb..9873bec 100644 --- a/quic/test_tools/simulator/packet_filter.h +++ b/quic/test_tools/simulator/packet_filter.h
@@ -39,7 +39,7 @@ public: // Initialize the filter by wrapping around |input|. Does not take the // ownership of |input|. - PacketFilter(Simulator* simulator, QuicString name, Endpoint* input); + PacketFilter(Simulator* simulator, std::string name, Endpoint* input); PacketFilter(const PacketFilter&) = delete; PacketFilter& operator=(const PacketFilter&) = delete; ~PacketFilter() override;
diff --git a/quic/test_tools/simulator/port.cc b/quic/test_tools/simulator/port.cc index 3db8888..242ebd4 100644 --- a/quic/test_tools/simulator/port.cc +++ b/quic/test_tools/simulator/port.cc
@@ -14,7 +14,7 @@ Packet::Packet(const Packet& packet) = default; -Endpoint::Endpoint(Simulator* simulator, QuicString name) +Endpoint::Endpoint(Simulator* simulator, std::string name) : Actor(simulator, name) {} } // namespace simulator
diff --git a/quic/test_tools/simulator/port.h b/quic/test_tools/simulator/port.h index 5cd4a7f..15da638 100644 --- a/quic/test_tools/simulator/port.h +++ b/quic/test_tools/simulator/port.h
@@ -19,11 +19,11 @@ ~Packet(); Packet(const Packet& packet); - QuicString source; - QuicString destination; + std::string source; + std::string destination; QuicTime tx_timestamp; - QuicString contents; + std::string contents; QuicByteCount size; }; @@ -57,7 +57,7 @@ virtual void SetTxPort(ConstrainedPortInterface* port) = 0; protected: - Endpoint(Simulator* simulator, QuicString name); + Endpoint(Simulator* simulator, std::string name); }; } // namespace simulator
diff --git a/quic/test_tools/simulator/queue.cc b/quic/test_tools/simulator/queue.cc index 4236481..3816fd4 100644 --- a/quic/test_tools/simulator/queue.cc +++ b/quic/test_tools/simulator/queue.cc
@@ -12,7 +12,7 @@ Queue::ListenerInterface::~ListenerInterface() {} -Queue::Queue(Simulator* simulator, QuicString name, QuicByteCount capacity) +Queue::Queue(Simulator* simulator, std::string name, QuicByteCount capacity) : Actor(simulator, name), capacity_(capacity), bytes_queued_(0),
diff --git a/quic/test_tools/simulator/queue.h b/quic/test_tools/simulator/queue.h index f9fa483..6c3c6b0 100644 --- a/quic/test_tools/simulator/queue.h +++ b/quic/test_tools/simulator/queue.h
@@ -23,7 +23,7 @@ virtual void OnPacketDequeued() = 0; }; - Queue(Simulator* simulator, QuicString name, QuicByteCount capacity); + Queue(Simulator* simulator, std::string name, QuicByteCount capacity); Queue(const Queue&) = delete; Queue& operator=(const Queue&) = delete; ~Queue() override;
diff --git a/quic/test_tools/simulator/quic_endpoint.cc b/quic/test_tools/simulator/quic_endpoint.cc index 1bacdf2..b0ce5ca 100644 --- a/quic/test_tools/simulator/quic_endpoint.cc +++ b/quic/test_tools/simulator/quic_endpoint.cc
@@ -23,8 +23,8 @@ const char kStreamDataContents = 'Q'; // Takes a SHA-1 hash of the name and converts it into five 32-bit integers. -static std::vector<uint32_t> HashNameIntoFive32BitIntegers(QuicString name) { - const QuicString hash = test::Sha1Hash(name); +static std::vector<uint32_t> HashNameIntoFive32BitIntegers(std::string name) { + const std::string hash = test::Sha1Hash(name); std::vector<uint32_t> output; uint32_t current_number = 0; @@ -39,14 +39,14 @@ return output; } -QuicSocketAddress GetAddressFromName(QuicString name) { +QuicSocketAddress GetAddressFromName(std::string name) { const std::vector<uint32_t> hash = HashNameIntoFive32BitIntegers(name); // Generate a random port between 1025 and 65535. const uint16_t port = 1025 + hash[0] % (65535 - 1025 + 1); // Generate a random 10.x.x.x address, where x is between 1 and 254. - QuicString ip_address{"\xa\0\0\0", 4}; + std::string ip_address{"\xa\0\0\0", 4}; for (size_t i = 1; i < 4; i++) { ip_address[i] = 1 + hash[i] % 254; } @@ -56,8 +56,8 @@ } QuicEndpoint::QuicEndpoint(Simulator* simulator, - QuicString name, - QuicString peer_name, + std::string name, + std::string peer_name, Perspective perspective, QuicConnectionId connection_id) : Endpoint(simulator, name), @@ -103,7 +103,7 @@ // primarily because // - this enables pacing, and // - this sets the non-handshake timeouts. - QuicString error; + std::string error; CryptoHandshakeMessage peer_hello; peer_hello.SetValue(kICSL, static_cast<uint32_t>(kMaximumIdleTimeoutSecs - 1)); @@ -122,7 +122,7 @@ const char* perspective_prefix = connection_.perspective() == Perspective::IS_CLIENT ? "C" : "S"; - QuicString identifier = + std::string identifier = QuicStrCat(perspective_prefix, connection_.connection_id().ToString()); QuicRecordTestOutput(identifier, trace_visitor_->trace()->SerializeAsString()); @@ -305,7 +305,7 @@ packet->destination = endpoint_->peer_name_; packet->tx_timestamp = endpoint_->clock_->Now(); - packet->contents = QuicString(buffer, buf_len); + packet->contents = std::string(buffer, buf_len); packet->size = buf_len; endpoint_->nic_tx_queue_.AcceptPacket(std::move(packet)); @@ -384,7 +384,7 @@ } QuicEndpointMultiplexer::QuicEndpointMultiplexer( - QuicString name, + std::string name, std::initializer_list<QuicEndpoint*> endpoints) : Endpoint((*endpoints.begin())->simulator(), name) { for (QuicEndpoint* endpoint : endpoints) {
diff --git a/quic/test_tools/simulator/quic_endpoint.h b/quic/test_tools/simulator/quic_endpoint.h index ab4ee4b..955ac8f 100644 --- a/quic/test_tools/simulator/quic_endpoint.h +++ b/quic/test_tools/simulator/quic_endpoint.h
@@ -26,7 +26,7 @@ // Generate a random local network host-port tuple based on the name of the // endpoint. -QuicSocketAddress GetAddressFromName(QuicString name); +QuicSocketAddress GetAddressFromName(std::string name); // A QUIC connection endpoint. Wraps around QuicConnection. In order to // initiate a transfer, the caller has to call AddBytesToTransfer(). The data @@ -40,8 +40,8 @@ public SessionNotifierInterface { public: QuicEndpoint(Simulator* simulator, - QuicString name, - QuicString peer_name, + std::string name, + std::string peer_name, Perspective perspective, QuicConnectionId connection_id); ~QuicEndpoint() override; @@ -92,7 +92,7 @@ void OnGoAway(const QuicGoAwayFrame& frame) override {} void OnMessageReceived(QuicStringPiece message) override {} void OnConnectionClosed(QuicErrorCode error, - const QuicString& error_details, + const std::string& error_details, ConnectionCloseSource source) override {} void OnWriteBlocked() override {} void OnSuccessfulVersionNegotiation( @@ -176,7 +176,7 @@ // write-blocked. void WriteStreamData(); - QuicString peer_name_; + std::string peer_name_; Writer writer_; DataProducer producer_; @@ -210,7 +210,7 @@ class QuicEndpointMultiplexer : public Endpoint, public UnconstrainedPortInterface { public: - QuicEndpointMultiplexer(QuicString name, + QuicEndpointMultiplexer(std::string name, std::initializer_list<QuicEndpoint*> endpoints); ~QuicEndpointMultiplexer() override; @@ -225,7 +225,7 @@ void Act() override {} private: - QuicUnorderedMap<QuicString, QuicEndpoint*> mapping_; + QuicUnorderedMap<std::string, QuicEndpoint*> mapping_; }; } // namespace simulator
diff --git a/quic/test_tools/simulator/simulator.h b/quic/test_tools/simulator/simulator.h index 0180dcb..e21dd50 100644 --- a/quic/test_tools/simulator/simulator.h +++ b/quic/test_tools/simulator/simulator.h
@@ -130,7 +130,7 @@ // For each actor, maintain the time it is scheduled at. The value for // unscheduled actors is QuicTime::Infinite(). QuicUnorderedMap<Actor*, QuicTime> scheduled_times_; - QuicUnorderedSet<QuicString> actor_names_; + QuicUnorderedSet<std::string> actor_names_; }; template <class TerminationPredicate>
diff --git a/quic/test_tools/simulator/simulator_test.cc b/quic/test_tools/simulator/simulator_test.cc index d9986ad..33ad564 100644 --- a/quic/test_tools/simulator/simulator_test.cc +++ b/quic/test_tools/simulator/simulator_test.cc
@@ -26,7 +26,7 @@ // A simple counter that increments its value by 1 every specified period. class Counter : public Actor { public: - Counter(Simulator* simulator, QuicString name, QuicTime::Delta period) + Counter(Simulator* simulator, std::string name, QuicTime::Delta period) : Actor(simulator, name), value_(-1), period_(period) { Schedule(clock_->Now()); } @@ -89,7 +89,7 @@ per_destination_packet_counter_.clear(); } - QuicPacketCount CountPacketsForDestination(QuicString destination) const { + QuicPacketCount CountPacketsForDestination(std::string destination) const { auto result_it = per_destination_packet_counter_.find(destination); if (result_it == per_destination_packet_counter_.cend()) { return 0; @@ -101,7 +101,8 @@ QuicByteCount bytes_; QuicPacketCount packets_; - QuicUnorderedMap<QuicString, QuicPacketCount> per_destination_packet_counter_; + QuicUnorderedMap<std::string, QuicPacketCount> + per_destination_packet_counter_; }; // Sends the packet to the specified destination at the uplink rate. Provides a @@ -109,9 +110,9 @@ class LinkSaturator : public Endpoint { public: LinkSaturator(Simulator* simulator, - QuicString name, + std::string name, QuicByteCount packet_size, - QuicString destination) + std::string destination) : Endpoint(simulator, name), packet_size_(packet_size), destination_(std::move(destination)), @@ -155,7 +156,7 @@ private: QuicByteCount packet_size_; - QuicString destination_; + std::string destination_; ConstrainedPortInterface* tx_port_; CounterPort rx_port_; @@ -427,7 +428,7 @@ class AlarmToggler : public Actor { public: AlarmToggler(Simulator* simulator, - QuicString name, + std::string name, QuicAlarm* alarm, QuicTime::Delta interval) : Actor(simulator, name), @@ -591,7 +592,7 @@ class MockPacketFilter : public PacketFilter { public: - MockPacketFilter(Simulator* simulator, QuicString name, Endpoint* endpoint) + MockPacketFilter(Simulator* simulator, std::string name, Endpoint* endpoint) : PacketFilter(simulator, name, endpoint) {} MOCK_METHOD1(FilterPacket, bool(const Packet&)); };
diff --git a/quic/test_tools/simulator/switch.cc b/quic/test_tools/simulator/switch.cc index 638fa20..809c7f8 100644 --- a/quic/test_tools/simulator/switch.cc +++ b/quic/test_tools/simulator/switch.cc
@@ -12,7 +12,7 @@ namespace simulator { Switch::Switch(Simulator* simulator, - QuicString name, + std::string name, SwitchPortNumber port_count, QuicByteCount queue_capacity) { for (size_t port_number = 1; port_number <= port_count; port_number++) { @@ -25,7 +25,7 @@ Switch::~Switch() {} Switch::Port::Port(Simulator* simulator, - QuicString name, + std::string name, Switch* parent, SwitchPortNumber port_number, QuicByteCount queue_capacity)
diff --git a/quic/test_tools/simulator/switch.h b/quic/test_tools/simulator/switch.h index 4956c01..6d3efc3 100644 --- a/quic/test_tools/simulator/switch.h +++ b/quic/test_tools/simulator/switch.h
@@ -20,7 +20,7 @@ class Switch { public: Switch(Simulator* simulator, - QuicString name, + std::string name, SwitchPortNumber port_count, QuicByteCount queue_capacity); Switch(const Switch&) = delete; @@ -42,7 +42,7 @@ class Port : public Endpoint, public UnconstrainedPortInterface { public: Port(Simulator* simulator, - QuicString name, + std::string name, Switch* parent, SwitchPortNumber port_number, QuicByteCount queue_capacity); @@ -80,7 +80,7 @@ // This can not be a QuicDeque since pointers into this are // assumed to be stable. std::deque<Port> ports_; - QuicUnorderedMap<QuicString, Port*> switching_table_; + QuicUnorderedMap<std::string, Port*> switching_table_; }; } // namespace simulator
diff --git a/quic/test_tools/simulator/traffic_policer.cc b/quic/test_tools/simulator/traffic_policer.cc index e416a7d..fa0bcfb 100644 --- a/quic/test_tools/simulator/traffic_policer.cc +++ b/quic/test_tools/simulator/traffic_policer.cc
@@ -10,7 +10,7 @@ namespace simulator { TrafficPolicer::TrafficPolicer(Simulator* simulator, - QuicString name, + std::string name, QuicByteCount initial_bucket_size, QuicByteCount max_bucket_size, QuicBandwidth target_bandwidth,
diff --git a/quic/test_tools/simulator/traffic_policer.h b/quic/test_tools/simulator/traffic_policer.h index ee77576..c2a3e99 100644 --- a/quic/test_tools/simulator/traffic_policer.h +++ b/quic/test_tools/simulator/traffic_policer.h
@@ -20,7 +20,7 @@ class TrafficPolicer : public PacketFilter { public: TrafficPolicer(Simulator* simulator, - QuicString name, + std::string name, QuicByteCount initial_bucket_size, QuicByteCount max_bucket_size, QuicBandwidth target_bandwidth, @@ -45,7 +45,7 @@ QuicTime last_refill_time_; // Maps each destination to the number of tokens it has left. - QuicUnorderedMap<QuicString, QuicByteCount> token_buckets_; + QuicUnorderedMap<std::string, QuicByteCount> token_buckets_; }; } // namespace simulator
diff --git a/quic/tools/quic_backend_response.cc b/quic/tools/quic_backend_response.cc index 4ef00a0..7900683 100644 --- a/quic/tools/quic_backend_response.cc +++ b/quic/tools/quic_backend_response.cc
@@ -10,7 +10,7 @@ QuicUrl request_url, spdy::SpdyHeaderBlock headers, spdy::SpdyPriority priority, - QuicString body) + std::string body) : request_url(request_url), headers(std::move(headers)), priority(priority),
diff --git a/quic/tools/quic_backend_response.h b/quic/tools/quic_backend_response.h index cd052c8..4ef0fdc 100644 --- a/quic/tools/quic_backend_response.h +++ b/quic/tools/quic_backend_response.h
@@ -20,13 +20,13 @@ ServerPushInfo(QuicUrl request_url, spdy::SpdyHeaderBlock headers, spdy::SpdyPriority priority, - QuicString body); + std::string body); ServerPushInfo(const ServerPushInfo& other); QuicUrl request_url; spdy::SpdyHeaderBlock headers; spdy::SpdyPriority priority; - QuicString body; + std::string body; }; enum SpecialResponseType { @@ -75,7 +75,7 @@ SpecialResponseType response_type_; spdy::SpdyHeaderBlock headers_; spdy::SpdyHeaderBlock trailers_; - QuicString body_; + std::string body_; uint16_t stop_sending_code_; };
diff --git a/quic/tools/quic_client_base.h b/quic/tools/quic_client_base.h index 3b09e18..261fc2b 100644 --- a/quic/tools/quic_client_base.h +++ b/quic/tools/quic_client_base.h
@@ -127,7 +127,7 @@ // This should only be set before the initial Connect() void set_server_id(const QuicServerId& server_id) { server_id_ = server_id; } - void SetUserAgentID(const QuicString& user_agent_id) { + void SetUserAgentID(const std::string& user_agent_id) { crypto_config_.set_user_agent_id(user_agent_id); }
diff --git a/quic/tools/quic_client_bin.cc b/quic/tools/quic_client_bin.cc index 1083f0d..412fb8e 100644 --- a/quic/tools/quic_client_bin.cc +++ b/quic/tools/quic_client_bin.cc
@@ -60,7 +60,6 @@ namespace { using quic::QuicSocketAddress; -using quic::QuicString; using quic::QuicStringPiece; using quic::QuicTextUtils; using quic::QuicUrl; @@ -97,7 +96,7 @@ } }; -QuicSocketAddress LookupAddress(QuicString host, QuicString port) { +QuicSocketAddress LookupAddress(std::string host, std::string port) { addrinfo hint; memset(&hint, 0, sizeof(hint)); hint.ai_protocol = IPPROTO_UDP; @@ -200,7 +199,7 @@ const char* usage = "Usage: quic_client [options] <url>"; // All non-flag arguments should be interpreted as URLs to fetch. - std::vector<QuicString> urls = + std::vector<std::string> urls = quic::QuicParseCommandLineFlags(usage, argc, argv); if (urls.size() != 1) { quic::QuicPrintCommandLineFlagHelp(usage);
diff --git a/quic/tools/quic_client_epoll_network_helper.cc b/quic/tools/quic_client_epoll_network_helper.cc index 846911f..e545ee2 100644 --- a/quic/tools/quic_client_epoll_network_helper.cc +++ b/quic/tools/quic_client_epoll_network_helper.cc
@@ -55,7 +55,7 @@ CleanUpAllUDPSockets(); } -QuicString QuicClientEpollNetworkHelper::Name() const { +std::string QuicClientEpollNetworkHelper::Name() const { return "QuicClientEpollNetworkHelper"; }
diff --git a/quic/tools/quic_client_epoll_network_helper.h b/quic/tools/quic_client_epoll_network_helper.h index e0f8cf3..d66dbb1 100644 --- a/quic/tools/quic_client_epoll_network_helper.h +++ b/quic/tools/quic_client_epoll_network_helper.h
@@ -44,7 +44,7 @@ ~QuicClientEpollNetworkHelper() override; // Return a name describing the class for use in debug/error reporting. - QuicString Name() const override; + std::string Name() const override; // From EpollCallbackInterface void OnRegistration(QuicEpollServer* eps, int fd, int event_mask) override;
diff --git a/quic/tools/quic_client_test.cc b/quic/tools/quic_client_test.cc index 7977f05..12a687c 100644 --- a/quic/tools/quic_client_test.cc +++ b/quic/tools/quic_client_test.cc
@@ -24,8 +24,8 @@ const char* kPathToFds = "/proc/self/fd"; -QuicString ReadLink(const QuicString& path) { - QuicString result(PATH_MAX, '\0'); +std::string ReadLink(const std::string& path) { + std::string result(PATH_MAX, '\0'); ssize_t result_size = readlink(path.c_str(), &result[0], result.size()); CHECK(result_size > 0 && static_cast<size_t>(result_size) < result.size()); result.resize(result_size); @@ -44,7 +44,7 @@ continue; } - QuicString fd_path = ReadLink(QuicStrCat(kPathToFds, "/", name)); + std::string fd_path = ReadLink(QuicStrCat(kPathToFds, "/", name)); if (QuicTextUtils::StartsWith(fd_path, "socket:")) { socket_count++; }
diff --git a/quic/tools/quic_memory_cache_backend.cc b/quic/tools/quic_memory_cache_backend.cc index 9f333dd..76a52c3 100644 --- a/quic/tools/quic_memory_cache_backend.cc +++ b/quic/tools/quic_memory_cache_backend.cc
@@ -19,7 +19,7 @@ namespace quic { -QuicMemoryCacheBackend::ResourceFile::ResourceFile(const QuicString& file_name) +QuicMemoryCacheBackend::ResourceFile::ResourceFile(const std::string& file_name) : file_name_(file_name) {} QuicMemoryCacheBackend::ResourceFile::~ResourceFile() = default; @@ -31,7 +31,7 @@ size_t start = 0; while (start < file_contents_.length()) { size_t pos = file_contents_.find("\n", start); - if (pos == QuicString::npos) { + if (pos == std::string::npos) { QUIC_LOG(DFATAL) << "Headers invalid or empty, ignoring: " << file_name_; return; } @@ -49,7 +49,7 @@ // Extract the status from the HTTP first line. if (line.substr(0, 4) == "HTTP") { pos = line.find(" "); - if (pos == QuicString::npos) { + if (pos == std::string::npos) { QUIC_LOG(DFATAL) << "Headers invalid or empty, ignoring: " << file_name_; return; @@ -59,7 +59,7 @@ } // Headers are "key: value". pos = line.find(": "); - if (pos == QuicString::npos) { + if (pos == std::string::npos) { QUIC_LOG(DFATAL) << "Headers invalid or empty, ignoring: " << file_name_; return; } @@ -86,7 +86,7 @@ size_t start = 0; while (start < push_urls.length()) { size_t pos = push_urls.find('\0', start); - if (pos == QuicString::npos) { + if (pos == std::string::npos) { push_urls_.push_back(QuicStringPiece(push_urls.data() + start, push_urls.length() - start)); break; @@ -227,7 +227,7 @@ QuicMemoryCacheBackend::QuicMemoryCacheBackend() : cache_initialized_(false) {} bool QuicMemoryCacheBackend::InitializeBackend( - const QuicString& cache_directory) { + const std::string& cache_directory) { if (cache_directory.empty()) { QUIC_BUG << "cache_directory must not be empty."; return false; @@ -235,7 +235,7 @@ QUIC_LOG(INFO) << "Attempting to initialize QuicMemoryCacheBackend from directory: " << cache_directory; - std::vector<QuicString> files = ReadFileContents(cache_directory); + std::vector<std::string> files = ReadFileContents(cache_directory); std::list<std::unique_ptr<ResourceFile>> resource_files; for (const auto& filename : files) { std::unique_ptr<ResourceFile> resource_file(new ResourceFile(filename)); @@ -267,7 +267,7 @@ } push_resources.push_back(ServerPushInfo(url, response->headers().Clone(), kV3LowestPriority, - (QuicString(response->body())))); + (std::string(response->body())))); } MaybeAddServerPushResources(resource_file->host(), resource_file->path(), push_resources); @@ -282,7 +282,7 @@ void QuicMemoryCacheBackend::FetchResponseFromBackend( const SpdyHeaderBlock& request_headers, - const QuicString& request_body, + const std::string& request_body, QuicSimpleServerBackend::RequestHandler* quic_stream) { const QuicBackendResponse* quic_response = nullptr; // Find response in cache. If not found, send error response. @@ -292,8 +292,8 @@ quic_response = GetResponse(authority->second, path->second); } - QuicString request_url = - QuicString(authority->second) + QuicString(path->second); + std::string request_url = + std::string(authority->second) + std::string(path->second); std::list<ServerPushInfo> resources = GetServerPushResources(request_url); QUIC_DVLOG(1) << "Fetching QUIC response from backend in-memory cache for url " @@ -306,7 +306,7 @@ QuicSimpleServerBackend::RequestHandler* quic_stream) {} std::list<ServerPushInfo> QuicMemoryCacheBackend::GetServerPushResources( - QuicString request_url) { + std::string request_url) { QuicWriterMutexLock lock(&response_mutex_); std::list<ServerPushInfo> resources; @@ -336,7 +336,7 @@ QuicWriterMutexLock lock(&response_mutex_); DCHECK(!host.empty()) << "Host must be populated, e.g. \"www.google.com\""; - QuicString key = GetKey(host, path); + std::string key = GetKey(host, path); if (QuicContainsKey(responses_, key)) { QUIC_BUG << "Response for '" << key << "' already exists!"; return; @@ -351,20 +351,20 @@ responses_[key] = std::move(new_response); } -QuicString QuicMemoryCacheBackend::GetKey(QuicStringPiece host, - QuicStringPiece path) const { - QuicString host_string = QuicString(host); +std::string QuicMemoryCacheBackend::GetKey(QuicStringPiece host, + QuicStringPiece path) const { + std::string host_string = std::string(host); size_t port = host_string.find(':'); - if (port != QuicString::npos) - host_string = QuicString(host_string.c_str(), port); - return host_string + QuicString(path); + if (port != std::string::npos) + host_string = std::string(host_string.c_str(), port); + return host_string + std::string(path); } void QuicMemoryCacheBackend::MaybeAddServerPushResources( QuicStringPiece request_host, QuicStringPiece request_path, std::list<ServerPushInfo> push_resources) { - QuicString request_url = GetKey(request_host, request_path); + std::string request_url = GetKey(request_host, request_path); for (const auto& push_resource : push_resources) { if (PushResourceExistsInCache(request_url, push_resource)) { @@ -380,11 +380,11 @@ QuicWriterMutexLock lock(&response_mutex_); server_push_resources_.insert(std::make_pair(request_url, push_resource)); } - QuicString host = push_resource.request_url.host(); + std::string host = push_resource.request_url.host(); if (host.empty()) { - host = QuicString(request_host); + host = std::string(request_host); } - QuicString path = push_resource.request_url.path(); + std::string path = push_resource.request_url.path(); bool found_existing_response = false; { QuicWriterMutexLock lock(&response_mutex_); @@ -401,7 +401,7 @@ } bool QuicMemoryCacheBackend::PushResourceExistsInCache( - QuicString original_request_url, + std::string original_request_url, ServerPushInfo resource) { QuicWriterMutexLock lock(&response_mutex_); auto resource_range =
diff --git a/quic/tools/quic_memory_cache_backend.h b/quic/tools/quic_memory_cache_backend.h index 1417349..ff76c9a 100644 --- a/quic/tools/quic_memory_cache_backend.h +++ b/quic/tools/quic_memory_cache_backend.h
@@ -32,7 +32,7 @@ // server push associations. class ResourceFile { public: - explicit ResourceFile(const QuicString& file_name); + explicit ResourceFile(const std::string& file_name); ResourceFile(const ResourceFile&) = delete; ResourceFile& operator=(const ResourceFile&) = delete; virtual ~ResourceFile(); @@ -42,7 +42,7 @@ // |base| is |file_name_| with |cache_directory| prefix stripped. void SetHostPathFromBase(QuicStringPiece base); - const QuicString& file_name() { return file_name_; } + const std::string& file_name() { return file_name_; } QuicStringPiece host() { return host_; } @@ -58,8 +58,8 @@ void HandleXOriginalUrl(); QuicStringPiece RemoveScheme(QuicStringPiece url); - QuicString file_name_; - QuicString file_contents_; + std::string file_name_; + std::string file_contents_; QuicStringPiece body_; spdy::SpdyHeaderBlock spdy_headers_; QuicStringPiece x_original_url_; @@ -135,19 +135,19 @@ void AddDefaultResponse(QuicBackendResponse* response); // |cache_cirectory| can be generated using `wget -p --save-headers <url>`. - void InitializeFromDirectory(const QuicString& cache_directory); + void InitializeFromDirectory(const std::string& cache_directory); // Find all the server push resources associated with |request_url|. std::list<QuicBackendResponse::ServerPushInfo> GetServerPushResources( - QuicString request_url); + std::string request_url); // Implements the functions for interface QuicSimpleServerBackend // |cache_cirectory| can be generated using `wget -p --save-headers <url>`. - bool InitializeBackend(const QuicString& cache_directory) override; + bool InitializeBackend(const std::string& cache_directory) override; bool IsBackendInitialized() const override; void FetchResponseFromBackend( const spdy::SpdyHeaderBlock& request_headers, - const QuicString& request_body, + const std::string& request_body, QuicSimpleServerBackend::RequestHandler* quic_server_stream) override; void CloseBackendResponseStream( QuicSimpleServerBackend::RequestHandler* quic_server_stream) override; @@ -161,7 +161,7 @@ spdy::SpdyHeaderBlock response_trailers, uint16_t stop_sending_code); - QuicString GetKey(QuicStringPiece host, QuicStringPiece path) const; + std::string GetKey(QuicStringPiece host, QuicStringPiece path) const; // Add some server push urls with given responses for specified // request if these push resources are not associated with this request yet. @@ -172,11 +172,11 @@ // Check if push resource(push_host/push_path) associated with given request // url already exists in server push map. - bool PushResourceExistsInCache(QuicString original_request_url, + bool PushResourceExistsInCache(std::string original_request_url, QuicBackendResponse::ServerPushInfo resource); // Cached responses. - QuicUnorderedMap<QuicString, std::unique_ptr<QuicBackendResponse>> responses_ + QuicUnorderedMap<std::string, std::unique_ptr<QuicBackendResponse>> responses_ GUARDED_BY(response_mutex_); // The default response for cache misses, if set. @@ -184,7 +184,7 @@ GUARDED_BY(response_mutex_); // A map from request URL to associated server push responses (if any). - std::multimap<QuicString, QuicBackendResponse::ServerPushInfo> + std::multimap<std::string, QuicBackendResponse::ServerPushInfo> server_push_resources_ GUARDED_BY(response_mutex_); // Protects against concurrent access from test threads setting responses, and
diff --git a/quic/tools/quic_memory_cache_backend_test.cc b/quic/tools/quic_memory_cache_backend_test.cc index e5f5db1..80b1b29 100644 --- a/quic/tools/quic_memory_cache_backend_test.cc +++ b/quic/tools/quic_memory_cache_backend_test.cc
@@ -20,8 +20,8 @@ class QuicMemoryCacheBackendTest : public QuicTest { protected: - void CreateRequest(QuicString host, - QuicString path, + void CreateRequest(std::string host, + std::string path, spdy::SpdyHeaderBlock* headers) { (*headers)[":method"] = "GET"; (*headers)[":path"] = path; @@ -29,7 +29,7 @@ (*headers)[":scheme"] = "https"; } - QuicString CacheDirectory() { return QuicGetTestMemoryCachePath(); } + std::string CacheDirectory() { return QuicGetTestMemoryCachePath(); } QuicMemoryCacheBackend cache_; }; @@ -41,7 +41,7 @@ } TEST_F(QuicMemoryCacheBackendTest, AddSimpleResponseGetResponse) { - QuicString response_body("hello response"); + std::string response_body("hello response"); cache_.AddSimpleResponse("www.google.com", "/", 200, response_body); spdy::SpdyHeaderBlock request_headers; @@ -54,9 +54,9 @@ } TEST_F(QuicMemoryCacheBackendTest, AddResponse) { - const QuicString kRequestHost = "www.foo.com"; - const QuicString kRequestPath = "/"; - const QuicString kResponseBody("hello response"); + const std::string kRequestHost = "www.foo.com"; + const std::string kRequestPath = "/"; + const std::string kResponseBody("hello response"); spdy::SpdyHeaderBlock response_headers; response_headers[":version"] = "HTTP/1.1"; @@ -151,17 +151,17 @@ } TEST_F(QuicMemoryCacheBackendTest, AddSimpleResponseWithServerPushResources) { - QuicString request_host = "www.foo.com"; - QuicString response_body("hello response"); + std::string request_host = "www.foo.com"; + std::string response_body("hello response"); const size_t kNumResources = 5; int NumResources = 5; std::list<ServerPushInfo> push_resources; - QuicString scheme = "http"; + std::string scheme = "http"; for (int i = 0; i < NumResources; ++i) { - QuicString path = "/server_push_src" + QuicTextUtils::Uint64ToString(i); - QuicString url = scheme + "://" + request_host + path; + std::string path = "/server_push_src" + QuicTextUtils::Uint64ToString(i); + std::string url = scheme + "://" + request_host + path; QuicUrl resource_url(url); - QuicString body = + std::string body = QuicStrCat("This is server push response body for ", path); spdy::SpdyHeaderBlock response_headers; response_headers[":version"] = "HTTP/1.1"; @@ -175,7 +175,7 @@ cache_.AddSimpleResponseWithServerPushResources( request_host, "/", 200, response_body, push_resources); - QuicString request_url = request_host + "/"; + std::string request_url = request_host + "/"; std::list<ServerPushInfo> resources = cache_.GetServerPushResources(request_url); ASSERT_EQ(kNumResources, resources.size()); @@ -189,18 +189,19 @@ } TEST_F(QuicMemoryCacheBackendTest, GetServerPushResourcesAndPushResponses) { - QuicString request_host = "www.foo.com"; - QuicString response_body("hello response"); + std::string request_host = "www.foo.com"; + std::string response_body("hello response"); const size_t kNumResources = 4; int NumResources = 4; - QuicString scheme = "http"; - QuicString push_response_status[kNumResources] = {"200", "200", "301", "404"}; + std::string scheme = "http"; + std::string push_response_status[kNumResources] = {"200", "200", "301", + "404"}; std::list<ServerPushInfo> push_resources; for (int i = 0; i < NumResources; ++i) { - QuicString path = "/server_push_src" + QuicTextUtils::Uint64ToString(i); - QuicString url = scheme + "://" + request_host + path; + std::string path = "/server_push_src" + QuicTextUtils::Uint64ToString(i); + std::string url = scheme + "://" + request_host + path; QuicUrl resource_url(url); - QuicString body = "This is server push response body for " + path; + std::string body = "This is server push response body for " + path; spdy::SpdyHeaderBlock response_headers; response_headers[":version"] = "HTTP/1.1"; response_headers[":status"] = push_response_status[i]; @@ -211,15 +212,15 @@ } cache_.AddSimpleResponseWithServerPushResources( request_host, "/", 200, response_body, push_resources); - QuicString request_url = request_host + "/"; + std::string request_url = request_host + "/"; std::list<ServerPushInfo> resources = cache_.GetServerPushResources(request_url); ASSERT_EQ(kNumResources, resources.size()); int i = 0; for (const auto& push_resource : push_resources) { QuicUrl url = resources.front().request_url; - QuicString host = url.host(); - QuicString path = url.path(); + std::string host = url.host(); + std::string path = url.path(); const Response* response = cache_.GetResponse(host, path); ASSERT_TRUE(response); ASSERT_TRUE(QuicContainsKey(response->headers(), ":status"));
diff --git a/quic/tools/quic_packet_printer_bin.cc b/quic/tools/quic_packet_printer_bin.cc index c632195..77906a1 100644 --- a/quic/tools/quic_packet_printer_bin.cc +++ b/quic/tools/quic_packet_printer_bin.cc
@@ -208,7 +208,7 @@ int main(int argc, char* argv[]) { const char* usage = "Usage: quic_packet_printer client|server <hex>"; - std::vector<quic::QuicString> args = + std::vector<std::string> args = quic::QuicParseCommandLineFlags(usage, argc, argv); if (args.size() < 2) { @@ -216,7 +216,7 @@ return 1; } - quic::QuicString perspective_string = args[0]; + std::string perspective_string = args[0]; quic::Perspective perspective; if (perspective_string == "client") { perspective = quic::Perspective::IS_CLIENT; @@ -227,7 +227,7 @@ quic::QuicPrintCommandLineFlagHelp(usage); return 1; } - quic::QuicString hex = quic::QuicTextUtils::HexDecode(args[1]); + std::string hex = quic::QuicTextUtils::HexDecode(args[1]); quic::ParsedQuicVersionVector versions = quic::AllSupportedVersions(); // Fake a time since we're not actually generating acks. quic::QuicTime start(quic::QuicTime::Zero());
diff --git a/quic/tools/quic_reject_reason_decoder_bin.cc b/quic/tools/quic_reject_reason_decoder_bin.cc index 14590b6..de66774 100644 --- a/quic/tools/quic_reject_reason_decoder_bin.cc +++ b/quic/tools/quic_reject_reason_decoder_bin.cc
@@ -18,7 +18,7 @@ int main(int argc, char* argv[]) { const char* usage = "Usage: quic_reject_reason_decoder <packed_reason>"; - std::vector<quic::QuicString> args = + std::vector<std::string> args = quic::QuicParseCommandLineFlags(usage, argc, argv); if (args.size() != 1) {
diff --git a/quic/tools/quic_server.h b/quic/tools/quic_server.h index 9ef5f0c..a339d1e 100644 --- a/quic/tools/quic_server.h +++ b/quic/tools/quic_server.h
@@ -48,7 +48,7 @@ ~QuicServer() override; - QuicString Name() const override { return "QuicServer"; } + std::string Name() const override { return "QuicServer"; } // Start listening on the specified address. bool CreateUDPSocketAndListen(const QuicSocketAddress& address);
diff --git a/quic/tools/quic_server_bin.cc b/quic/tools/quic_server_bin.cc index fde94a3..1029fbd 100644 --- a/quic/tools/quic_server_bin.cc +++ b/quic/tools/quic_server_bin.cc
@@ -28,7 +28,7 @@ int main(int argc, char* argv[]) { const char* usage = "Usage: quic_server [options]"; - std::vector<quic::QuicString> non_option_args = + std::vector<std::string> non_option_args = quic::QuicParseCommandLineFlags(usage, argc, argv); if (!non_option_args.empty()) { quic::QuicPrintCommandLineFlagHelp(usage);
diff --git a/quic/tools/quic_simple_crypto_server_stream_helper.cc b/quic/tools/quic_simple_crypto_server_stream_helper.cc index bdd6731..2bb9656 100644 --- a/quic/tools/quic_simple_crypto_server_stream_helper.cc +++ b/quic/tools/quic_simple_crypto_server_stream_helper.cc
@@ -27,7 +27,7 @@ const QuicSocketAddress& client_address, const QuicSocketAddress& peer_address, const QuicSocketAddress& self_address, - QuicString* error_details) const { + std::string* error_details) const { return true; }
diff --git a/quic/tools/quic_simple_crypto_server_stream_helper.h b/quic/tools/quic_simple_crypto_server_stream_helper.h index c058f1a..f8a58f6 100644 --- a/quic/tools/quic_simple_crypto_server_stream_helper.h +++ b/quic/tools/quic_simple_crypto_server_stream_helper.h
@@ -27,7 +27,7 @@ const QuicSocketAddress& client_address, const QuicSocketAddress& peer_address, const QuicSocketAddress& self_address, - QuicString* error_details) const override; + std::string* error_details) const override; private: QuicRandom* random_; // Unowned.
diff --git a/quic/tools/quic_simple_server_backend.h b/quic/tools/quic_simple_server_backend.h index a75143a..74afb60 100644 --- a/quic/tools/quic_simple_server_backend.h +++ b/quic/tools/quic_simple_server_backend.h
@@ -27,7 +27,7 @@ virtual QuicConnectionId connection_id() const = 0; virtual QuicStreamId stream_id() const = 0; - virtual QuicString peer_host() const = 0; + virtual std::string peer_host() const = 0; // Called when the response is ready at the backend and can be send back to // the QUIC client. virtual void OnResponseBackendComplete( @@ -38,7 +38,7 @@ virtual ~QuicSimpleServerBackend() = default; // This method initializes the backend instance to fetch responses // from a backend server, in-memory cache etc. - virtual bool InitializeBackend(const QuicString& backend_url) = 0; + virtual bool InitializeBackend(const std::string& backend_url) = 0; // Returns true if the backend has been successfully initialized // and could be used to fetch HTTP requests virtual bool IsBackendInitialized() const = 0; @@ -49,7 +49,7 @@ // asynchronously calls |request_handler| with the HTTP response. virtual void FetchResponseFromBackend( const spdy::SpdyHeaderBlock& request_headers, - const QuicString& request_body, + const std::string& request_body, RequestHandler* request_handler) = 0; // Clears the state of the backend instance virtual void CloseBackendResponseStream(RequestHandler* request_handler) = 0;
diff --git a/quic/tools/quic_simple_server_session.cc b/quic/tools/quic_simple_server_session.cc index 7e2e3bf..a722d37 100644 --- a/quic/tools/quic_simple_server_session.cc +++ b/quic/tools/quic_simple_server_session.cc
@@ -61,7 +61,7 @@ } void QuicSimpleServerSession::PromisePushResources( - const QuicString& request_url, + const std::string& request_url, const std::list<QuicBackendResponse::ServerPushInfo>& resources, QuicStreamId original_stream_id, const spdy::SpdyHeaderBlock& original_request_headers) { @@ -160,7 +160,7 @@ } spdy::SpdyHeaderBlock QuicSimpleServerSession::SynthesizePushRequestHeaders( - QuicString request_url, + std::string request_url, QuicBackendResponse::ServerPushInfo resource, const spdy::SpdyHeaderBlock& original_request_headers) { QuicUrl push_request_url = resource.request_url;
diff --git a/quic/tools/quic_simple_server_session.h b/quic/tools/quic_simple_server_session.h index 45c97d0..81e067d 100644 --- a/quic/tools/quic_simple_server_session.h +++ b/quic/tools/quic_simple_server_session.h
@@ -74,7 +74,7 @@ // And enqueue HEADERS block in those PUSH_PROMISED for sending push response // later. virtual void PromisePushResources( - const QuicString& request_url, + const std::string& request_url, const std::list<QuicBackendResponse::ServerPushInfo>& resources, QuicStreamId original_stream_id, const spdy::SpdyHeaderBlock& original_request_headers); @@ -112,7 +112,7 @@ // Copying the rest headers ensures they are the same as the original // request, especially cookies. spdy::SpdyHeaderBlock SynthesizePushRequestHeaders( - QuicString request_url, + std::string request_url, QuicBackendResponse::ServerPushInfo resource, const spdy::SpdyHeaderBlock& original_request_headers);
diff --git a/quic/tools/quic_simple_server_session_test.cc b/quic/tools/quic_simple_server_session_test.cc index b2ef667..8d5b05c 100644 --- a/quic/tools/quic_simple_server_session_test.cc +++ b/quic/tools/quic_simple_server_session_test.cc
@@ -601,28 +601,28 @@ // than stream flow control window so stream won't send the full body. size_t body_size = 2 * kStreamFlowControlWindowSize; // 64KB. - QuicString request_url = "mail.google.com/"; + std::string request_url = "mail.google.com/"; spdy::SpdyHeaderBlock request_headers; - QuicString resource_host = "www.google.com"; - QuicString partial_push_resource_path = "/server_push_src"; + std::string resource_host = "www.google.com"; + std::string partial_push_resource_path = "/server_push_src"; std::list<QuicBackendResponse::ServerPushInfo> push_resources; - QuicString scheme = "http"; + std::string scheme = "http"; QuicByteCount header_length = 0; for (unsigned int i = 1; i <= num_resources; ++i) { QuicStreamId stream_id = GetNthServerInitiatedUnidirectionalId(i - 1); - QuicString path = + std::string path = partial_push_resource_path + QuicTextUtils::Uint64ToString(i); - QuicString url = scheme + "://" + resource_host + path; + std::string url = scheme + "://" + resource_host + path; QuicUrl resource_url = QuicUrl(url); - QuicString body(body_size, 'a'); - QuicString data; + std::string body(body_size, 'a'); + std::string data; header_length = 0; if (VersionHasDataFrameHeader(connection_->transport_version())) { HttpEncoder encoder; std::unique_ptr<char[]> buffer; header_length = encoder.SerializeDataFrameHeader(body.length(), &buffer); - QuicString header = QuicString(buffer.get(), header_length); + std::string header = std::string(buffer.get(), header_length); data = header + body; } else { data = body;
diff --git a/quic/tools/quic_simple_server_stream.cc b/quic/tools/quic_simple_server_stream.cc index 541ff32..4e25552 100644 --- a/quic/tools/quic_simple_server_stream.cc +++ b/quic/tools/quic_simple_server_stream.cc
@@ -155,7 +155,7 @@ return id(); } -QuicString QuicSimpleServerStream::peer_host() const { +std::string QuicSimpleServerStream::peer_host() const { return spdy_session()->peer_address().host().ToString(); } @@ -192,8 +192,8 @@ // response status, send error response. Notice that // QuicHttpResponseCache push urls are strictly authority + path only, // scheme is not included (see |QuicHttpResponseCache::GetKey()|). - QuicString request_url = request_headers_[":authority"].as_string() + - request_headers_[":path"].as_string(); + std::string request_url = request_headers_[":authority"].as_string() + + request_headers_[":path"].as_string(); int response_code; const SpdyHeaderBlock& response_headers = response->headers(); if (!ParseHeaderStatusCode(response_headers, &response_code)) {
diff --git a/quic/tools/quic_simple_server_stream.h b/quic/tools/quic_simple_server_stream.h index 2e6826f..4472262 100644 --- a/quic/tools/quic_simple_server_stream.h +++ b/quic/tools/quic_simple_server_stream.h
@@ -56,7 +56,7 @@ // Implements QuicSimpleServerBackend::RequestHandler callbacks QuicConnectionId connection_id() const override; QuicStreamId stream_id() const override; - QuicString peer_host() const override; + std::string peer_host() const override; void OnResponseBackendComplete( const QuicBackendResponse* response, std::list<QuicBackendResponse::ServerPushInfo> resources) override; @@ -87,12 +87,12 @@ spdy::SpdyHeaderBlock* request_headers() { return &request_headers_; } - const QuicString& body() { return body_; } + const std::string& body() { return body_; } // The parsed headers received from the client. spdy::SpdyHeaderBlock request_headers_; int64_t content_length_; - QuicString body_; + std::string body_; private: QuicSimpleServerBackend* quic_simple_server_backend_; // Not owned.
diff --git a/quic/tools/quic_simple_server_stream_test.cc b/quic/tools/quic_simple_server_stream_test.cc index 88c85e4..7572a75 100644 --- a/quic/tools/quic_simple_server_stream_test.cc +++ b/quic/tools/quic_simple_server_stream_test.cc
@@ -68,8 +68,8 @@ void DoSendErrorResponse() { SendErrorResponse(); } spdy::SpdyHeaderBlock* mutable_headers() { return &request_headers_; } - void set_body(QuicString body) { body_ = std::move(body); } - const QuicString& body() const { return body_; } + void set_body(std::string body) { body_ = std::move(body); } + const std::string& body() const { return body_; } int content_length() const { return content_length_; } QuicStringPiece GetHeader(QuicStringPiece key) const { @@ -113,7 +113,7 @@ MOCK_METHOD3(OnConnectionClosed, void(QuicErrorCode error, - const QuicString& error_details, + const std::string& error_details, ConnectionCloseSource source)); MOCK_METHOD1(CreateIncomingStream, QuicSpdyStream*(QuicStreamId id)); MOCK_METHOD5(WritevData, @@ -136,7 +136,7 @@ MOCK_METHOD1(OnHeadersHeadOfLineBlocking, void(QuicTime::Delta delta)); // Matchers cannot be used on non-copyable types like SpdyHeaderBlock. void PromisePushResources( - const QuicString& request_url, + const std::string& request_url, const std::list<QuicBackendResponse::ServerPushInfo>& resources, QuicStreamId original_stream_id, const spdy::SpdyHeaderBlock& original_request_headers) override { @@ -145,7 +145,7 @@ original_request_headers); } MOCK_METHOD4(PromisePushResourcesMock, - void(const QuicString&, + void(const std::string&, const std::list<QuicBackendResponse::ServerPushInfo>&, QuicStreamId, const spdy::SpdyHeaderBlock&)); @@ -206,9 +206,9 @@ connection_->AdvanceTime(QuicTime::Delta::FromSeconds(1)); } - const QuicString& StreamBody() { return stream_->body(); } + const std::string& StreamBody() { return stream_->body(); } - QuicString StreamHeadersValue(const QuicString& key) { + std::string StreamHeadersValue(const std::string& key) { return (*stream_->mutable_headers())[key].as_string(); } @@ -232,7 +232,7 @@ StrictMock<MockQuicSimpleServerSession> session_; StrictMock<TestStream>* stream_; // Owned by session_. std::unique_ptr<QuicBackendResponse> quic_response_; - QuicString body_; + std::string body_; QuicHeaderList header_list_; HttpEncoder encoder_; }; @@ -248,8 +248,8 @@ std::unique_ptr<char[]> buffer; QuicByteCount header_length = encoder_.SerializeDataFrameHeader(body_.length(), &buffer); - QuicString header = QuicString(buffer.get(), header_length); - QuicString data = HasFrameHeader() ? header + body_ : body_; + std::string header = std::string(buffer.get(), header_length); + std::string data = HasFrameHeader() ? header + body_ : body_; stream_->OnStreamFrame( QuicStreamFrame(stream_->id(), /*fin=*/false, /*offset=*/0, data)); EXPECT_EQ("11", StreamHeadersValue("content-length")); @@ -266,8 +266,8 @@ std::unique_ptr<char[]> buffer; QuicByteCount header_length = encoder_.SerializeDataFrameHeader(body_.length(), &buffer); - QuicString header = QuicString(buffer.get(), header_length); - QuicString data = HasFrameHeader() ? header + body_ : body_; + std::string header = std::string(buffer.get(), header_length); + std::string data = HasFrameHeader() ? header + body_ : body_; stream_->OnStreamFrame( QuicStreamFrame(stream_->id(), /*fin=*/false, /*offset=*/0, data)); EXPECT_EQ("11", StreamHeadersValue("content-length")); @@ -292,7 +292,7 @@ TEST_P(QuicSimpleServerStreamTest, TestFramingExtraData) { InSequence seq; - QuicString large_body = "hello world!!!!!!"; + std::string large_body = "hello world!!!!!!"; // We'll automatically write out an error (headers + body) EXPECT_CALL(*stream_, WriteHeadersMock(false)); @@ -307,8 +307,8 @@ std::unique_ptr<char[]> buffer; QuicByteCount header_length = encoder_.SerializeDataFrameHeader(body_.length(), &buffer); - QuicString header = QuicString(buffer.get(), header_length); - QuicString data = HasFrameHeader() ? header + body_ : body_; + std::string header = std::string(buffer.get(), header_length); + std::string data = HasFrameHeader() ? header + body_ : body_; stream_->OnStreamFrame( QuicStreamFrame(stream_->id(), /*fin=*/false, /*offset=*/0, data)); @@ -316,8 +316,8 @@ // accept the bytes. header_length = encoder_.SerializeDataFrameHeader(large_body.length(), &buffer); - header = QuicString(buffer.get(), header_length); - QuicString data2 = HasFrameHeader() ? header + large_body : large_body; + header = std::string(buffer.get(), header_length); + std::string data2 = HasFrameHeader() ? header + large_body : large_body; stream_->OnStreamFrame( QuicStreamFrame(stream_->id(), /*fin=*/true, data.size(), data2)); EXPECT_EQ("11", StreamHeadersValue("content-length")); @@ -337,7 +337,7 @@ // HTTP/2 only supports integer responsecode, so "200 OK" is illegal. response_headers_[":status"] = "200 OK"; response_headers_["content-length"] = "5"; - QuicString body = "Yummm"; + std::string body = "Yummm"; std::unique_ptr<char[]> buffer; QuicByteCount header_length = encoder_.SerializeDataFrameHeader(body.length(), &buffer); @@ -371,7 +371,7 @@ // HTTP/2 only supports 3-digit-integer, so "+200" is illegal. response_headers_[":status"] = "+200"; response_headers_["content-length"] = "5"; - QuicString body = "Yummm"; + std::string body = "Yummm"; std::unique_ptr<char[]> buffer; QuicByteCount header_length = @@ -413,7 +413,7 @@ response_headers_[":version"] = "HTTP/1.1"; response_headers_[":status"] = "404"; response_headers_["content-length"] = "8"; - QuicString body = "NotFound"; + std::string body = "NotFound"; memory_cache_backend_.AddResponse("www.google.com", "/bar", std::move(response_headers_), body); @@ -436,7 +436,7 @@ response_headers_[":version"] = "HTTP/1.1"; response_headers_[":status"] = "200"; response_headers_["content-length"] = "5"; - QuicString body = "Yummm"; + std::string body = "Yummm"; std::unique_ptr<char[]> buffer; QuicByteCount header_length = @@ -463,9 +463,9 @@ // call PromisePushResources() to handle these resources. // Add a request and response with valid headers into cache. - QuicString host = "www.google.com"; - QuicString request_path = "/foo"; - QuicString body = "Yummm"; + std::string host = "www.google.com"; + std::string request_path = "/foo"; + std::string body = "Yummm"; std::unique_ptr<char[]> buffer; QuicByteCount header_length = encoder_.SerializeDataFrameHeader(body.length(), &buffer); @@ -526,8 +526,8 @@ WRITE_UNIDIRECTIONAL, &memory_cache_backend_); session_.ActivateStream(QuicWrapUnique(server_initiated_stream)); - const QuicString kHost = "www.foo.com"; - const QuicString kPath = "/bar"; + const std::string kHost = "www.foo.com"; + const std::string kPath = "/bar"; spdy::SpdyHeaderBlock headers; headers[":path"] = kPath; headers[":authority"] = kHost; @@ -537,7 +537,7 @@ response_headers_[":version"] = "HTTP/1.1"; response_headers_[":status"] = "200"; response_headers_["content-length"] = "5"; - const QuicString kBody = "Hello"; + const std::string kBody = "Hello"; std::unique_ptr<char[]> buffer; QuicByteCount header_length = encoder_.SerializeDataFrameHeader(kBody.length(), &buffer);
diff --git a/quic/tools/quic_spdy_client_base.cc b/quic/tools/quic_spdy_client_base.cc index b9b0bd2..3d7ef02 100644 --- a/quic/tools/quic_spdy_client_base.cc +++ b/quic/tools/quic_spdy_client_base.cc
@@ -132,7 +132,7 @@ } void QuicSpdyClientBase::SendRequestsAndWaitForResponse( - const std::vector<QuicString>& url_list) { + const std::vector<std::string>& url_list) { for (size_t i = 0; i < url_list.size(); ++i) { SpdyHeaderBlock headers; if (!SpdyUtils::PopulateHeaderBlockFromUrl(url_list[i], &headers)) { @@ -240,12 +240,12 @@ return latest_response_code_; } -const QuicString& QuicSpdyClientBase::latest_response_headers() const { +const std::string& QuicSpdyClientBase::latest_response_headers() const { QUIC_BUG_IF(!store_response_) << "Response not stored!"; return latest_response_headers_; } -const QuicString& QuicSpdyClientBase::preliminary_response_headers() const { +const std::string& QuicSpdyClientBase::preliminary_response_headers() const { QUIC_BUG_IF(!store_response_) << "Response not stored!"; return preliminary_response_headers_; } @@ -256,12 +256,12 @@ return latest_response_header_block_; } -const QuicString& QuicSpdyClientBase::latest_response_body() const { +const std::string& QuicSpdyClientBase::latest_response_body() const { QUIC_BUG_IF(!store_response_) << "Response not stored!"; return latest_response_body_; } -const QuicString& QuicSpdyClientBase::latest_response_trailers() const { +const std::string& QuicSpdyClientBase::latest_response_trailers() const { QUIC_BUG_IF(!store_response_) << "Response not stored!"; return latest_response_trailers_; }
diff --git a/quic/tools/quic_spdy_client_base.h b/quic/tools/quic_spdy_client_base.h index 3112f9c..a9aadb9 100644 --- a/quic/tools/quic_spdy_client_base.h +++ b/quic/tools/quic_spdy_client_base.h
@@ -37,7 +37,7 @@ virtual void OnCompleteResponse( QuicStreamId id, const spdy::SpdyHeaderBlock& response_headers, - const QuicString& response_body) = 0; + const std::string& response_body) = 0; }; // The client uses these objects to keep track of any data to resend upon @@ -99,7 +99,7 @@ // Sends a request simple GET for each URL in |url_list|, and then waits for // each to complete. - void SendRequestsAndWaitForResponse(const std::vector<QuicString>& url_list); + void SendRequestsAndWaitForResponse(const std::vector<std::string>& url_list); // Returns a newly created QuicSpdyClientStream. QuicSpdyClientStream* CreateClientStream(); @@ -126,11 +126,11 @@ void set_store_response(bool val) { store_response_ = val; } size_t latest_response_code() const; - const QuicString& latest_response_headers() const; - const QuicString& preliminary_response_headers() const; + const std::string& latest_response_headers() const; + const std::string& preliminary_response_headers() const; const spdy::SpdyHeaderBlock& latest_response_header_block() const; - const QuicString& latest_response_body() const; - const QuicString& latest_response_trailers() const; + const std::string& latest_response_body() const; + const std::string& latest_response_trailers() const; void set_response_listener(std::unique_ptr<ResponseListener> listener) { response_listener_ = std::move(listener); @@ -192,15 +192,15 @@ // HTTP response code from most recent response. int latest_response_code_; // HTTP/2 headers from most recent response. - QuicString latest_response_headers_; + std::string latest_response_headers_; // preliminary 100 Continue HTTP/2 headers from most recent response, if any. - QuicString preliminary_response_headers_; + std::string preliminary_response_headers_; // HTTP/2 headers from most recent response. spdy::SpdyHeaderBlock latest_response_header_block_; // Body of most recent response. - QuicString latest_response_body_; + std::string latest_response_body_; // HTTP/2 trailers from most recent response. - QuicString latest_response_trailers_; + std::string latest_response_trailers_; // Listens for full responses. std::unique_ptr<ResponseListener> response_listener_;
diff --git a/quic/tools/quic_url.cc b/quic/tools/quic_url.cc index 675cafe..4094ffe 100644 --- a/quic/tools/quic_url.cc +++ b/quic/tools/quic_url.cc
@@ -11,7 +11,7 @@ static constexpr size_t kMaxHostNameLength = 256; -QuicUrl::QuicUrl(QuicStringPiece url) : url_(static_cast<QuicString>(url)) {} +QuicUrl::QuicUrl(QuicStringPiece url) : url_(static_cast<std::string>(url)) {} QuicUrl::QuicUrl(QuicStringPiece url, QuicStringPiece default_scheme) : QuicUrl(url) { @@ -22,7 +22,7 @@ url_ = GURL(QuicStrCat(default_scheme, "://", url)); } -QuicString QuicUrl::ToString() const { +std::string QuicUrl::ToString() const { if (IsValid()) { return url_.spec(); } @@ -41,12 +41,12 @@ return true; } -QuicString QuicUrl::HostPort() const { +std::string QuicUrl::HostPort() const { if (!IsValid() || !url_.has_host()) { return ""; } - QuicString host = url_.host(); + std::string host = url_.host(); int port = url_.IntPort(); if (port == url::PORT_UNSPECIFIED) { return host; @@ -54,7 +54,7 @@ return QuicStrCat(host, ":", port); } -QuicString QuicUrl::PathParamsQuery() const { +std::string QuicUrl::PathParamsQuery() const { if (!IsValid() || !url_.has_path()) { return "/"; } @@ -62,7 +62,7 @@ return url_.PathForRequest(); } -QuicString QuicUrl::scheme() const { +std::string QuicUrl::scheme() const { if (!IsValid()) { return ""; } @@ -70,7 +70,7 @@ return url_.scheme(); } -QuicString QuicUrl::host() const { +std::string QuicUrl::host() const { if (!IsValid()) { return ""; } @@ -78,7 +78,7 @@ return url_.HostNoBrackets(); } -QuicString QuicUrl::path() const { +std::string QuicUrl::path() const { if (!IsValid()) { return ""; }
diff --git a/quic/tools/quic_url.h b/quic/tools/quic_url.h index f632a9a..7ed190d 100644 --- a/quic/tools/quic_url.h +++ b/quic/tools/quic_url.h
@@ -34,21 +34,21 @@ // Returns full text of the QuicUrl if it is valid. Return empty string // otherwise. - QuicString ToString() const; + std::string ToString() const; // Returns host:port. // If the host is empty, it will return an empty string. // If the host is an IPv6 address, it will be bracketed. // If port is not present or is equal to default_port of scheme (e.g., port // 80 for HTTP), it won't be returned. - QuicString HostPort() const; + std::string HostPort() const; // Returns a string assembles path, parameters and query. - QuicString PathParamsQuery() const; + std::string PathParamsQuery() const; - QuicString scheme() const; - QuicString host() const; - QuicString path() const; + std::string scheme() const; + std::string host() const; + std::string path() const; uint16_t port() const; private:
diff --git a/quic/tools/quic_url_test.cc b/quic/tools/quic_url_test.cc index 384dc2a..3af0be7 100644 --- a/quic/tools/quic_url_test.cc +++ b/quic/tools/quic_url_test.cc
@@ -16,7 +16,7 @@ TEST_F(QuicUrlTest, Basic) { // No scheme specified. - QuicString url_str = "www.example.com"; + std::string url_str = "www.example.com"; QuicUrl url(url_str); EXPECT_FALSE(url.IsValid()); @@ -54,7 +54,7 @@ TEST_F(QuicUrlTest, DefaultScheme) { // Default scheme to HTTP. - QuicString url_str = "www.example.com"; + std::string url_str = "www.example.com"; QuicUrl url(url_str, "http"); EXPECT_EQ("http://www.example.com/", url.ToString()); EXPECT_EQ("http", url.scheme()); @@ -73,7 +73,7 @@ } TEST_F(QuicUrlTest, IsValid) { - QuicString url_str = + std::string url_str = "ftp://www.example.com:12345/path/to/resource?a=1&campaign=2"; EXPECT_TRUE(QuicUrl(url_str).IsValid()); @@ -86,7 +86,7 @@ EXPECT_FALSE(QuicUrl(url_str).IsValid()); // Host name too long. - QuicString host(1024, 'a'); + std::string host(1024, 'a'); url_str = "https://" + host; EXPECT_FALSE(QuicUrl(url_str).IsValid()); @@ -96,7 +96,7 @@ } TEST_F(QuicUrlTest, HostPort) { - QuicString url_str = "http://www.example.com/"; + std::string url_str = "http://www.example.com/"; QuicUrl url(url_str); EXPECT_EQ("www.example.com", url.HostPort()); EXPECT_EQ("www.example.com", url.host()); @@ -134,7 +134,7 @@ } TEST_F(QuicUrlTest, PathParamsQuery) { - QuicString url_str = + std::string url_str = "https://www.example.com:12345/path/to/resource?a=1&campaign=2"; QuicUrl url(url_str); EXPECT_EQ("/path/to/resource?a=1&campaign=2", url.PathParamsQuery());