0

Roll src/net/third_party/quiche/src/ 5a4f76123..7df418b6d (17 commits)

https://quiche.googlesource.com/quiche.git/+log/5a4f76123806..7df418b6dc0a

$ git log 5a4f76123..7df418b6d --date=short --no-merges --format='%ad %ae %s'
2020-10-13 vasilvv Replace QuicheOptional with absl::optional.
2020-10-13 bnc Change large header size in EndToEndTest.WayTooLongRequestHeaders.
2020-10-13 vasilvv Remove quiche::QuicheStringPiece and quiche::QuicheStringPieceHash.
2020-10-13 fayang Replace quiche::QuicheStringPiece with absl::string_view in tls_handshaker.cc
2020-10-13 quiche-dev Internal QUICHE change
2020-10-13 vasilvv Replace quiche::QuicheStringPiece with absl::string_view.
2020-10-12 vasilvv Replace quiche::QuicheStringPiece with absl::string_view.
2020-10-12 vasilvv Replace quiche::QuicheStringPiece with absl::string_view.
2020-10-12 vasilvv Replace quiche::QuicheStringPiece with absl::string_view.
2020-10-12 vasilvv Replace quiche::QuicheStringPiece with absl::string_view.
2020-10-12 fayang Consider address has been validated by successfully processing a HANDSHAKE or 1-RTT packet.
2020-10-12 quiche-dev Do not process a write-closed QuicEventManagerStream.
2020-10-12 dschinazi Update Android Conformance Test QUIC test
2020-10-12 quiche-dev Deprecate --gfe2_reloadable_flag_quic_check_fallback_null.
2020-10-12 vasilvv Replace quiche::QuicheStringPiece with absl::string_view.
2020-10-11 wub For QUIC BBRv2 STARTUP, factor out two pre-conditions to check bandwidth growth and losses: !full_bandwidth_reached_ && congestion_event.end_of_round_trip.
2020-10-10 ianswett Add the check for enough loss events into the Bbr2NetworkModel::IsInflightTooHigh() method to simplify the code.

Created with:
  roll-dep src/net/third_party/quiche/src

Change-Id: I5375232c82737398e4a739f2ad80fa9ae0172063
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2469516
Reviewed-by: Yutaka Hirano <yhirano@chromium.org>
Reviewed-by: David Schinazi <dschinazi@chromium.org>
Commit-Queue: Victor Vasiliev <vasilvv@chromium.org>
Cr-Commit-Position: refs/heads/master@{#817072}
This commit is contained in:
Victor Vasiliev
2020-10-14 17:22:10 +00:00
committed by Commit Bot
parent 748572b1a2
commit 47ecb6a8cf
53 changed files with 225 additions and 277 deletions

2
DEPS

@ -326,7 +326,7 @@ vars = {
# Three lines of non-changing comments so that
# the commit queue can handle CLs rolling feed
# and whatever else without interference from each other.
'quiche_revision': '5a4f761238065c30c92e90e2f0be13edf54f564f',
'quiche_revision': '7df418b6dc0ad8fe543e00e2c34c274b70bf771c',
# Three lines of non-changing comments so that
# the commit queue can handle CLs rolling ios_webkit
# and whatever else without interference from each other.

@ -949,7 +949,6 @@ component("net") {
"quiche/common/platform/impl/quiche_export_impl.h",
"quiche/common/platform/impl/quiche_logging_impl.h",
"quiche/common/platform/impl/quiche_map_util_impl.h",
"quiche/common/platform/impl/quiche_optional_impl.h",
"quiche/common/platform/impl/quiche_ptr_util_impl.h",
"quiche/common/platform/impl/quiche_str_cat_impl.h",
"quiche/common/platform/impl/quiche_string_piece_impl.h",

@ -41,15 +41,15 @@ inline std::string Http2HexEncodeImpl(const void* bytes, size_t size) {
return base::HexEncode(bytes, size);
}
inline std::string Http2HexDecodeImpl(quiche::QuicheStringPiece data) {
inline std::string Http2HexDecodeImpl(absl::string_view data) {
return quiche::QuicheTextUtils::HexDecode(data);
}
inline std::string Http2HexDumpImpl(quiche::QuicheStringPiece data) {
inline std::string Http2HexDumpImpl(absl::string_view data) {
return quiche::QuicheTextUtils::HexDump(data);
}
inline std::string Http2HexEscapeImpl(quiche::QuicheStringPiece data) {
inline std::string Http2HexEscapeImpl(absl::string_view data) {
return net::EscapeQueryParamValue(base::StringViewToStringPiece(data), false);
}

@ -607,7 +607,7 @@ class BidirectionalStreamQuicImplTest
uint64_t packet_number,
bool should_include_version,
bool fin,
quiche::QuicheStringPiece data) {
absl::string_view data) {
std::unique_ptr<quic::QuicReceivedPacket> packet(
server_maker_.MakeDataPacket(packet_number, stream_id_,
should_include_version, fin, data));
@ -619,7 +619,7 @@ class BidirectionalStreamQuicImplTest
std::unique_ptr<quic::QuicReceivedPacket> ConstructClientDataPacket(
bool should_include_version,
bool fin,
quiche::QuicheStringPiece data) {
absl::string_view data) {
return client_maker_.MakeDataPacket(++packet_number_, stream_id_,
should_include_version, fin, data);
}
@ -750,7 +750,7 @@ class BidirectionalStreamQuicImplTest
uint64_t largest_received,
uint64_t smallest_received,
bool fin,
quiche::QuicheStringPiece data,
absl::string_view data,
QuicTestPacketMaker* maker) {
std::unique_ptr<quic::QuicReceivedPacket> packet(
maker->MakeAckAndDataPacket(packet_number, should_include_version,

@ -78,7 +78,7 @@ bool ProofSourceChromium::GetProofInner(
const string& hostname,
const string& server_config,
quic::QuicTransportVersion quic_version,
quiche::QuicheStringPiece chlo_hash,
absl::string_view chlo_hash,
quic::QuicReferenceCountedPointer<quic::ProofSource::Chain>* out_chain,
quic::QuicCryptoProof* proof) {
DCHECK(proof != nullptr);
@ -134,7 +134,7 @@ void ProofSourceChromium::GetProof(const quic::QuicSocketAddress& server_addr,
const std::string& hostname,
const std::string& server_config,
quic::QuicTransportVersion quic_version,
quiche::QuicheStringPiece chlo_hash,
absl::string_view chlo_hash,
std::unique_ptr<Callback> callback) {
// As a transitional implementation, just call the synchronous version of
// GetProof, then invoke the callback with the results and destroy it.
@ -160,7 +160,7 @@ void ProofSourceChromium::ComputeTlsSignature(
const quic::QuicSocketAddress& client_address,
const std::string& hostname,
uint16_t signature_algorithm,
quiche::QuicheStringPiece in,
absl::string_view in,
std::unique_ptr<SignatureCallback> callback) {
crypto::OpenSSLErrStackTracer err_tracer(FROM_HERE);
bssl::ScopedEVP_MD_CTX sign_context;

@ -38,7 +38,7 @@ class NET_EXPORT_PRIVATE ProofSourceChromium : public quic::ProofSource {
const std::string& hostname,
const std::string& server_config,
quic::QuicTransportVersion quic_version,
quiche::QuicheStringPiece chlo_hash,
absl::string_view chlo_hash,
std::unique_ptr<Callback> callback) override;
quic::QuicReferenceCountedPointer<Chain> GetCertChain(
@ -51,7 +51,7 @@ class NET_EXPORT_PRIVATE ProofSourceChromium : public quic::ProofSource {
const quic::QuicSocketAddress& client_address,
const std::string& hostname,
uint16_t signature_algorithm,
quiche::QuicheStringPiece in,
absl::string_view in,
std::unique_ptr<SignatureCallback> callback) override;
TicketCrypter* GetTicketCrypter() override;
@ -63,7 +63,7 @@ class NET_EXPORT_PRIVATE ProofSourceChromium : public quic::ProofSource {
const std::string& hostname,
const std::string& server_config,
quic::QuicTransportVersion quic_version,
quiche::QuicheStringPiece chlo_hash,
absl::string_view chlo_hash,
quic::QuicReferenceCountedPointer<quic::ProofSource::Chain>* out_chain,
quic::QuicCryptoProof* proof);

@ -57,7 +57,7 @@ void RunVerification(quic::ProofVerifier* verifier,
const uint16_t port,
const string& server_config,
quic::QuicTransportVersion quic_version,
quiche::QuicheStringPiece chlo_hash,
absl::string_view chlo_hash,
const std::vector<string>& certs,
const string& proof,
bool expected_ok) {

@ -68,7 +68,7 @@ class ProofVerifierChromium::Job {
const uint16_t port,
const std::string& server_config,
quic::QuicTransportVersion quic_version,
quiche::QuicheStringPiece chlo_hash,
absl::string_view chlo_hash,
const std::vector<std::string>& certs,
const std::string& cert_sct,
const std::string& signature,
@ -119,7 +119,7 @@ class ProofVerifierChromium::Job {
bool VerifySignature(const std::string& signed_data,
quic::QuicTransportVersion quic_version,
quiche::QuicheStringPiece chlo_hash,
absl::string_view chlo_hash,
const std::string& signature,
const std::string& cert);
@ -211,7 +211,7 @@ quic::QuicAsyncStatus ProofVerifierChromium::Job::VerifyProof(
const uint16_t port,
const string& server_config,
quic::QuicTransportVersion quic_version,
quiche::QuicheStringPiece chlo_hash,
absl::string_view chlo_hash,
const std::vector<string>& certs,
const std::string& cert_sct,
const string& signature,
@ -548,7 +548,7 @@ int ProofVerifierChromium::Job::DoVerifyCertComplete(int result) {
bool ProofVerifierChromium::Job::VerifySignature(
const string& signed_data,
quic::QuicTransportVersion quic_version,
quiche::QuicheStringPiece chlo_hash,
absl::string_view chlo_hash,
const string& signature,
const string& cert) {
size_t size_bits;
@ -624,7 +624,7 @@ quic::QuicAsyncStatus ProofVerifierChromium::VerifyProof(
const uint16_t port,
const std::string& server_config,
quic::QuicTransportVersion quic_version,
quiche::QuicheStringPiece chlo_hash,
absl::string_view chlo_hash,
const std::vector<std::string>& certs,
const std::string& cert_sct,
const std::string& signature,

@ -85,7 +85,7 @@ class NET_EXPORT_PRIVATE ProofVerifierChromium : public quic::ProofVerifier {
const uint16_t port,
const std::string& server_config,
quic::QuicTransportVersion quic_version,
quiche::QuicheStringPiece chlo_hash,
absl::string_view chlo_hash,
const std::vector<std::string>& certs,
const std::string& cert_sct,
const std::string& signature,

@ -47,7 +47,6 @@ using quic::QuicSpdyClientSessionBase;
using quic::QuicTagVector;
using quic::QuicTime;
using quic::TransportParameters;
using quiche::QuicheStringPiece;
using std::string;
namespace net {

@ -10,7 +10,6 @@
using quic::DiversificationNonce;
using quic::Perspective;
using quic::QuicPacketNumber;
using quiche::QuicheStringPiece;
namespace net {
@ -22,11 +21,11 @@ const size_t kPaddingSize = 12;
MockDecrypter::MockDecrypter(Perspective perspective) {}
bool MockDecrypter::SetKey(quiche::QuicheStringPiece key) {
bool MockDecrypter::SetKey(absl::string_view key) {
return key.empty();
}
bool MockDecrypter::SetHeaderProtectionKey(quiche::QuicheStringPiece key) {
bool MockDecrypter::SetHeaderProtectionKey(absl::string_view key) {
return key.empty();
}
@ -35,15 +34,15 @@ std::string MockDecrypter::GenerateHeaderProtectionMask(
return std::string(5, 0);
}
bool MockDecrypter::SetNoncePrefix(quiche::QuicheStringPiece nonce_prefix) {
bool MockDecrypter::SetNoncePrefix(absl::string_view nonce_prefix) {
return nonce_prefix.empty();
}
bool MockDecrypter::SetIV(quiche::QuicheStringPiece iv) {
bool MockDecrypter::SetIV(absl::string_view iv) {
return iv.empty();
}
bool MockDecrypter::SetPreliminaryKey(quiche::QuicheStringPiece key) {
bool MockDecrypter::SetPreliminaryKey(absl::string_view key) {
QUIC_BUG << "Should not be called";
return false;
}
@ -54,8 +53,8 @@ bool MockDecrypter::SetDiversificationNonce(const DiversificationNonce& nonce) {
}
bool MockDecrypter::DecryptPacket(uint64_t /*packet_number*/,
quiche::QuicheStringPiece associated_data,
quiche::QuicheStringPiece ciphertext,
absl::string_view associated_data,
absl::string_view ciphertext,
char* output,
size_t* output_length,
size_t max_output_length) {
@ -84,12 +83,12 @@ size_t MockDecrypter::GetIVSize() const {
return 0;
}
quiche::QuicheStringPiece MockDecrypter::GetKey() const {
return quiche::QuicheStringPiece();
absl::string_view MockDecrypter::GetKey() const {
return absl::string_view();
}
quiche::QuicheStringPiece MockDecrypter::GetNoncePrefix() const {
return quiche::QuicheStringPiece();
absl::string_view MockDecrypter::GetNoncePrefix() const {
return absl::string_view();
}
uint32_t MockDecrypter::cipher_id() const {

@ -27,24 +27,24 @@ class MockDecrypter : public quic::QuicDecrypter {
~MockDecrypter() override {}
// QuicDecrypter implementation
bool SetKey(quiche::QuicheStringPiece key) override;
bool SetNoncePrefix(quiche::QuicheStringPiece nonce_prefix) override;
bool SetHeaderProtectionKey(quiche::QuicheStringPiece key) override;
bool SetIV(quiche::QuicheStringPiece iv) override;
bool SetPreliminaryKey(quiche::QuicheStringPiece key) override;
bool SetKey(absl::string_view key) override;
bool SetNoncePrefix(absl::string_view nonce_prefix) override;
bool SetHeaderProtectionKey(absl::string_view key) override;
bool SetIV(absl::string_view iv) override;
bool SetPreliminaryKey(absl::string_view key) override;
bool SetDiversificationNonce(
const quic::DiversificationNonce& nonce) override;
bool DecryptPacket(uint64_t packet_number,
quiche::QuicheStringPiece associated_data,
quiche::QuicheStringPiece ciphertext,
absl::string_view associated_data,
absl::string_view ciphertext,
char* output,
size_t* output_length,
size_t max_output_length) override;
size_t GetKeySize() const override;
size_t GetNoncePrefixSize() const override;
size_t GetIVSize() const override;
quiche::QuicheStringPiece GetKey() const override;
quiche::QuicheStringPiece GetNoncePrefix() const override;
absl::string_view GetKey() const override;
absl::string_view GetNoncePrefix() const override;
std::string GenerateHeaderProtectionMask(
quic::QuicDataReader* sample_reader) override;

@ -10,7 +10,6 @@
using quic::DiversificationNonce;
using quic::Perspective;
using quic::QuicPacketNumber;
using quiche::QuicheStringPiece;
namespace net {
@ -22,21 +21,21 @@ const size_t kPaddingSize = 12;
MockEncrypter::MockEncrypter(Perspective perspective) {}
bool MockEncrypter::SetKey(quiche::QuicheStringPiece key) {
bool MockEncrypter::SetKey(absl::string_view key) {
return key.empty();
}
bool MockEncrypter::SetNoncePrefix(quiche::QuicheStringPiece nonce_prefix) {
bool MockEncrypter::SetNoncePrefix(absl::string_view nonce_prefix) {
return nonce_prefix.empty();
}
bool MockEncrypter::SetIV(quiche::QuicheStringPiece iv) {
bool MockEncrypter::SetIV(absl::string_view iv) {
return iv.empty();
}
bool MockEncrypter::EncryptPacket(uint64_t /*packet_number*/,
quiche::QuicheStringPiece associated_data,
quiche::QuicheStringPiece plaintext,
absl::string_view associated_data,
absl::string_view plaintext,
char* output,
size_t* output_length,
size_t max_output_length) {
@ -49,12 +48,12 @@ bool MockEncrypter::EncryptPacket(uint64_t /*packet_number*/,
return true;
}
bool MockEncrypter::SetHeaderProtectionKey(quiche::QuicheStringPiece key) {
bool MockEncrypter::SetHeaderProtectionKey(absl::string_view key) {
return key.empty();
}
std::string MockEncrypter::GenerateHeaderProtectionMask(
quiche::QuicheStringPiece sample) {
absl::string_view sample) {
return std::string(5, 0);
}
@ -78,12 +77,12 @@ size_t MockEncrypter::GetCiphertextSize(size_t plaintext_size) const {
return plaintext_size + kPaddingSize;
}
quiche::QuicheStringPiece MockEncrypter::GetKey() const {
return quiche::QuicheStringPiece();
absl::string_view MockEncrypter::GetKey() const {
return absl::string_view();
}
quiche::QuicheStringPiece MockEncrypter::GetNoncePrefix() const {
return quiche::QuicheStringPiece();
absl::string_view MockEncrypter::GetNoncePrefix() const {
return absl::string_view();
}
} // namespace net

@ -25,25 +25,24 @@ class MockEncrypter : public quic::QuicEncrypter {
~MockEncrypter() override {}
// QuicEncrypter implementation
bool SetKey(quiche::QuicheStringPiece key) override;
bool SetNoncePrefix(quiche::QuicheStringPiece nonce_prefix) override;
bool SetHeaderProtectionKey(quiche::QuicheStringPiece key) override;
bool SetIV(quiche::QuicheStringPiece iv) override;
bool SetKey(absl::string_view key) override;
bool SetNoncePrefix(absl::string_view nonce_prefix) override;
bool SetHeaderProtectionKey(absl::string_view key) override;
bool SetIV(absl::string_view iv) override;
bool EncryptPacket(uint64_t packet_number,
quiche::QuicheStringPiece associated_data,
quiche::QuicheStringPiece plaintext,
absl::string_view associated_data,
absl::string_view plaintext,
char* output,
size_t* output_length,
size_t max_output_length) override;
std::string GenerateHeaderProtectionMask(
quiche::QuicheStringPiece sample) override;
std::string GenerateHeaderProtectionMask(absl::string_view sample) override;
size_t GetKeySize() const override;
size_t GetNoncePrefixSize() const override;
size_t GetIVSize() const override;
size_t GetMaxPlaintextSize(size_t ciphertext_size) const override;
size_t GetCiphertextSize(size_t plaintext_size) const override;
quiche::QuicheStringPiece GetKey() const override;
quiche::QuicheStringPiece GetNoncePrefix() const override;
absl::string_view GetKey() const override;
absl::string_view GetNoncePrefix() const override;
private:
DISALLOW_COPY_AND_ASSIGN(MockEncrypter);

@ -13,9 +13,8 @@ namespace quic {
class QuicCertUtilsImpl {
public:
static bool ExtractSubjectNameFromDERCert(
quiche::QuicheStringPiece cert,
quiche::QuicheStringPiece* subject_out) {
static bool ExtractSubjectNameFromDERCert(absl::string_view cert,
absl::string_view* subject_out) {
base::StringPiece out;
bool result = net::asn1::ExtractSubjectFromDERCert(
base::StringViewToStringPiece(cert), &out);

@ -30,8 +30,7 @@ std::vector<std::string> ReadFileContentsImpl(const std::string& dirname) {
}
// Reads the contents of |filename| as a string into |contents|.
void ReadFileContentsImpl(quiche::QuicheStringPiece filename,
std::string* contents) {
void ReadFileContentsImpl(absl::string_view filename, std::string* contents) {
base::ReadFileToString(
FilePath::FromUTF8Unsafe(base::StringViewToStringPiece(filename)),
contents);

@ -12,7 +12,7 @@
namespace quic {
// static
bool QuicHostnameUtilsImpl::IsValidSNI(quiche::QuicheStringPiece sni) {
bool QuicHostnameUtilsImpl::IsValidSNI(absl::string_view sni) {
// TODO(rtenneti): Support RFC2396 hostname.
// NOTE: Microsoft does NOT enforce this spec, so if we throw away hostnames
// based on the above spec, we may be losing some hostnames that windows
@ -28,7 +28,7 @@ bool QuicHostnameUtilsImpl::IsValidSNI(quiche::QuicheStringPiece sni) {
// static
std::string QuicHostnameUtilsImpl::NormalizeHostname(
quiche::QuicheStringPiece hostname) {
absl::string_view hostname) {
url::CanonHostInfo host_info;
std::string host(net::CanonicalizeHost(
base::StringPiece(hostname.data(), hostname.size()), &host_info));

@ -17,11 +17,11 @@ class QUIC_EXPORT_PRIVATE QuicHostnameUtilsImpl {
// (1) disallow IP addresses;
// (2) check that the hostname contains valid characters only; and
// (3) contains at least one dot.
static bool IsValidSNI(quiche::QuicheStringPiece sni);
static bool IsValidSNI(absl::string_view sni);
// Convert hostname to lowercase and remove the trailing '.'.
// WARNING: mutates |hostname| in place and returns |hostname|.
static std::string NormalizeHostname(quiche::QuicheStringPiece hostname);
static std::string NormalizeHostname(absl::string_view hostname);
private:
DISALLOW_COPY_AND_ASSIGN(QuicHostnameUtilsImpl);

@ -28,8 +28,8 @@ class QUIC_EXPORT_PRIVATE QuicMemSliceSpanImpl {
~QuicMemSliceSpanImpl();
quiche::QuicheStringPiece GetData(size_t index) {
return quiche::QuicheStringPiece(buffers_[index]->data(), lengths_[index]);
absl::string_view GetData(size_t index) {
return absl::string_view(buffers_[index]->data(), lengths_[index]);
}
template <typename ConsumeFunction>

@ -17,8 +17,8 @@
namespace quic {
void QuicRecordTestOutputToFile(quiche::QuicheStringPiece filename,
quiche::QuicheStringPiece data) {
void QuicRecordTestOutputToFile(absl::string_view filename,
absl::string_view data) {
std::string output_dir;
if (!base::Environment::Create()->GetVar("QUIC_TEST_OUTPUT_DIR",
&output_dir) ||
@ -38,13 +38,12 @@ void QuicRecordTestOutputToFile(quiche::QuicheStringPiece filename,
QUIC_LOG(INFO) << "Recorded test output into " << path;
}
void QuicSaveTestOutputImpl(quiche::QuicheStringPiece filename,
quiche::QuicheStringPiece data) {
void QuicSaveTestOutputImpl(absl::string_view filename,
absl::string_view data) {
QuicRecordTestOutputToFile(filename, data);
}
bool QuicLoadTestOutputImpl(quiche::QuicheStringPiece filename,
std::string* data) {
bool QuicLoadTestOutputImpl(absl::string_view filename, std::string* data) {
std::string output_dir;
if (!base::Environment::Create()->GetVar("QUIC_TEST_OUTPUT_DIR",
&output_dir) ||
@ -61,8 +60,7 @@ bool QuicLoadTestOutputImpl(quiche::QuicheStringPiece filename,
return base::ReadFileToString(path, data);
}
void QuicRecordTraceImpl(quiche::QuicheStringPiece identifier,
quiche::QuicheStringPiece data) {
void QuicRecordTraceImpl(absl::string_view identifier, absl::string_view data) {
const testing::TestInfo* test_info =
testing::UnitTest::GetInstance()->current_test_info();

@ -9,14 +9,11 @@
namespace quic {
void QuicSaveTestOutputImpl(quiche::QuicheStringPiece filename,
quiche::QuicheStringPiece data);
void QuicSaveTestOutputImpl(absl::string_view filename, absl::string_view data);
bool QuicLoadTestOutputImpl(quiche::QuicheStringPiece filename,
std::string* data);
bool QuicLoadTestOutputImpl(absl::string_view filename, std::string* data);
void QuicRecordTraceImpl(quiche::QuicheStringPiece identifier,
quiche::QuicheStringPiece data);
void QuicRecordTraceImpl(absl::string_view identifier, absl::string_view data);
} // namespace quic

@ -10,7 +10,7 @@
namespace quic {
template <class T>
void AdjustTestValueImpl(quiche::QuicheStringPiece label, T* var) {}
void AdjustTestValueImpl(absl::string_view label, T* var) {}
} // namespace quic

@ -1687,7 +1687,7 @@ void QuicChromiumClientSession::OnCryptoHandshakeMessageReceived(
UMA_HISTOGRAM_CUSTOM_COUNTS("Net.QuicSession.RejectLength",
message.GetSerialized().length(), 1000, 10000,
50);
quiche::QuicheStringPiece proof;
absl::string_view proof;
UMA_HISTOGRAM_BOOLEAN("Net.QuicSession.RejectHasProof",
message.GetStringPiece(quic::kPROF, &proof));
}

@ -1223,7 +1223,7 @@ TEST_P(QuicChromiumClientSessionTest, PushStreamTimedOutWithResponse) {
GetNthServerInitiatedUnidirectionalStreamId(0), spdy::SpdyHeaderBlock());
// Read data on the pushed stream.
quic::QuicStreamFrame data(GetNthServerInitiatedUnidirectionalStreamId(0),
false, 0, quiche::QuicheStringPiece("SP"));
false, 0, absl::string_view("SP"));
session_->OnStreamFrame(data);
quic::QuicClientPromisedInfo* promised =
@ -1261,7 +1261,7 @@ TEST_P(QuicChromiumClientSessionTest, PendingStreamOnRst) {
CompleteCryptoHandshake();
quic::QuicStreamFrame data(GetNthServerInitiatedUnidirectionalStreamId(0),
false, 1, quiche::QuicheStringPiece("SP"));
false, 1, absl::string_view("SP"));
session_->OnStreamFrame(data);
EXPECT_EQ(0u, session_->GetNumActiveStreams());
quic::QuicRstStreamFrame rst(quic::kInvalidControlFrameId,
@ -1293,7 +1293,7 @@ TEST_P(QuicChromiumClientSessionTest, ClosePendingStream) {
CompleteCryptoHandshake();
quic::QuicStreamId id = GetNthServerInitiatedUnidirectionalStreamId(0);
quic::QuicStreamFrame data(id, false, 1, quiche::QuicheStringPiece("SP"));
quic::QuicStreamFrame data(id, false, 1, absl::string_view("SP"));
session_->OnStreamFrame(data);
EXPECT_EQ(0u, session_->GetNumActiveStreams());
session_->ResetStream(id, quic::QUIC_STREAM_NO_ERROR);
@ -1463,7 +1463,7 @@ TEST_P(QuicChromiumClientSessionTest, CancelPushAfterReceivingResponse) {
GetNthServerInitiatedUnidirectionalStreamId(0), spdy::SpdyHeaderBlock());
// Read data on the pushed stream.
quic::QuicStreamFrame data(GetNthServerInitiatedUnidirectionalStreamId(0),
false, 0, quiche::QuicheStringPiece("SP"));
false, 0, absl::string_view("SP"));
session_->OnStreamFrame(data);
quic::QuicClientPromisedInfo* promised =
@ -1900,7 +1900,7 @@ TEST_P(QuicChromiumClientSessionTest, MigrateToSocket) {
}
ack_and_data_out = client_maker_.MakeDataPacket(
packet_num++, GetNthClientInitiatedBidirectionalStreamId(0), true, false,
quiche::QuicheStringPiece(data));
absl::string_view(data));
std::unique_ptr<quic::QuicEncryptedPacket> server_ping(
server_maker_.MakePingPacket(1, /*include_version=*/false));
MockRead reads[] = {
@ -1944,7 +1944,7 @@ TEST_P(QuicChromiumClientSessionTest, MigrateToSocket) {
quic::test::QuicStreamPeer::SendBuffer(stream).SaveStreamData(iov, 1, 0, 4);
quic::test::QuicStreamPeer::SetStreamBytesWritten(4, stream);
session_->WritevData(stream->id(), 4, 0, quic::NO_FIN,
quic::NOT_RETRANSMISSION, QUICHE_NULLOPT);
quic::NOT_RETRANSMISSION, absl::nullopt);
EXPECT_TRUE(socket_data.AllReadDataConsumed());
EXPECT_TRUE(socket_data.AllWriteDataConsumed());

@ -556,7 +556,7 @@ size_t QuicChromiumClientStream::WriteHeaders(
return len;
}
bool QuicChromiumClientStream::WriteStreamData(quiche::QuicheStringPiece data,
bool QuicChromiumClientStream::WriteStreamData(absl::string_view data,
bool fin) {
// Must not be called when data is buffered.
DCHECK(!HasBufferedData());
@ -574,7 +574,7 @@ bool QuicChromiumClientStream::WritevStreamData(
// Writes the data, or buffers it.
for (size_t i = 0; i < buffers.size(); ++i) {
bool is_fin = fin && (i == buffers.size() - 1);
quiche::QuicheStringPiece string_data(buffers[i]->data(), lengths[i]);
absl::string_view string_data(buffers[i]->data(), lengths[i]);
WriteOrBufferBody(string_data, is_fin);
}
return !HasBufferedData(); // Was all data written?

@ -240,7 +240,7 @@ class NET_EXPORT_PRIVATE QuicChromiumClientStream
// Writes |data| to the peer and closes the write side if |fin| is true.
// Returns true if the data have been fully written. If the data was not fully
// written, returns false and OnCanWrite() will be invoked later.
bool WriteStreamData(quiche::QuicheStringPiece data, bool fin);
bool WriteStreamData(absl::string_view data, bool fin);
// Same as WriteStreamData except it writes data from a vector of IOBuffers,
// with the length of each buffer at the corresponding index in |lengths|.
bool WritevStreamData(const std::vector<scoped_refptr<IOBuffer>>& buffers,

@ -60,14 +60,14 @@ class MockQuicClientSessionBase : public quic::QuicSpdyClientSessionBase {
quic::QuicSpdyStream*(quic::PendingStream* pending));
MOCK_METHOD0(CreateOutgoingBidirectionalStream, QuicChromiumClientStream*());
MOCK_METHOD0(CreateOutgoingUnidirectionalStream, QuicChromiumClientStream*());
MOCK_METHOD6(WritevData,
quic::QuicConsumedData(
quic::QuicStreamId id,
size_t write_length,
quic::QuicStreamOffset offset,
quic::StreamSendingState state,
quic::TransmissionType type,
quiche::QuicheOptional<quic::EncryptionLevel> level));
MOCK_METHOD6(
WritevData,
quic::QuicConsumedData(quic::QuicStreamId id,
size_t write_length,
quic::QuicStreamOffset offset,
quic::StreamSendingState state,
quic::TransmissionType type,
absl::optional<quic::EncryptionLevel> level));
MOCK_METHOD4(SendRstStream,
void(quic::QuicStreamId stream_id,
quic::QuicRstStreamErrorCode error,
@ -76,7 +76,7 @@ class MockQuicClientSessionBase : public quic::QuicSpdyClientSessionBase {
MOCK_METHOD2(OnStreamHeaders,
void(quic::QuicStreamId stream_id,
quiche::QuicheStringPiece headers_data));
absl::string_view headers_data));
MOCK_METHOD2(OnStreamHeadersPriority,
void(quic::QuicStreamId stream_id,
const spdy::SpdyStreamPrecedence& precedence));
@ -84,7 +84,7 @@ class MockQuicClientSessionBase : public quic::QuicSpdyClientSessionBase {
void(quic::QuicStreamId stream_id, bool fin, size_t frame_len));
MOCK_METHOD2(OnPromiseHeaders,
void(quic::QuicStreamId stream_id,
quiche::QuicheStringPiece headers_data));
absl::string_view headers_data));
MOCK_METHOD3(OnPromiseHeadersComplete,
void(quic::QuicStreamId stream_id,
quic::QuicStreamId promised_stream_id,
@ -216,13 +216,13 @@ class QuicChromiumClientStreamTest
"JBCScs_ejbKaqBDoB7ZGxTvqlrB__2ZmnHHjCr8RgMRtKNtIeuZAo ";
}
void ReadData(quiche::QuicheStringPiece expected_data) {
void ReadData(absl::string_view expected_data) {
scoped_refptr<IOBuffer> buffer =
base::MakeRefCounted<IOBuffer>(expected_data.length() + 1);
EXPECT_EQ(static_cast<int>(expected_data.length()),
stream_->Read(buffer.get(), expected_data.length() + 1));
EXPECT_EQ(expected_data, quiche::QuicheStringPiece(buffer->data(),
expected_data.length()));
EXPECT_EQ(expected_data,
absl::string_view(buffer->data(), expected_data.length()));
}
quic::QuicHeaderList ProcessHeaders(const spdy::SpdyHeaderBlock& headers) {
@ -312,7 +312,7 @@ TEST_P(QuicChromiumClientStreamTest, Handle) {
quic::QuicStreamFrame frame2(
quic::test::GetNthClientInitiatedBidirectionalStreamId(
version_.transport_version, 0),
true, offset, quiche::QuicheStringPiece());
true, offset, absl::string_view());
stream_->OnStreamFrame(frame2);
EXPECT_TRUE(handle_->fin_received());
handle_->OnFinRead();
@ -417,7 +417,7 @@ TEST_P(QuicChromiumClientStreamTest, OnFinRead) {
quic::QuicStreamFrame frame2(
quic::test::GetNthClientInitiatedBidirectionalStreamId(
version_.transport_version, 0),
true, offset, quiche::QuicheStringPiece());
true, offset, absl::string_view());
stream_->OnStreamFrame(frame2);
}
@ -448,8 +448,8 @@ TEST_P(QuicChromiumClientStreamTest, OnDataAvailable) {
scoped_refptr<IOBuffer> buffer = base::MakeRefCounted<IOBuffer>(2 * data_len);
EXPECT_EQ(data_len,
handle_->ReadBody(buffer.get(), 2 * data_len, callback.callback()));
EXPECT_EQ(quiche::QuicheStringPiece(data),
quiche::QuicheStringPiece(buffer->data(), data_len));
EXPECT_EQ(absl::string_view(data),
absl::string_view(buffer->data(), data_len));
}
TEST_P(QuicChromiumClientStreamTest, OnDataAvailableAfterReadBody) {
@ -483,8 +483,8 @@ TEST_P(QuicChromiumClientStreamTest, OnDataAvailableAfterReadBody) {
/*offset=*/offset, data));
EXPECT_EQ(data_len, callback.WaitForResult());
EXPECT_EQ(quiche::QuicheStringPiece(data),
quiche::QuicheStringPiece(buffer->data(), data_len));
EXPECT_EQ(absl::string_view(data),
absl::string_view(buffer->data(), data_len));
base::RunLoop().RunUntilIdle();
}
@ -581,8 +581,8 @@ TEST_P(QuicChromiumClientStreamTest, OnTrailers) {
scoped_refptr<IOBuffer> buffer = base::MakeRefCounted<IOBuffer>(2 * data_len);
EXPECT_EQ(data_len,
handle_->ReadBody(buffer.get(), 2 * data_len, callback.callback()));
EXPECT_EQ(quiche::QuicheStringPiece(data),
quiche::QuicheStringPiece(buffer->data(), data_len));
EXPECT_EQ(absl::string_view(data),
absl::string_view(buffer->data(), data_len));
spdy::SpdyHeaderBlock trailers;
trailers["bar"] = "foo";
@ -637,8 +637,8 @@ TEST_P(QuicChromiumClientStreamTest, MarkTrailersConsumedWhenNotifyDelegate) {
scoped_refptr<IOBuffer> buffer = base::MakeRefCounted<IOBuffer>(2 * data_len);
EXPECT_EQ(data_len,
handle_->ReadBody(buffer.get(), 2 * data_len, callback.callback()));
EXPECT_EQ(quiche::QuicheStringPiece(data),
quiche::QuicheStringPiece(buffer->data(), data_len));
EXPECT_EQ(absl::string_view(data),
absl::string_view(buffer->data(), data_len));
// Read again, and it will be pending.
EXPECT_THAT(
@ -700,8 +700,8 @@ TEST_P(QuicChromiumClientStreamTest, ReadAfterTrailersReceivedButNotDelivered) {
scoped_refptr<IOBuffer> buffer = base::MakeRefCounted<IOBuffer>(2 * data_len);
EXPECT_EQ(data_len,
handle_->ReadBody(buffer.get(), 2 * data_len, callback.callback()));
EXPECT_EQ(quiche::QuicheStringPiece(data),
quiche::QuicheStringPiece(buffer->data(), data_len));
EXPECT_EQ(absl::string_view(data),
absl::string_view(buffer->data(), data_len));
// Deliver trailers. Delegate notification is posted asynchronously.
spdy::SpdyHeaderBlock trailers;
@ -939,8 +939,8 @@ TEST_P(QuicChromiumClientStreamTest, HeadersAndDataBeforeHandle) {
int data_len = base::size(data) - 1;
scoped_refptr<IOBuffer> buffer = base::MakeRefCounted<IOBuffer>(data_len + 1);
ASSERT_EQ(data_len, stream2->Read(buffer.get(), data_len + 1));
EXPECT_EQ(quiche::QuicheStringPiece(data),
quiche::QuicheStringPiece(buffer->data(), data_len));
EXPECT_EQ(absl::string_view(data),
absl::string_view(buffer->data(), data_len));
}
// Regression test for https://crbug.com/1043531.

@ -486,7 +486,7 @@ void QuicConnectionLogger::OnVersionNegotiationPacket(
void QuicConnectionLogger::OnCryptoHandshakeMessageReceived(
const quic::CryptoHandshakeMessage& message) {
if (message.tag() == quic::kSHLO) {
quiche::QuicheStringPiece address;
absl::string_view address;
quic::QuicSocketAddressCoder decoder;
if (message.GetStringPiece(quic::kCADR, &address) &&
decoder.Decode(address.data(), address.size())) {

@ -10,8 +10,7 @@
// Entry point for LibFuzzer.
extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
quiche::QuicheStringPiece crypto_input(reinterpret_cast<const char*>(data),
size);
absl::string_view crypto_input(reinterpret_cast<const char*>(data), size);
std::unique_ptr<quic::CryptoHandshakeMessage> handshake_message(
quic::CryptoFramer::ParseMessage(crypto_input));

@ -170,10 +170,10 @@ class QuicEndToEndTest : public ::testing::Test, public WithTaskEnvironment {
// Adds an entry to the cache used by the QUIC server to serve
// responses.
void AddToCache(quiche::QuicheStringPiece path,
void AddToCache(absl::string_view path,
int response_code,
quiche::QuicheStringPiece response_detail,
quiche::QuicheStringPiece body) {
absl::string_view response_detail,
absl::string_view body) {
memory_cache_backend_.AddSimpleResponse("test.example.com", path,
response_code, body);
}

@ -844,7 +844,7 @@ void QuicEventLogger::OnVersionNegotiationPacket(
void QuicEventLogger::OnCryptoHandshakeMessageReceived(
const quic::CryptoHandshakeMessage& message) {
if (message.tag() == quic::kSHLO) {
quiche::QuicheStringPiece address;
absl::string_view address;
quic::QuicSocketAddressCoder decoder;
if (message.GetStringPiece(quic::kCADR, &address) &&
decoder.Decode(address.data(), address.size())) {

@ -444,9 +444,6 @@ QUIC_FLAG(bool,
FLAGS_quic_reloadable_flag_quic_do_not_clip_received_error_code,
false)
// If true, check for NULL before sending a fallback config.
QUIC_FLAG(bool, FLAGS_quic_reloadable_flag_quic_check_fallback_null, true)
// If true, HTTP/3 sesions will report error and close connection upon receiving
// HTTP/2 only frames.
QUIC_FLAG(bool, FLAGS_quic_reloadable_flag_quic_reject_spdy_frames, false)
@ -474,3 +471,7 @@ QUIC_FLAG(bool, FLAGS_quic_reloadable_flag_quic_use_fast_huffman_encoder, false)
// When true, QUIC+TLS versions will support key updates.
QUIC_FLAG(bool, FLAGS_quic_reloadable_flag_quic_key_update_supported, false)
// If true, address is validated by successfully processing a HANDSHAKE or 1-RTT
// packet.
QUIC_FLAG(bool, FLAGS_quic_reloadable_flag_quic_fix_address_validation, false)

@ -465,7 +465,7 @@ class QuicHttpStreamTest : public ::testing::TestWithParam<TestParams>,
uint64_t packet_number,
bool should_include_version,
bool fin,
quiche::QuicheStringPiece data) {
absl::string_view data) {
return client_maker_.MakeDataPacket(packet_number, stream_id_,
should_include_version, fin, data);
}
@ -474,7 +474,7 @@ class QuicHttpStreamTest : public ::testing::TestWithParam<TestParams>,
uint64_t packet_number,
bool should_include_version,
bool fin,
quiche::QuicheStringPiece data) {
absl::string_view data) {
return server_maker_.MakeDataPacket(packet_number, stream_id_,
should_include_version, fin, data);
}

@ -518,7 +518,7 @@ class QuicNetworkTransactionTest
quic::QuicStreamId stream_id,
bool should_include_version,
bool fin,
quiche::QuicheStringPiece data) {
absl::string_view data) {
return server_maker_.MakeDataPacket(packet_number, stream_id,
should_include_version, fin, data);
}
@ -528,7 +528,7 @@ class QuicNetworkTransactionTest
quic::QuicStreamId stream_id,
bool should_include_version,
bool fin,
quiche::QuicheStringPiece data) {
absl::string_view data) {
return client_maker_->MakeDataPacket(packet_number, stream_id,
should_include_version, fin, data);
}
@ -540,7 +540,7 @@ class QuicNetworkTransactionTest
uint64_t largest_received,
uint64_t smallest_received,
bool fin,
quiche::QuicheStringPiece data) {
absl::string_view data) {
return client_maker_->MakeAckAndDataPacket(packet_number, include_version,
stream_id, largest_received,
smallest_received, fin, data);
@ -9684,10 +9684,9 @@ TEST_P(QuicNetworkTransactionTest, IncorrectHttp3GoAway) {
quic::QuicUtils::GetFirstUnidirectionalStreamId(
version_.transport_version, quic::Perspective::IS_SERVER);
mock_quic_data.AddRead(
ASYNC,
ConstructServerDataPacket(
read_packet_number++, control_stream_id, false, false,
quiche::QuicheStringPiece(goaway_buffer.get(), goaway_length)));
ASYNC, ConstructServerDataPacket(
read_packet_number++, control_stream_id, false, false,
absl::string_view(goaway_buffer.get(), goaway_length)));
mock_quic_data.AddWrite(
SYNCHRONOUS,
ConstructClientAckAndConnectionClosePacket(
@ -9761,10 +9760,9 @@ TEST_P(QuicNetworkTransactionTest, RetryOnHttp3GoAway) {
quic::QuicUtils::GetFirstUnidirectionalStreamId(
version_.transport_version, quic::Perspective::IS_SERVER);
mock_quic_data1.AddRead(
ASYNC,
ConstructServerDataPacket(
read_packet_number1++, control_stream_id, false, false,
quiche::QuicheStringPiece(goaway_buffer.get(), goaway_length)));
ASYNC, ConstructServerDataPacket(
read_packet_number1++, control_stream_id, false, false,
absl::string_view(goaway_buffer.get(), goaway_length)));
mock_quic_data1.AddWrite(
ASYNC, ConstructClientAckPacket(write_packet_number1++, 2, 1));

@ -411,7 +411,7 @@ class QuicProxyClientSocketTest : public ::testing::TestWithParam<TestParams>,
std::unique_ptr<quic::QuicReceivedPacket> ConstructDataPacket(
uint64_t packet_number,
quiche::QuicheStringPiece data) {
absl::string_view data) {
return client_maker_.MakeDataPacket(packet_number, client_data_stream_id1_,
!kIncludeVersion, !kFin, data);
}
@ -420,7 +420,7 @@ class QuicProxyClientSocketTest : public ::testing::TestWithParam<TestParams>,
uint64_t packet_number,
uint64_t largest_received,
uint64_t smallest_received,
quiche::QuicheStringPiece data) {
absl::string_view data) {
return client_maker_.MakeAckAndDataPacket(
packet_number, !kIncludeVersion, client_data_stream_id1_,
largest_received, smallest_received, !kFin, data);
@ -446,14 +446,14 @@ class QuicProxyClientSocketTest : public ::testing::TestWithParam<TestParams>,
std::unique_ptr<quic::QuicReceivedPacket> ConstructServerDataPacket(
uint64_t packet_number,
quiche::QuicheStringPiece data) {
absl::string_view data) {
return server_maker_.MakeDataPacket(packet_number, client_data_stream_id1_,
!kIncludeVersion, !kFin, data);
}
std::unique_ptr<quic::QuicReceivedPacket> ConstructServerDataFinPacket(
uint64_t packet_number,
quiche::QuicheStringPiece data) {
absl::string_view data) {
return server_maker_.MakeDataPacket(packet_number, client_data_stream_id1_,
!kIncludeVersion, kFin, data);
}

@ -849,7 +849,7 @@ class QuicStreamFactoryTestBase : public WithTaskEnvironment {
quic::QuicStreamId stream_id,
bool should_include_version,
bool fin,
quiche::QuicheStringPiece data) {
absl::string_view data) {
return server_maker_.MakeDataPacket(packet_number, stream_id,
should_include_version, fin, data);
}

@ -267,7 +267,7 @@ QuicTestPacketMaker::MakeRstAndDataPacket(
quic::QuicStreamId rst_stream_id,
quic::QuicRstStreamErrorCode rst_error_code,
quic::QuicStreamId data_stream_id,
quiche::QuicheStringPiece data) {
absl::string_view data) {
InitializeHeader(num, include_version);
AddQuicRstStreamFrame(rst_stream_id, rst_error_code);
@ -286,7 +286,7 @@ QuicTestPacketMaker::MakeDataAndRstPacket(
uint64_t num,
bool include_version,
quic::QuicStreamId data_stream_id,
quiche::QuicheStringPiece data,
absl::string_view data,
quic::QuicStreamId rst_stream_id,
quic::QuicRstStreamErrorCode rst_error_code) {
InitializeHeader(num, include_version);
@ -306,7 +306,7 @@ QuicTestPacketMaker::MakeDataRstAndAckPacket(
uint64_t num,
bool include_version,
quic::QuicStreamId data_stream_id,
quiche::QuicheStringPiece data,
absl::string_view data,
quic::QuicStreamId rst_stream_id,
quic::QuicRstStreamErrorCode rst_error_code,
uint64_t largest_received,
@ -415,7 +415,7 @@ QuicTestPacketMaker::MakeDataRstAndConnectionClosePacket(
uint64_t num,
bool include_version,
quic::QuicStreamId data_stream_id,
quiche::QuicheStringPiece data,
absl::string_view data,
quic::QuicStreamId rst_stream_id,
quic::QuicRstStreamErrorCode error_code,
quic::QuicErrorCode quic_error,
@ -439,7 +439,7 @@ QuicTestPacketMaker::MakeDataRstAckAndConnectionClosePacket(
uint64_t num,
bool include_version,
quic::QuicStreamId data_stream_id,
quiche::QuicheStringPiece data,
absl::string_view data,
quic::QuicStreamId rst_stream_id,
quic::QuicRstStreamErrorCode error_code,
uint64_t largest_received,
@ -520,7 +520,7 @@ std::unique_ptr<quic::QuicReceivedPacket> QuicTestPacketMaker::MakeDataPacket(
quic::QuicStreamId stream_id,
bool should_include_version,
bool fin,
quiche::QuicheStringPiece data) {
absl::string_view data) {
InitializeHeader(packet_number, should_include_version);
AddQuicStreamFrame(stream_id, fin, data);
return BuildPacket();
@ -533,7 +533,7 @@ QuicTestPacketMaker::MakeAckAndDataPacket(uint64_t packet_number,
uint64_t largest_received,
uint64_t smallest_received,
bool fin,
quiche::QuicheStringPiece data) {
absl::string_view data) {
InitializeHeader(packet_number, include_version);
AddQuicAckFrame(largest_received, smallest_received);
@ -580,14 +580,12 @@ QuicTestPacketMaker::MakeRequestHeadersAndMultipleDataFramesPacket(
if (spdy_headers_frame_length) {
*spdy_headers_frame_length = spdy_frame.size();
}
AddQuicStreamFrame(
GetHeadersStreamId(), false,
quiche::QuicheStringPiece(spdy_frame.data(), spdy_frame.size()));
AddQuicStreamFrame(GetHeadersStreamId(), false,
absl::string_view(spdy_frame.data(), spdy_frame.size()));
for (size_t i = 0; i < data_writes.size(); ++i) {
bool is_fin = fin && (i == data_writes.size() - 1);
AddQuicStreamFrame(stream_id, is_fin,
quiche::QuicheStringPiece(data_writes[i]));
AddQuicStreamFrame(stream_id, is_fin, absl::string_view(data_writes[i]));
}
return BuildPacket();
@ -625,9 +623,8 @@ QuicTestPacketMaker::MakeRequestHeadersPacket(
stream_id, fin, priority, std::move(headers), parent_stream_id);
if (spdy_headers_frame_length)
*spdy_headers_frame_length = spdy_frame.size();
AddQuicStreamFrame(
GetHeadersStreamId(), false,
quiche::QuicheStringPiece(spdy_frame.data(), spdy_frame.size()));
AddQuicStreamFrame(GetHeadersStreamId(), false,
absl::string_view(spdy_frame.data(), spdy_frame.size()));
return BuildPacket();
}
@ -665,9 +662,8 @@ QuicTestPacketMaker::MakeRequestHeadersAndRstPacket(
if (spdy_headers_frame_length) {
*spdy_headers_frame_length = spdy_frame.size();
}
AddQuicStreamFrame(
GetHeadersStreamId(), false,
quiche::QuicheStringPiece(spdy_frame.data(), spdy_frame.size()));
AddQuicStreamFrame(GetHeadersStreamId(), false,
absl::string_view(spdy_frame.data(), spdy_frame.size()));
AddQuicRstStreamFrame(stream_id, error_code);
@ -714,9 +710,8 @@ QuicTestPacketMaker::MakePushPromisePacket(
if (spdy_headers_frame_length) {
*spdy_headers_frame_length = spdy_frame.size();
}
AddQuicStreamFrame(
GetHeadersStreamId(), false,
quiche::QuicheStringPiece(spdy_frame.data(), spdy_frame.size()));
AddQuicStreamFrame(GetHeadersStreamId(), false,
absl::string_view(spdy_frame.data(), spdy_frame.size()));
return BuildPacket();
}
@ -748,9 +743,8 @@ QuicTestPacketMaker::MakeResponseHeadersPacket(
if (spdy_headers_frame_length) {
*spdy_headers_frame_length = spdy_frame.size();
}
AddQuicStreamFrame(
GetHeadersStreamId(), false,
quiche::QuicheStringPiece(spdy_frame.data(), spdy_frame.size()));
AddQuicStreamFrame(GetHeadersStreamId(), false,
absl::string_view(spdy_frame.data(), spdy_frame.size()));
return BuildPacket();
}
@ -767,9 +761,8 @@ QuicTestPacketMaker::MakeInitialSettingsPacket(uint64_t packet_number) {
quic::kDefaultMaximumBlockedStreams);
spdy::SpdySerializedFrame spdy_frame(
spdy_request_framer_.SerializeFrame(settings_frame));
AddQuicStreamFrame(
GetHeadersStreamId(), false,
quiche::QuicheStringPiece(spdy_frame.data(), spdy_frame.size()));
AddQuicStreamFrame(GetHeadersStreamId(), false,
absl::string_view(spdy_frame.data(), spdy_frame.size()));
return BuildPacket();
}
@ -797,9 +790,8 @@ QuicTestPacketMaker::MakePriorityPacket(uint64_t packet_number,
exclusive);
spdy::SpdySerializedFrame spdy_frame(
spdy_request_framer_.SerializeFrame(priority_frame));
AddQuicStreamFrame(
GetHeadersStreamId(), false,
quiche::QuicheStringPiece(spdy_frame.data(), spdy_frame.size()));
AddQuicStreamFrame(GetHeadersStreamId(), false,
absl::string_view(spdy_frame.data(), spdy_frame.size()));
return BuildPacket();
}
@ -835,9 +827,8 @@ QuicTestPacketMaker::MakeAckAndPriorityPacket(
exclusive);
spdy::SpdySerializedFrame spdy_frame(
spdy_request_framer_.SerializeFrame(priority_frame));
AddQuicStreamFrame(
GetHeadersStreamId(), false,
quiche::QuicheStringPiece(spdy_frame.data(), spdy_frame.size()));
AddQuicStreamFrame(GetHeadersStreamId(), false,
absl::string_view(spdy_frame.data(), spdy_frame.size()));
return BuildPacket();
}
@ -1106,7 +1097,7 @@ void QuicTestPacketMaker::AddQuicStreamsBlockedFrame(
void QuicTestPacketMaker::AddQuicStreamFrame(quic::QuicStreamId stream_id,
bool fin,
quiche::QuicheStringPiece data) {
absl::string_view data) {
AddQuicStreamFrameWithOffset(stream_id, fin, stream_offsets_[stream_id],
data);
stream_offsets_[stream_id] += data.length();
@ -1116,10 +1107,10 @@ void QuicTestPacketMaker::AddQuicStreamFrameWithOffset(
quic::QuicStreamId stream_id,
bool fin,
quic::QuicStreamOffset offset,
quiche::QuicheStringPiece data) {
absl::string_view data) {
// Save the stream data so that callers can use temporary objects for data.
saved_stream_data_.push_back(std::make_unique<std::string>(data));
quiche::QuicheStringPiece saved_data = *saved_stream_data_.back();
absl::string_view saved_data = *saved_stream_data_.back();
quic::QuicStreamFrame stream_frame(stream_id, fin, offset, saved_data);
frames_.push_back(quic::QuicFrame(stream_frame));

@ -105,13 +105,13 @@ class QuicTestPacketMaker {
quic::QuicStreamId rst_stream_id,
quic::QuicRstStreamErrorCode rst_error_code,
quic::QuicStreamId data_stream_id,
quiche::QuicheStringPiece data);
absl::string_view data);
std::unique_ptr<quic::QuicReceivedPacket> MakeDataAndRstPacket(
uint64_t num,
bool include_version,
quic::QuicStreamId data_stream_id,
quiche::QuicheStringPiece data,
absl::string_view data,
quic::QuicStreamId rst_stream_id,
quic::QuicRstStreamErrorCode rst_error_code);
@ -119,7 +119,7 @@ class QuicTestPacketMaker {
uint64_t num,
bool include_version,
quic::QuicStreamId data_stream_id,
quiche::QuicheStringPiece data,
absl::string_view data,
quic::QuicStreamId rst_stream_id,
quic::QuicRstStreamErrorCode rst_error_code,
uint64_t largest_received,
@ -164,7 +164,7 @@ class QuicTestPacketMaker {
uint64_t num,
bool include_version,
quic::QuicStreamId data_stream_id,
quiche::QuicheStringPiece data,
absl::string_view data,
quic::QuicStreamId rst_stream_id,
quic::QuicRstStreamErrorCode error_code,
quic::QuicErrorCode quic_error,
@ -175,7 +175,7 @@ class QuicTestPacketMaker {
uint64_t num,
bool include_version,
quic::QuicStreamId data_stream_id,
quiche::QuicheStringPiece data,
absl::string_view data,
quic::QuicStreamId rst_stream_id,
quic::QuicRstStreamErrorCode error_code,
uint64_t largest_received,
@ -219,7 +219,7 @@ class QuicTestPacketMaker {
quic::QuicStreamId stream_id,
bool should_include_version,
bool fin,
quiche::QuicheStringPiece data);
absl::string_view data);
std::unique_ptr<quic::QuicReceivedPacket> MakeAckAndDataPacket(
uint64_t packet_number,
@ -228,7 +228,7 @@ class QuicTestPacketMaker {
uint64_t largest_received,
uint64_t smallest_received,
bool fin,
quiche::QuicheStringPiece data);
absl::string_view data);
std::unique_ptr<quic::QuicReceivedPacket>
MakeRequestHeadersAndMultipleDataFramesPacket(
@ -385,12 +385,12 @@ class QuicTestPacketMaker {
// Use and increase stream's current offset.
void AddQuicStreamFrame(quic::QuicStreamId stream_id,
bool fin,
quiche::QuicheStringPiece data);
absl::string_view data);
// Use |offset| and do not change stream's current offset.
void AddQuicStreamFrameWithOffset(quic::QuicStreamId stream_id,
bool fin,
quic::QuicStreamOffset offset,
quiche::QuicheStringPiece data);
absl::string_view data);
void AddQuicAckFrame(uint64_t largest_received, uint64_t smallest_received);
void AddQuicAckFrame(uint64_t first_received,
uint64_t largest_received,

@ -40,9 +40,9 @@ class QuicPacketPrinter : public QuicFramerVisitorInterface {
}
void OnRetryPacket(QuicConnectionId original_connection_id,
QuicConnectionId new_connection_id,
quiche::QuicheStringPiece retry_token,
quiche::QuicheStringPiece retry_integrity_tag,
quiche::QuicheStringPiece retry_without_tag) override {
absl::string_view retry_token,
absl::string_view retry_integrity_tag,
absl::string_view retry_without_tag) override {
*output_ << "OnRetryPacket\n";
}
bool OnUnauthenticatedPublicHeader(const QuicPacketHeader& header) override {

@ -382,8 +382,7 @@ void QuicTransportClient::OnIncomingUnidirectionalStreamAvailable() {
visitor_->OnIncomingUnidirectionalStreamAvailable();
}
void QuicTransportClient::OnDatagramReceived(
quiche::QuicheStringPiece datagram) {
void QuicTransportClient::OnDatagramReceived(absl::string_view datagram) {
visitor_->OnDatagramReceived(base::StringViewToStringPiece(datagram));
}

@ -127,7 +127,7 @@ class NET_EXPORT QuicTransportClient
void OnSessionReady() override;
void OnIncomingBidirectionalStreamAvailable() override;
void OnIncomingUnidirectionalStreamAvailable() override;
void OnDatagramReceived(quiche::QuicheStringPiece datagram) override;
void OnDatagramReceived(absl::string_view datagram) override;
void OnCanCreateNewOutgoingBidirectionalStream() override;
void OnCanCreateNewOutgoingUnidirectionalStream() override;

@ -1,19 +0,0 @@
// Copyright 2018 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef NET_QUICHE_COMMON_PLATFORM_IMPL_QUICHE_OPTIONAL_IMPL_H_
#define NET_QUICHE_COMMON_PLATFORM_IMPL_QUICHE_OPTIONAL_IMPL_H_
#include "third_party/abseil-cpp/absl/types/optional.h"
namespace quiche {
template <typename T>
using QuicheOptionalImpl = absl::optional<T>;
#define QUICHE_NULLOPT_IMPL absl::nullopt
} // namespace quiche
#endif // NET_QUICHE_COMMON_PLATFORM_IMPL_QUICHE_OPTIONAL_IMPL_H_

@ -10,12 +10,8 @@
namespace quiche {
using QuicheStringPieceImpl = absl::string_view;
using QuicheStringPieceHashImpl = absl::Hash<absl::string_view>;
inline size_t QuicheHashStringPairImpl(QuicheStringPieceImpl a,
QuicheStringPieceImpl b) {
inline size_t QuicheHashStringPairImpl(absl::string_view a,
absl::string_view b) {
auto pair = std::make_pair(a, b);
return absl::Hash<decltype(pair)>()(pair);
}

@ -13,13 +13,13 @@
#include "base/strings/abseil_string_conversions.h"
#include "net/base/hex_utils.h"
#include "net/third_party/quiche/src/common/platform/api/quiche_optional.h"
#include "net/third_party/quiche/src/common/platform/api/quiche_string_piece.h"
#include "third_party/abseil-cpp/absl/strings/ascii.h"
#include "third_party/abseil-cpp/absl/strings/escaping.h"
#include "third_party/abseil-cpp/absl/strings/match.h"
#include "third_party/abseil-cpp/absl/strings/str_cat.h"
#include "third_party/abseil-cpp/absl/strings/str_split.h"
#include "third_party/abseil-cpp/absl/types/optional.h"
namespace quiche {
@ -27,52 +27,52 @@ namespace quiche {
class QuicheTextUtilsImpl {
public:
// Returns true of |data| starts with |prefix|, case sensitively.
static bool StartsWith(QuicheStringPiece data, QuicheStringPiece prefix) {
static bool StartsWith(absl::string_view data, absl::string_view prefix) {
return absl::StartsWith(data, prefix);
}
// Returns true if |data| end with |suffix|, case sensitively.
static bool EndsWith(QuicheStringPiece data, QuicheStringPiece suffix) {
static bool EndsWith(absl::string_view data, absl::string_view suffix) {
return absl::EndsWith(data, suffix);
}
// Returns true of |data| ends with |suffix|, case insensitively.
static bool EndsWithIgnoreCase(QuicheStringPiece data,
QuicheStringPiece suffix) {
static bool EndsWithIgnoreCase(absl::string_view data,
absl::string_view suffix) {
return absl::EndsWithIgnoreCase(data, suffix);
}
// Returns a new std::string in which |data| has been converted to lower case.
static std::string ToLower(QuicheStringPiece data) {
static std::string ToLower(absl::string_view data) {
return absl::AsciiStrToLower(data);
}
// Remove leading and trailing whitespace from |data|.
static void RemoveLeadingAndTrailingWhitespace(QuicheStringPiece* data) {
static void RemoveLeadingAndTrailingWhitespace(absl::string_view* data) {
*data = absl::StripAsciiWhitespace(*data);
}
// Returns true if |in| represents a valid uint64, and stores that value in
// |out|.
static bool StringToUint64(QuicheStringPiece in, uint64_t* out) {
static bool StringToUint64(absl::string_view in, uint64_t* out) {
return absl::SimpleAtoi(in, out);
}
// Returns true if |in| represents a valid int, and stores that value in
// |out|.
static bool StringToInt(QuicheStringPiece in, int* out) {
static bool StringToInt(absl::string_view in, int* out) {
return absl::SimpleAtoi(in, out);
}
// Returns true if |in| represents a valid uint32, and stores that value in
// |out|.
static bool StringToUint32(QuicheStringPiece in, uint32_t* out) {
static bool StringToUint32(absl::string_view in, uint32_t* out) {
return absl::SimpleAtoi(in, out);
}
// Returns true if |in| represents a valid size_t, and stores that value in
// |out|.
static bool StringToSizeT(QuicheStringPiece in, size_t* out) {
static bool StringToSizeT(absl::string_view in, size_t* out) {
return absl::SimpleAtoi(in, out);
}
@ -82,7 +82,7 @@ class QuicheTextUtilsImpl {
// This converts |length| bytes of binary to a 2*|length|-character
// hexadecimal representation.
// Return value: 2*|length| characters of ASCII std::string.
static std::string HexEncode(QuicheStringPiece data) {
static std::string HexEncode(absl::string_view data) {
return absl::BytesToHexString(data);
}
@ -90,7 +90,7 @@ class QuicheTextUtilsImpl {
// Converts |data| from a hexadecimal ASCII string to a binary string
// that is |data.length()/2| bytes long. On failure returns empty string.
static std::string HexDecode(QuicheStringPiece data) {
static std::string HexDecode(absl::string_view data) {
return absl::HexStringToBytes(data);
}
@ -115,10 +115,10 @@ class QuicheTextUtilsImpl {
// Decodes a base64-encoded |input|. Returns nullopt when the input is
// invalid.
static QuicheOptional<std::string> Base64Decode(QuicheStringPiece input) {
static absl::optional<std::string> Base64Decode(absl::string_view input) {
std::string output;
if (!absl::Base64Unescape(input, &output)) {
return QuicheOptional<std::string>();
return absl::optional<std::string>();
}
return output;
}
@ -128,22 +128,22 @@ class QuicheTextUtilsImpl {
// 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 std::string HexDump(QuicheStringPiece binary_input) {
static std::string HexDump(absl::string_view binary_input) {
return net::HexDump(base::StringViewToStringPiece(binary_input));
}
// Returns true if |data| contains any uppercase characters.
static bool ContainsUpperCase(QuicheStringPiece data) {
static bool ContainsUpperCase(absl::string_view data) {
return std::any_of(data.begin(), data.end(), absl::ascii_isupper);
}
// Returns true if |data| contains only decimal digits.
static bool IsAllDigits(QuicheStringPiece data) {
static bool IsAllDigits(absl::string_view data) {
return std::all_of(data.begin(), data.end(), absl::ascii_isdigit);
}
// Splits |data| into a vector of pieces delimited by |delim|.
static std::vector<QuicheStringPiece> Split(QuicheStringPiece data,
static std::vector<absl::string_view> Split(absl::string_view data,
char delim) {
return absl::StrSplit(data, delim);
}

@ -9,7 +9,7 @@
#include <iostream>
namespace quiche {
QuicheOptional<int64_t> QuicheUtcDateTimeToUnixSecondsInner(int year,
absl::optional<int64_t> QuicheUtcDateTimeToUnixSecondsInner(int year,
int month,
int day,
int hour,
@ -27,7 +27,7 @@ QuicheOptional<int64_t> QuicheUtcDateTimeToUnixSecondsInner(int year,
return (time - base::Time::UnixEpoch()).InSeconds();
}
QuicheOptional<int64_t> QuicheUtcDateTimeToUnixSecondsImpl(int year,
absl::optional<int64_t> QuicheUtcDateTimeToUnixSecondsImpl(int year,
int month,
int day,
int hour,

@ -8,11 +8,11 @@
#include <cstdint>
#include "net/base/net_export.h"
#include "net/third_party/quiche/src/common/platform/api/quiche_optional.h"
#include "third_party/abseil-cpp/absl/types/optional.h"
namespace quiche {
NET_EXPORT_PRIVATE QuicheOptional<int64_t> QuicheUtcDateTimeToUnixSecondsImpl(
NET_EXPORT_PRIVATE absl::optional<int64_t> QuicheUtcDateTimeToUnixSecondsImpl(
int year,
int month,
int day,

@ -107,8 +107,7 @@ size_t HpackFuzzUtil::SampleExponential(size_t mean, size_t sanity_bound) {
}
// static
bool HpackFuzzUtil::NextHeaderBlock(Input* input,
quiche::QuicheStringPiece* out) {
bool HpackFuzzUtil::NextHeaderBlock(Input* input, absl::string_view* out) {
// ClusterFuzz may truncate input files if the fuzzer ran out of allocated
// disk space. Be tolerant of these.
CHECK_LE(input->offset, input->input.size());
@ -123,7 +122,7 @@ bool HpackFuzzUtil::NextHeaderBlock(Input* input,
if (input->remaining() < length) {
return false;
}
*out = quiche::QuicheStringPiece(input->ptr(), length);
*out = absl::string_view(input->ptr(), length);
input->offset += length;
return true;
}
@ -144,7 +143,7 @@ void HpackFuzzUtil::InitializeFuzzerContext(FuzzerContext* context) {
// static
bool HpackFuzzUtil::RunHeaderBlockThroughFuzzerStages(
FuzzerContext* context,
quiche::QuicheStringPiece input_block) {
absl::string_view input_block) {
// First stage: Decode the input header block. This may fail on invalid input.
if (!context->first_stage->HandleControlFrameHeadersData(
input_block.data(), input_block.size())) {

@ -52,7 +52,7 @@ class HpackFuzzUtil {
// Returns true if the next header block was set at |out|. Returns
// false if no input header blocks remain.
static bool NextHeaderBlock(Input* input, quiche::QuicheStringPiece* out);
static bool NextHeaderBlock(Input* input, absl::string_view* out);
// Returns the serialized header block length prefix for a block of
// |block_size| bytes.
@ -73,9 +73,8 @@ class HpackFuzzUtil {
// Runs |input_block| through |first_stage| and, iff that succeeds,
// |second_stage| and |third_stage| as well. Returns whether all stages
// processed the input without error.
static bool RunHeaderBlockThroughFuzzerStages(
FuzzerContext* context,
quiche::QuicheStringPiece input_block);
static bool RunHeaderBlockThroughFuzzerStages(FuzzerContext* context,
absl::string_view input_block);
// Flips random bits within |buffer|. The total number of flips is
// |flip_per_thousand| bits for every 1,024 bytes of |buffer_length|,

@ -71,7 +71,7 @@ TEST(HpackFuzzUtilTest, ParsesSequenceOfHeaderBlocks) {
HpackFuzzUtil::Input input;
input.input.assign(fixture, base::size(fixture) - 1);
quiche::QuicheStringPiece block;
absl::string_view block;
EXPECT_TRUE(HpackFuzzUtil::NextHeaderBlock(&input, &block));
EXPECT_EQ("aaaaa", block);
@ -132,7 +132,7 @@ TEST(HpackFuzzUtilTest, ValidFuzzExamplesRegressionTest) {
HpackFuzzUtil::FuzzerContext context;
HpackFuzzUtil::InitializeFuzzerContext(&context);
quiche::QuicheStringPiece block;
absl::string_view block;
while (HpackFuzzUtil::NextHeaderBlock(&input, &block)) {
// As these are valid examples, all fuzz stages should succeed.
EXPECT_TRUE(

@ -8,7 +8,7 @@
namespace spdy {
bool SpdyHexDecodeToUInt32Impl(quiche::QuicheStringPiece data, uint32_t* out) {
bool SpdyHexDecodeToUInt32Impl(absl::string_view data, uint32_t* out) {
if (data.empty() || data.size() > 8u)
return false;
// Pad with leading zeros.

@ -34,13 +34,12 @@ inline char SpdyHexDigitToIntImpl(char c) {
return base::HexDigitToInt(c);
}
inline std::string SpdyHexDecodeImpl(quiche::QuicheStringPiece data) {
inline std::string SpdyHexDecodeImpl(absl::string_view data) {
return quiche::QuicheTextUtils::HexDecode(data);
}
NET_EXPORT_PRIVATE bool SpdyHexDecodeToUInt32Impl(
quiche::QuicheStringPiece data,
uint32_t* out);
NET_EXPORT_PRIVATE bool SpdyHexDecodeToUInt32Impl(absl::string_view data,
uint32_t* out);
inline std::string SpdyHexEncodeImpl(const char* bytes, size_t size) {
return quiche::QuicheTextUtils::HexEncode(bytes, size);
@ -50,12 +49,12 @@ inline std::string SpdyHexEncodeUInt32AndTrimImpl(uint32_t data) {
return base::StringPrintf("%x", data);
}
inline std::string SpdyHexDumpImpl(quiche::QuicheStringPiece data) {
inline std::string SpdyHexDumpImpl(absl::string_view data) {
return quiche::QuicheTextUtils::HexDump(data);
}
struct SpdyStringPieceCaseHashImpl {
size_t operator()(quiche::QuicheStringPiece data) const {
size_t operator()(absl::string_view data) const {
std::string lower = absl::AsciiStrToLower(data);
absl::Hash<absl::string_view> hasher;
return hasher(lower);
@ -63,8 +62,7 @@ struct SpdyStringPieceCaseHashImpl {
};
struct SpdyStringPieceCaseEqImpl {
bool operator()(quiche::QuicheStringPiece piece1,
quiche::QuicheStringPiece piece2) const {
bool operator()(absl::string_view piece1, absl::string_view piece2) const {
return absl::EqualsIgnoreCase(piece1, piece2);
}
};

@ -27,7 +27,6 @@ source_set("quiche") {
"src/common/platform/api/quiche_endian.h",
"src/common/platform/api/quiche_export.h",
"src/common/platform/api/quiche_logging.h",
"src/common/platform/api/quiche_optional.h",
"src/common/platform/api/quiche_ptr_util.h",
"src/common/platform/api/quiche_str_cat.h",
"src/common/platform/api/quiche_string_piece.h",

@ -207,8 +207,8 @@ class QuicTransport::Stream final {
}
DCHECK_EQ(result, MOJO_RESULT_OK);
bool send_result = outgoing_->Write(quiche::QuicheStringPiece(
reinterpret_cast<const char*>(data), available));
bool send_result = outgoing_->Write(
absl::string_view(reinterpret_cast<const char*>(data), available));
if (!send_result) {
// TODO(yhirano): Handle this failure.
readable_->EndReadData(0);