Use quiche string libraries in third_party/quic/core/http
gfe-relnote: n/a, no functional change
PiperOrigin-RevId: 285397956
Change-Id: I2f881affa932f79d84ea11c7ead81bd1dca9be4b
diff --git a/quic/core/http/end_to_end_test.cc b/quic/core/http/end_to_end_test.cc
index 0cdb5c7..d006acd 100644
--- a/quic/core/http/end_to_end_test.cc
+++ b/quic/core/http/end_to_end_test.cc
@@ -31,11 +31,8 @@
#include "net/third_party/quiche/src/quic/platform/api/quic_port_utils.h"
#include "net/third_party/quiche/src/quic/platform/api/quic_sleep.h"
#include "net/third_party/quiche/src/quic/platform/api/quic_socket_address.h"
-#include "net/third_party/quiche/src/quic/platform/api/quic_str_cat.h"
-#include "net/third_party/quiche/src/quic/platform/api/quic_string_piece.h"
#include "net/third_party/quiche/src/quic/platform/api/quic_test.h"
#include "net/third_party/quiche/src/quic/platform/api/quic_test_loopback.h"
-#include "net/third_party/quiche/src/quic/platform/api/quic_text_utils.h"
#include "net/quic/platform/impl/quic_socket_utils.h"
#include "net/third_party/quiche/src/quic/test_tools/bad_packet_writer.h"
#include "net/third_party/quiche/src/quic/test_tools/crypto_test_utils.h"
@@ -65,6 +62,9 @@
#include "net/third_party/quiche/src/quic/tools/quic_server.h"
#include "net/third_party/quiche/src/quic/tools/quic_simple_client_stream.h"
#include "net/third_party/quiche/src/quic/tools/quic_simple_server_stream.h"
+#include "net/third_party/quiche/src/common/platform/api/quiche_str_cat.h"
+#include "net/third_party/quiche/src/common/platform/api/quiche_string_piece.h"
+#include "net/third_party/quiche/src/common/platform/api/quiche_text_utils.h"
using spdy::kV3LowestPriority;
using spdy::SpdyFramer;
@@ -115,7 +115,7 @@
// Used by ::testing::PrintToStringParamName().
std::string PrintToString(const TestParams& p) {
- std::string rv = QuicStrCat(
+ std::string rv = quiche::QuicheStrCat(
ParsedQuicVersionToString(p.negotiated_version), "_Server_",
ParsedQuicVersionVectorToString(p.server_supported_versions), "_Client_",
ParsedQuicVersionVectorToString(p.client_supported_versions), "_",
@@ -476,9 +476,9 @@
}
}
- void AddToCache(QuicStringPiece path,
+ void AddToCache(quiche::QuicheStringPiece path,
int response_code,
- QuicStringPiece body) {
+ quiche::QuicheStringPiece body) {
memory_cache_backend_.AddSimpleResponse(server_hostname_, path,
response_code, body);
}
@@ -2903,7 +2903,7 @@
SpdyHeaderBlock headers;
headers[":status"] = "500";
headers["content-length"] =
- QuicTextUtils::Uint64ToString(response_body_.size());
+ quiche::QuicheTextUtils::Uint64ToString(response_body_.size());
// This method must call CloseReadSide to cause the test case, StopReading
// is not sufficient.
QuicStreamPeer::CloseReadSide(this);
@@ -3122,7 +3122,8 @@
SpdyHeaderBlock headers;
headers[":status"] = "200";
- headers["content-length"] = QuicTextUtils::Uint64ToString(kBody.size());
+ headers["content-length"] =
+ quiche::QuicheTextUtils::Uint64ToString(kBody.size());
SpdyHeaderBlock trailers;
trailers["some-trailing-header"] = "trailing-header-value";
@@ -3173,11 +3174,12 @@
std::string body =
use_large_response
? large_resource
- : QuicStrCat("This is server push response body for ", url);
+ : quiche::QuicheStrCat("This is server push response body for ",
+ url);
SpdyHeaderBlock response_headers;
response_headers[":status"] = "200";
response_headers["content-length"] =
- QuicTextUtils::Uint64ToString(body.size());
+ quiche::QuicheTextUtils::Uint64ToString(body.size());
push_resources.push_back(QuicBackendResponse::ServerPushInfo(
resource_url, std::move(response_headers), kV3LowestPriority, body));
}
@@ -3235,7 +3237,7 @@
for (const std::string& url : push_urls) {
QUIC_DVLOG(1) << "send request for pushed stream on url " << url;
std::string expected_body =
- QuicStrCat("This is server push response body for ", url);
+ quiche::QuicheStrCat("This is server push response body for ", url);
std::string response_body = client_->SendSynchronousRequest(url);
QUIC_DVLOG(1) << "response body " << response_body;
EXPECT_EQ(expected_body, response_body);
@@ -3288,7 +3290,7 @@
// as the responses are already in the client's cache.
QUIC_DVLOG(1) << "send request for pushed stream on url " << url;
std::string expected_body =
- QuicStrCat("This is server push response body for ", url);
+ quiche::QuicheStrCat("This is server push response body for ", url);
std::string response_body = client_->SendSynchronousRequest(url);
QUIC_DVLOG(1) << "response body " << response_body;
EXPECT_EQ(expected_body, response_body);
@@ -3327,7 +3329,8 @@
const size_t kNumResources = 1 + kNumMaxStreams; // 11.
std::string push_urls[11];
for (size_t i = 0; i < kNumResources; ++i) {
- push_urls[i] = QuicStrCat("https://example.com/push_resources", i);
+ push_urls[i] =
+ quiche::QuicheStrCat("https://example.com/push_resources", i);
}
AddRequestAndResponseWithServerPush("example.com", "/push_example", kBody,
push_urls, kNumResources, 0);
@@ -3344,8 +3347,9 @@
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),
- client_->SendSynchronousRequest(url));
+ EXPECT_EQ(
+ quiche::QuicheStrCat("This is server push response body for ", url),
+ client_->SendSynchronousRequest(url));
}
// Only 1 request should have been sent.
@@ -3385,7 +3389,7 @@
const size_t kNumResources = kNumMaxStreams + 1;
std::string push_urls[11];
for (size_t i = 0; i < kNumResources; ++i) {
- push_urls[i] = QuicStrCat("http://example.com/push_resources", i);
+ push_urls[i] = quiche::QuicheStrCat("http://example.com/push_resources", i);
}
AddRequestAndResponseWithServerPush("example.com", "/push_example", kBody,
push_urls, kNumResources, kBodySize);
@@ -3462,7 +3466,7 @@
headers[":scheme"] = "https";
headers[":authority"] = server_hostname_;
headers["content-length"] =
- QuicTextUtils::Uint64ToString(request_body_size_bytes);
+ quiche::QuicheTextUtils::Uint64ToString(request_body_size_bytes);
client_->SendMessage(headers, "", /*fin=*/false);
@@ -3794,9 +3798,9 @@
// (and the FIN) after the response body.
std::string response_body(1305, 'a');
SpdyHeaderBlock response_headers;
- response_headers[":status"] = QuicTextUtils::Uint64ToString(200);
+ response_headers[":status"] = quiche::QuicheTextUtils::Uint64ToString(200);
response_headers["content-length"] =
- QuicTextUtils::Uint64ToString(response_body.length());
+ quiche::QuicheTextUtils::Uint64ToString(response_body.length());
memory_cache_backend_.AddSpecialResponse(
server_hostname_, "/test_url", std::move(response_headers), response_body,
QuicBackendResponse::INCOMPLETE_RESPONSE);
@@ -3853,22 +3857,22 @@
ASSERT_LT(0, client_session->GetCurrentLargestMessagePayload());
std::string message_string(kMaxOutgoingPacketSize, 'a');
- QuicStringPiece message_buffer(message_string);
+ quiche::QuicheStringPiece message_buffer(message_string);
QuicRandom* random =
QuicConnectionPeer::GetHelper(client_connection)->GetRandomGenerator();
QuicMemSliceStorage storage(nullptr, 0, nullptr, 0);
{
QuicConnection::ScopedPacketFlusher flusher(client_session->connection());
// Verify the largest message gets successfully sent.
- EXPECT_EQ(
- MessageResult(MESSAGE_STATUS_SUCCESS, 1),
- client_session->SendMessage(MakeSpan(
- client_session->connection()
- ->helper()
- ->GetStreamSendBufferAllocator(),
- QuicStringPiece(message_buffer.data(),
- client_session->GetCurrentLargestMessagePayload()),
- &storage)));
+ EXPECT_EQ(MessageResult(MESSAGE_STATUS_SUCCESS, 1),
+ client_session->SendMessage(MakeSpan(
+ client_session->connection()
+ ->helper()
+ ->GetStreamSendBufferAllocator(),
+ quiche::QuicheStringPiece(
+ message_buffer.data(),
+ client_session->GetCurrentLargestMessagePayload()),
+ &storage)));
// Send more messages with size (0, largest_payload] until connection is
// write blocked.
const int kTestMaxNumberOfMessages = 100;
@@ -3881,7 +3885,8 @@
client_session->connection()
->helper()
->GetStreamSendBufferAllocator(),
- QuicStringPiece(message_buffer.data(), message_length), &storage));
+ quiche::QuicheStringPiece(message_buffer.data(), message_length),
+ &storage));
if (result.status == MESSAGE_STATUS_BLOCKED) {
// Connection is write blocked.
break;
@@ -3897,7 +3902,7 @@
client_session->connection()
->helper()
->GetStreamSendBufferAllocator(),
- QuicStringPiece(
+ quiche::QuicheStringPiece(
message_buffer.data(),
client_session->GetCurrentLargestMessagePayload() + 1),
&storage))
@@ -4026,9 +4031,9 @@
// frame for the stream.
std::string response_body(1305, 'a');
SpdyHeaderBlock response_headers;
- response_headers[":status"] = QuicTextUtils::Uint64ToString(200);
+ response_headers[":status"] = quiche::QuicheTextUtils::Uint64ToString(200);
response_headers["content-length"] =
- QuicTextUtils::Uint64ToString(response_body.length());
+ quiche::QuicheTextUtils::Uint64ToString(response_body.length());
memory_cache_backend_.AddStopSendingResponse(
server_hostname_, "/test_url", std::move(response_headers), response_body,
kStopSendingTestCode);
diff --git a/quic/core/http/http_decoder.cc b/quic/core/http/http_decoder.cc
index 41632a9..51c70e0 100644
--- a/quic/core/http/http_decoder.cc
+++ b/quic/core/http/http_decoder.cc
@@ -11,6 +11,7 @@
#include "net/third_party/quiche/src/quic/core/quic_types.h"
#include "net/third_party/quiche/src/quic/platform/api/quic_bug_tracker.h"
#include "net/third_party/quiche/src/quic/platform/api/quic_fallthrough.h"
+#include "net/third_party/quiche/src/common/platform/api/quiche_string_piece.h"
namespace quic {
@@ -190,7 +191,7 @@
case static_cast<uint64_t>(HttpFrameType::DATA): {
QuicByteCount bytes_to_read = std::min<QuicByteCount>(
remaining_frame_length_, reader->BytesRemaining());
- QuicStringPiece payload;
+ quiche::QuicheStringPiece payload;
bool success = reader->ReadStringPiece(&payload, bytes_to_read);
DCHECK(success);
DCHECK(!payload.empty());
@@ -201,7 +202,7 @@
case static_cast<uint64_t>(HttpFrameType::HEADERS): {
QuicByteCount bytes_to_read = std::min<QuicByteCount>(
remaining_frame_length_, reader->BytesRemaining());
- QuicStringPiece payload;
+ quiche::QuicheStringPiece payload;
bool success = reader->ReadStringPiece(&payload, bytes_to_read);
DCHECK(success);
DCHECK(!payload.empty());
@@ -277,7 +278,7 @@
if (bytes_to_read == 0) {
break;
}
- QuicStringPiece payload;
+ quiche::QuicheStringPiece payload;
bool success = reader->ReadStringPiece(&payload, bytes_to_read);
DCHECK(success);
DCHECK(!payload.empty());
@@ -300,7 +301,7 @@
default: {
QuicByteCount bytes_to_read = std::min<QuicByteCount>(
remaining_frame_length_, reader->BytesRemaining());
- QuicStringPiece payload;
+ quiche::QuicheStringPiece payload;
bool success = reader->ReadStringPiece(&payload, bytes_to_read);
DCHECK(success);
DCHECK(!payload.empty());
@@ -440,7 +441,7 @@
void HttpDecoder::DiscardFramePayload(QuicDataReader* reader) {
QuicByteCount bytes_to_read = std::min<QuicByteCount>(
remaining_frame_length_, reader->BytesRemaining());
- QuicStringPiece payload;
+ quiche::QuicheStringPiece payload;
bool success = reader->ReadStringPiece(&payload, bytes_to_read);
DCHECK(success);
remaining_frame_length_ -= payload.length();
diff --git a/quic/core/http/http_decoder.h b/quic/core/http/http_decoder.h
index 862c5de..1dc2225 100644
--- a/quic/core/http/http_decoder.h
+++ b/quic/core/http/http_decoder.h
@@ -11,7 +11,7 @@
#include "net/third_party/quiche/src/quic/core/quic_error_codes.h"
#include "net/third_party/quiche/src/quic/core/quic_types.h"
#include "net/third_party/quiche/src/quic/platform/api/quic_export.h"
-#include "net/third_party/quiche/src/quic/platform/api/quic_string_piece.h"
+#include "net/third_party/quiche/src/common/platform/api/quiche_string_piece.h"
namespace quic {
@@ -70,7 +70,7 @@
// Called when part of the payload of a DATA frame has been read. May be
// called multiple times for a single frame. |payload| is guaranteed to be
// non-empty.
- virtual bool OnDataFramePayload(QuicStringPiece payload) = 0;
+ virtual bool OnDataFramePayload(quiche::QuicheStringPiece payload) = 0;
// Called when a DATA frame has been completely processed.
virtual bool OnDataFrameEnd() = 0;
@@ -80,7 +80,7 @@
// Called when part of the payload of a HEADERS frame has been read. May be
// called multiple times for a single frame. |payload| is guaranteed to be
// non-empty.
- virtual bool OnHeadersFramePayload(QuicStringPiece payload) = 0;
+ virtual bool OnHeadersFramePayload(quiche::QuicheStringPiece payload) = 0;
// Called when a HEADERS frame has been completely processed.
// |frame_len| is the length of the HEADERS frame payload.
virtual bool OnHeadersFrameEnd() = 0;
@@ -94,7 +94,8 @@
// Called when part of the header block of a PUSH_PROMISE frame has been
// read. May be called multiple times for a single frame. |payload| is
// guaranteed to be non-empty.
- virtual bool OnPushPromiseFramePayload(QuicStringPiece payload) = 0;
+ virtual bool OnPushPromiseFramePayload(
+ quiche::QuicheStringPiece payload) = 0;
// Called when a PUSH_PROMISE frame has been completely processed.
virtual bool OnPushPromiseFrameEnd() = 0;
@@ -106,7 +107,7 @@
// Called when part of the payload of the unknown frame has been read. May
// be called multiple times for a single frame. |payload| is guaranteed to
// be non-empty.
- virtual bool OnUnknownFramePayload(QuicStringPiece payload) = 0;
+ virtual bool OnUnknownFramePayload(quiche::QuicheStringPiece payload) = 0;
// Called when the unknown frame has been completely processed.
virtual bool OnUnknownFrameEnd() = 0;
};
diff --git a/quic/core/http/http_decoder_test.cc b/quic/core/http/http_decoder_test.cc
index 751ca58..6796d25 100644
--- a/quic/core/http/http_decoder_test.cc
+++ b/quic/core/http/http_decoder_test.cc
@@ -12,10 +12,11 @@
#include "net/third_party/quiche/src/quic/core/quic_data_writer.h"
#include "net/third_party/quiche/src/quic/core/quic_versions.h"
#include "net/third_party/quiche/src/quic/platform/api/quic_arraysize.h"
-#include "net/third_party/quiche/src/quic/platform/api/quic_str_cat.h"
#include "net/third_party/quiche/src/quic/platform/api/quic_test.h"
-#include "net/third_party/quiche/src/quic/platform/api/quic_text_utils.h"
#include "net/third_party/quiche/src/quic/test_tools/quic_test_utils.h"
+#include "net/third_party/quiche/src/common/platform/api/quiche_str_cat.h"
+#include "net/third_party/quiche/src/common/platform/api/quiche_string_piece.h"
+#include "net/third_party/quiche/src/common/platform/api/quiche_text_utils.h"
using ::testing::_;
using ::testing::Eq;
@@ -50,21 +51,22 @@
MOCK_METHOD1(OnDuplicatePushFrame, bool(const DuplicatePushFrame& frame));
MOCK_METHOD1(OnDataFrameStart, bool(QuicByteCount header_length));
- MOCK_METHOD1(OnDataFramePayload, bool(QuicStringPiece payload));
+ MOCK_METHOD1(OnDataFramePayload, bool(quiche::QuicheStringPiece payload));
MOCK_METHOD0(OnDataFrameEnd, bool());
MOCK_METHOD1(OnHeadersFrameStart, bool(QuicByteCount header_length));
- MOCK_METHOD1(OnHeadersFramePayload, bool(QuicStringPiece payload));
+ MOCK_METHOD1(OnHeadersFramePayload, bool(quiche::QuicheStringPiece payload));
MOCK_METHOD0(OnHeadersFrameEnd, bool());
MOCK_METHOD1(OnPushPromiseFrameStart, bool(QuicByteCount header_length));
MOCK_METHOD2(OnPushPromiseFramePushId,
bool(PushId push_id, QuicByteCount push_id_length));
- MOCK_METHOD1(OnPushPromiseFramePayload, bool(QuicStringPiece payload));
+ MOCK_METHOD1(OnPushPromiseFramePayload,
+ bool(quiche::QuicheStringPiece payload));
MOCK_METHOD0(OnPushPromiseFrameEnd, bool());
MOCK_METHOD2(OnUnknownFrameStart, bool(uint64_t, QuicByteCount));
- MOCK_METHOD1(OnUnknownFramePayload, bool(QuicStringPiece));
+ MOCK_METHOD1(OnUnknownFramePayload, bool(quiche::QuicheStringPiece));
MOCK_METHOD0(OnUnknownFrameEnd, bool());
};
@@ -101,13 +103,13 @@
}
// Process |input| in a single call to HttpDecoder::ProcessInput().
- QuicByteCount ProcessInput(QuicStringPiece input) {
+ QuicByteCount ProcessInput(quiche::QuicheStringPiece input) {
return decoder_.ProcessInput(input.data(), input.size());
}
// Feed |input| to |decoder_| one character at a time,
// verifying that each character gets processed.
- void ProcessInputCharByChar(QuicStringPiece input) {
+ void ProcessInputCharByChar(quiche::QuicheStringPiece input) {
for (char c : input) {
EXPECT_EQ(1u, decoder_.ProcessInput(&c, 1));
}
@@ -115,8 +117,10 @@
// Append garbage to |input|, then process it in a single call to
// HttpDecoder::ProcessInput(). Verify that garbage is not read.
- QuicByteCount ProcessInputWithGarbageAppended(QuicStringPiece input) {
- std::string input_with_garbage_appended = QuicStrCat(input, "blahblah");
+ QuicByteCount ProcessInputWithGarbageAppended(
+ quiche::QuicheStringPiece input) {
+ std::string input_with_garbage_appended =
+ quiche::QuicheStrCat(input, "blahblah");
QuicByteCount processed_bytes = ProcessInput(input_with_garbage_appended);
// Guaranteed by HttpDecoder::ProcessInput() contract.
@@ -181,7 +185,7 @@
TEST_F(HttpDecoderTest, CancelPush) {
InSequence s;
- std::string input = QuicTextUtils::HexDecode(
+ std::string input = quiche::QuicheTextUtils::HexDecode(
"03" // type (CANCEL_PUSH)
"01" // length
"01"); // Push Id
@@ -208,17 +212,17 @@
TEST_F(HttpDecoderTest, PushPromiseFrame) {
InSequence s;
- std::string input =
- QuicStrCat(QuicTextUtils::HexDecode("05" // type (PUSH PROMISE)
- "0f" // length
- "C000000000000101"), // push id 257
- "Headers"); // headers
+ std::string input = quiche::QuicheStrCat(
+ quiche::QuicheTextUtils::HexDecode("05" // type (PUSH PROMISE)
+ "0f" // length
+ "C000000000000101"), // push id 257
+ "Headers"); // headers
// Visitor pauses processing.
EXPECT_CALL(visitor_, OnPushPromiseFrameStart(2)).WillOnce(Return(false));
EXPECT_CALL(visitor_, OnPushPromiseFramePushId(257, 8))
.WillOnce(Return(false));
- QuicStringPiece remaining_input(input);
+ quiche::QuicheStringPiece remaining_input(input);
QuicByteCount processed_bytes =
ProcessInputWithGarbageAppended(remaining_input);
EXPECT_EQ(2u, processed_bytes);
@@ -227,7 +231,8 @@
EXPECT_EQ(8u, processed_bytes);
remaining_input = remaining_input.substr(processed_bytes);
- EXPECT_CALL(visitor_, OnPushPromiseFramePayload(QuicStringPiece("Headers")))
+ EXPECT_CALL(visitor_,
+ OnPushPromiseFramePayload(quiche::QuicheStringPiece("Headers")))
.WillOnce(Return(false));
processed_bytes = ProcessInputWithGarbageAppended(remaining_input);
EXPECT_EQ(remaining_input.size(), processed_bytes);
@@ -240,7 +245,8 @@
// Process the full frame.
EXPECT_CALL(visitor_, OnPushPromiseFrameStart(2));
EXPECT_CALL(visitor_, OnPushPromiseFramePushId(257, 8));
- EXPECT_CALL(visitor_, OnPushPromiseFramePayload(QuicStringPiece("Headers")));
+ EXPECT_CALL(visitor_,
+ OnPushPromiseFramePayload(quiche::QuicheStringPiece("Headers")));
EXPECT_CALL(visitor_, OnPushPromiseFrameEnd());
EXPECT_EQ(input.size(), ProcessInput(input));
EXPECT_THAT(decoder_.error(), IsQuicNoError());
@@ -249,13 +255,20 @@
// Process the frame incrementally.
EXPECT_CALL(visitor_, OnPushPromiseFrameStart(2));
EXPECT_CALL(visitor_, OnPushPromiseFramePushId(257, 8));
- EXPECT_CALL(visitor_, OnPushPromiseFramePayload(QuicStringPiece("H")));
- EXPECT_CALL(visitor_, OnPushPromiseFramePayload(QuicStringPiece("e")));
- EXPECT_CALL(visitor_, OnPushPromiseFramePayload(QuicStringPiece("a")));
- EXPECT_CALL(visitor_, OnPushPromiseFramePayload(QuicStringPiece("d")));
- EXPECT_CALL(visitor_, OnPushPromiseFramePayload(QuicStringPiece("e")));
- EXPECT_CALL(visitor_, OnPushPromiseFramePayload(QuicStringPiece("r")));
- EXPECT_CALL(visitor_, OnPushPromiseFramePayload(QuicStringPiece("s")));
+ EXPECT_CALL(visitor_,
+ OnPushPromiseFramePayload(quiche::QuicheStringPiece("H")));
+ EXPECT_CALL(visitor_,
+ OnPushPromiseFramePayload(quiche::QuicheStringPiece("e")));
+ EXPECT_CALL(visitor_,
+ OnPushPromiseFramePayload(quiche::QuicheStringPiece("a")));
+ EXPECT_CALL(visitor_,
+ OnPushPromiseFramePayload(quiche::QuicheStringPiece("d")));
+ EXPECT_CALL(visitor_,
+ OnPushPromiseFramePayload(quiche::QuicheStringPiece("e")));
+ EXPECT_CALL(visitor_,
+ OnPushPromiseFramePayload(quiche::QuicheStringPiece("r")));
+ EXPECT_CALL(visitor_,
+ OnPushPromiseFramePayload(quiche::QuicheStringPiece("s")));
EXPECT_CALL(visitor_, OnPushPromiseFrameEnd());
ProcessInputCharByChar(input);
EXPECT_THAT(decoder_.error(), IsQuicNoError());
@@ -264,7 +277,8 @@
// Process push id incrementally and append headers with last byte of push id.
EXPECT_CALL(visitor_, OnPushPromiseFrameStart(2));
EXPECT_CALL(visitor_, OnPushPromiseFramePushId(257, 8));
- EXPECT_CALL(visitor_, OnPushPromiseFramePayload(QuicStringPiece("Headers")));
+ EXPECT_CALL(visitor_,
+ OnPushPromiseFramePayload(quiche::QuicheStringPiece("Headers")));
EXPECT_CALL(visitor_, OnPushPromiseFrameEnd());
ProcessInputCharByChar(input.substr(0, 9));
EXPECT_EQ(8u, ProcessInput(input.substr(9)));
@@ -275,7 +289,7 @@
TEST_F(HttpDecoderTest, CorruptPushPromiseFrame) {
InSequence s;
- std::string input = QuicTextUtils::HexDecode(
+ std::string input = quiche::QuicheTextUtils::HexDecode(
"05" // type (PUSH_PROMISE)
"01" // length
"40"); // first byte of two-byte varint push id
@@ -306,7 +320,7 @@
TEST_F(HttpDecoderTest, MaxPushId) {
InSequence s;
- std::string input = QuicTextUtils::HexDecode(
+ std::string input = quiche::QuicheTextUtils::HexDecode(
"0D" // type (MAX_PUSH_ID)
"01" // length
"01"); // Push Id
@@ -333,7 +347,7 @@
TEST_F(HttpDecoderTest, DuplicatePush) {
InSequence s;
- std::string input = QuicTextUtils::HexDecode(
+ std::string input = quiche::QuicheTextUtils::HexDecode(
"0E" // type (DUPLICATE_PUSH)
"01" // length
"01"); // Push Id
@@ -360,7 +374,7 @@
TEST_F(HttpDecoderTest, PriorityFrame) {
InSequence s;
- std::string input = QuicTextUtils::HexDecode(
+ std::string input = quiche::QuicheTextUtils::HexDecode(
"02" // type (PRIORITY)
"04" // length
"08" // request stream, request stream, exclusive
@@ -378,7 +392,7 @@
// Visitor pauses processing.
EXPECT_CALL(visitor_, OnPriorityFrameStart(2)).WillOnce(Return(false));
- QuicStringPiece remaining_input(input);
+ quiche::QuicheStringPiece remaining_input(input);
QuicByteCount processed_bytes =
ProcessInputWithGarbageAppended(remaining_input);
EXPECT_EQ(2u, processed_bytes);
@@ -404,7 +418,7 @@
EXPECT_THAT(decoder_.error(), IsQuicNoError());
EXPECT_EQ("", decoder_.error_detail());
- std::string input2 = QuicTextUtils::HexDecode(
+ std::string input2 = quiche::QuicheTextUtils::HexDecode(
"02" // type (PRIORITY)
"02" // length
"f8" // root of tree, root of tree, exclusive
@@ -470,7 +484,7 @@
TEST_F(HttpDecoderTest, SettingsFrame) {
InSequence s;
- std::string input = QuicTextUtils::HexDecode(
+ std::string input = quiche::QuicheTextUtils::HexDecode(
"04" // type (SETTINGS)
"07" // length
"01" // identifier (SETTINGS_QPACK_MAX_TABLE_CAPACITY)
@@ -486,7 +500,7 @@
frame.values[256] = 4;
// Visitor pauses processing.
- QuicStringPiece remaining_input(input);
+ quiche::QuicheStringPiece remaining_input(input);
EXPECT_CALL(visitor_, OnSettingsFrameStart(2)).WillOnce(Return(false));
QuicByteCount processed_bytes =
ProcessInputWithGarbageAppended(remaining_input);
@@ -550,7 +564,7 @@
}
TEST_F(HttpDecoderTest, DuplicateSettingsIdentifier) {
- std::string input = QuicTextUtils::HexDecode(
+ std::string input = quiche::QuicheTextUtils::HexDecode(
"04" // type (SETTINGS)
"04" // length
"01" // identifier
@@ -569,19 +583,20 @@
TEST_F(HttpDecoderTest, DataFrame) {
InSequence s;
- std::string input = QuicStrCat(QuicTextUtils::HexDecode("00" // type (DATA)
- "05"), // length
- "Data!"); // data
+ std::string input = quiche::QuicheStrCat(
+ quiche::QuicheTextUtils::HexDecode("00" // type (DATA)
+ "05"), // length
+ "Data!"); // data
// Visitor pauses processing.
EXPECT_CALL(visitor_, OnDataFrameStart(2)).WillOnce(Return(false));
- QuicStringPiece remaining_input(input);
+ quiche::QuicheStringPiece remaining_input(input);
QuicByteCount processed_bytes =
ProcessInputWithGarbageAppended(remaining_input);
EXPECT_EQ(2u, processed_bytes);
remaining_input = remaining_input.substr(processed_bytes);
- EXPECT_CALL(visitor_, OnDataFramePayload(QuicStringPiece("Data!")))
+ EXPECT_CALL(visitor_, OnDataFramePayload(quiche::QuicheStringPiece("Data!")))
.WillOnce(Return(false));
processed_bytes = ProcessInputWithGarbageAppended(remaining_input);
EXPECT_EQ(remaining_input.size(), processed_bytes);
@@ -593,7 +608,7 @@
// Process the full frame.
EXPECT_CALL(visitor_, OnDataFrameStart(2));
- EXPECT_CALL(visitor_, OnDataFramePayload(QuicStringPiece("Data!")));
+ EXPECT_CALL(visitor_, OnDataFramePayload(quiche::QuicheStringPiece("Data!")));
EXPECT_CALL(visitor_, OnDataFrameEnd());
EXPECT_EQ(input.size(), ProcessInput(input));
EXPECT_THAT(decoder_.error(), IsQuicNoError());
@@ -601,11 +616,11 @@
// Process the frame incrementally.
EXPECT_CALL(visitor_, OnDataFrameStart(2));
- EXPECT_CALL(visitor_, OnDataFramePayload(QuicStringPiece("D")));
- EXPECT_CALL(visitor_, OnDataFramePayload(QuicStringPiece("a")));
- EXPECT_CALL(visitor_, OnDataFramePayload(QuicStringPiece("t")));
- EXPECT_CALL(visitor_, OnDataFramePayload(QuicStringPiece("a")));
- EXPECT_CALL(visitor_, OnDataFramePayload(QuicStringPiece("!")));
+ EXPECT_CALL(visitor_, OnDataFramePayload(quiche::QuicheStringPiece("D")));
+ EXPECT_CALL(visitor_, OnDataFramePayload(quiche::QuicheStringPiece("a")));
+ EXPECT_CALL(visitor_, OnDataFramePayload(quiche::QuicheStringPiece("t")));
+ EXPECT_CALL(visitor_, OnDataFramePayload(quiche::QuicheStringPiece("a")));
+ EXPECT_CALL(visitor_, OnDataFramePayload(quiche::QuicheStringPiece("!")));
EXPECT_CALL(visitor_, OnDataFrameEnd());
ProcessInputCharByChar(input);
EXPECT_THAT(decoder_.error(), IsQuicNoError());
@@ -633,7 +648,7 @@
EXPECT_EQ("", decoder_.error_detail());
// Send data.
- EXPECT_CALL(visitor_, OnDataFramePayload(QuicStringPiece(input)));
+ EXPECT_CALL(visitor_, OnDataFramePayload(quiche::QuicheStringPiece(input)));
EXPECT_CALL(visitor_, OnDataFrameEnd());
EXPECT_EQ(2048u, decoder_.ProcessInput(input.data(), 2048));
EXPECT_THAT(decoder_.error(), IsQuicNoError());
@@ -669,7 +684,7 @@
TEST_F(HttpDecoderTest, GoAway) {
InSequence s;
- std::string input = QuicTextUtils::HexDecode(
+ std::string input = quiche::QuicheTextUtils::HexDecode(
"07" // type (GOAWAY)
"01" // length
"01"); // StreamId
@@ -696,20 +711,21 @@
TEST_F(HttpDecoderTest, HeadersFrame) {
InSequence s;
- std::string input =
- QuicStrCat(QuicTextUtils::HexDecode("01" // type (HEADERS)
- "07"), // length
- "Headers"); // headers
+ std::string input = quiche::QuicheStrCat(
+ quiche::QuicheTextUtils::HexDecode("01" // type (HEADERS)
+ "07"), // length
+ "Headers"); // headers
// Visitor pauses processing.
EXPECT_CALL(visitor_, OnHeadersFrameStart(2)).WillOnce(Return(false));
- QuicStringPiece remaining_input(input);
+ quiche::QuicheStringPiece remaining_input(input);
QuicByteCount processed_bytes =
ProcessInputWithGarbageAppended(remaining_input);
EXPECT_EQ(2u, processed_bytes);
remaining_input = remaining_input.substr(processed_bytes);
- EXPECT_CALL(visitor_, OnHeadersFramePayload(QuicStringPiece("Headers")))
+ EXPECT_CALL(visitor_,
+ OnHeadersFramePayload(quiche::QuicheStringPiece("Headers")))
.WillOnce(Return(false));
processed_bytes = ProcessInputWithGarbageAppended(remaining_input);
EXPECT_EQ(remaining_input.size(), processed_bytes);
@@ -721,7 +737,8 @@
// Process the full frame.
EXPECT_CALL(visitor_, OnHeadersFrameStart(2));
- EXPECT_CALL(visitor_, OnHeadersFramePayload(QuicStringPiece("Headers")));
+ EXPECT_CALL(visitor_,
+ OnHeadersFramePayload(quiche::QuicheStringPiece("Headers")));
EXPECT_CALL(visitor_, OnHeadersFrameEnd());
EXPECT_EQ(input.size(), ProcessInput(input));
EXPECT_THAT(decoder_.error(), IsQuicNoError());
@@ -729,13 +746,13 @@
// Process the frame incrementally.
EXPECT_CALL(visitor_, OnHeadersFrameStart(2));
- EXPECT_CALL(visitor_, OnHeadersFramePayload(QuicStringPiece("H")));
- EXPECT_CALL(visitor_, OnHeadersFramePayload(QuicStringPiece("e")));
- EXPECT_CALL(visitor_, OnHeadersFramePayload(QuicStringPiece("a")));
- EXPECT_CALL(visitor_, OnHeadersFramePayload(QuicStringPiece("d")));
- EXPECT_CALL(visitor_, OnHeadersFramePayload(QuicStringPiece("e")));
- EXPECT_CALL(visitor_, OnHeadersFramePayload(QuicStringPiece("r")));
- EXPECT_CALL(visitor_, OnHeadersFramePayload(QuicStringPiece("s")));
+ EXPECT_CALL(visitor_, OnHeadersFramePayload(quiche::QuicheStringPiece("H")));
+ EXPECT_CALL(visitor_, OnHeadersFramePayload(quiche::QuicheStringPiece("e")));
+ EXPECT_CALL(visitor_, OnHeadersFramePayload(quiche::QuicheStringPiece("a")));
+ EXPECT_CALL(visitor_, OnHeadersFramePayload(quiche::QuicheStringPiece("d")));
+ EXPECT_CALL(visitor_, OnHeadersFramePayload(quiche::QuicheStringPiece("e")));
+ EXPECT_CALL(visitor_, OnHeadersFramePayload(quiche::QuicheStringPiece("r")));
+ EXPECT_CALL(visitor_, OnHeadersFramePayload(quiche::QuicheStringPiece("s")));
EXPECT_CALL(visitor_, OnHeadersFrameEnd());
ProcessInputCharByChar(input);
EXPECT_THAT(decoder_.error(), IsQuicNoError());
@@ -744,7 +761,7 @@
TEST_F(HttpDecoderTest, EmptyDataFrame) {
InSequence s;
- std::string input = QuicTextUtils::HexDecode(
+ std::string input = quiche::QuicheTextUtils::HexDecode(
"00" // type (DATA)
"00"); // length
@@ -774,7 +791,7 @@
TEST_F(HttpDecoderTest, EmptyHeadersFrame) {
InSequence s;
- std::string input = QuicTextUtils::HexDecode(
+ std::string input = quiche::QuicheTextUtils::HexDecode(
"01" // type (HEADERS)
"00"); // length
@@ -804,7 +821,7 @@
TEST_F(HttpDecoderTest, PushPromiseFrameNoHeaders) {
InSequence s;
- std::string input = QuicTextUtils::HexDecode(
+ std::string input = quiche::QuicheTextUtils::HexDecode(
"05" // type (PUSH_PROMISE)
"01" // length
"01"); // Push Id
@@ -837,7 +854,7 @@
}
TEST_F(HttpDecoderTest, MalformedFrameWithOverlyLargePayload) {
- std::string input = QuicTextUtils::HexDecode(
+ std::string input = quiche::QuicheTextUtils::HexDecode(
"03" // type (CANCEL_PUSH)
"10" // length
"15"); // malformed payload
@@ -865,19 +882,20 @@
TEST_F(HttpDecoderTest, HeadersPausedThenData) {
InSequence s;
- std::string input =
- QuicStrCat(QuicTextUtils::HexDecode("01" // type (HEADERS)
- "07"), // length
- "Headers", // headers
- QuicTextUtils::HexDecode("00" // type (DATA)
- "05"), // length
- "Data!"); // data
+ std::string input = quiche::QuicheStrCat(
+ quiche::QuicheTextUtils::HexDecode("01" // type (HEADERS)
+ "07"), // length
+ "Headers", // headers
+ quiche::QuicheTextUtils::HexDecode("00" // type (DATA)
+ "05"), // length
+ "Data!"); // data
// Visitor pauses processing, maybe because header decompression is blocked.
EXPECT_CALL(visitor_, OnHeadersFrameStart(2));
- EXPECT_CALL(visitor_, OnHeadersFramePayload(QuicStringPiece("Headers")));
+ EXPECT_CALL(visitor_,
+ OnHeadersFramePayload(quiche::QuicheStringPiece("Headers")));
EXPECT_CALL(visitor_, OnHeadersFrameEnd()).WillOnce(Return(false));
- QuicStringPiece remaining_input(input);
+ quiche::QuicheStringPiece remaining_input(input);
QuicByteCount processed_bytes =
ProcessInputWithGarbageAppended(remaining_input);
EXPECT_EQ(9u, processed_bytes);
@@ -885,7 +903,7 @@
// Process DATA frame.
EXPECT_CALL(visitor_, OnDataFrameStart(2));
- EXPECT_CALL(visitor_, OnDataFramePayload(QuicStringPiece("Data!")));
+ EXPECT_CALL(visitor_, OnDataFramePayload(quiche::QuicheStringPiece("Data!")));
EXPECT_CALL(visitor_, OnDataFrameEnd());
processed_bytes = ProcessInput(remaining_input);
@@ -943,7 +961,7 @@
HttpDecoder decoder(&visitor_);
EXPECT_CALL(visitor_, OnError(&decoder));
- QuicStringPiece input(test_data.input);
+ quiche::QuicheStringPiece input(test_data.input);
decoder.ProcessInput(input.data(), input.size());
EXPECT_THAT(decoder.error(), IsError(QUIC_INVALID_FRAME_DATA));
EXPECT_EQ(test_data.error_message, decoder.error_detail());
@@ -952,7 +970,7 @@
HttpDecoder decoder(&visitor_);
EXPECT_CALL(visitor_, OnError(&decoder));
- QuicStringPiece input(test_data.input);
+ quiche::QuicheStringPiece input(test_data.input);
for (auto c : input) {
decoder.ProcessInput(&c, 1);
}
@@ -963,7 +981,7 @@
}
TEST_F(HttpDecoderTest, EmptyCancelPushFrame) {
- std::string input = QuicTextUtils::HexDecode(
+ std::string input = quiche::QuicheTextUtils::HexDecode(
"03" // type (CANCEL_PUSH)
"00"); // frame length
@@ -974,7 +992,7 @@
}
TEST_F(HttpDecoderTest, EmptySettingsFrame) {
- std::string input = QuicTextUtils::HexDecode(
+ std::string input = quiche::QuicheTextUtils::HexDecode(
"04" // type (SETTINGS)
"00"); // frame length
@@ -990,7 +1008,7 @@
// Regression test for https://crbug.com/1001823.
TEST_F(HttpDecoderTest, EmptyPushPromiseFrame) {
- std::string input = QuicTextUtils::HexDecode(
+ std::string input = quiche::QuicheTextUtils::HexDecode(
"05" // type (PUSH_PROMISE)
"00"); // frame length
@@ -1001,7 +1019,7 @@
}
TEST_F(HttpDecoderTest, EmptyGoAwayFrame) {
- std::string input = QuicTextUtils::HexDecode(
+ std::string input = quiche::QuicheTextUtils::HexDecode(
"07" // type (GOAWAY)
"00"); // frame length
@@ -1012,7 +1030,7 @@
}
TEST_F(HttpDecoderTest, EmptyMaxPushIdFrame) {
- std::string input = QuicTextUtils::HexDecode(
+ std::string input = quiche::QuicheTextUtils::HexDecode(
"0d" // type (MAX_PUSH_ID)
"00"); // frame length
@@ -1023,7 +1041,7 @@
}
TEST_F(HttpDecoderTest, EmptyDuplicatePushFrame) {
- std::string input = QuicTextUtils::HexDecode(
+ std::string input = quiche::QuicheTextUtils::HexDecode(
"0e" // type (DUPLICATE_PUSH)
"00"); // frame length
diff --git a/quic/core/http/http_frames.h b/quic/core/http/http_frames.h
index 215fa56..de0abc4 100644
--- a/quic/core/http/http_frames.h
+++ b/quic/core/http/http_frames.h
@@ -11,9 +11,9 @@
#include "net/third_party/quiche/src/quic/core/http/spdy_utils.h"
#include "net/third_party/quiche/src/quic/core/quic_types.h"
-#include "net/third_party/quiche/src/quic/platform/api/quic_str_cat.h"
-#include "net/third_party/quiche/src/quic/platform/api/quic_string_piece.h"
#include "net/third_party/quiche/src/quic/platform/api/quic_string_utils.h"
+#include "net/third_party/quiche/src/common/platform/api/quiche_str_cat.h"
+#include "net/third_party/quiche/src/common/platform/api/quiche_string_piece.h"
#include "net/third_party/quiche/src/spdy/core/spdy_framer.h"
namespace quic {
@@ -35,7 +35,7 @@
// DATA frames (type=0x0) convey arbitrary, variable-length sequences of
// octets associated with an HTTP request or response payload.
struct QUIC_EXPORT_PRIVATE DataFrame {
- QuicStringPiece data;
+ quiche::QuicheStringPiece data;
};
// 4.2.2. HEADERS
@@ -43,7 +43,7 @@
// The HEADERS frame (type=0x1) is used to carry a header block,
// compressed using QPACK.
struct QUIC_EXPORT_PRIVATE HeadersFrame {
- QuicStringPiece headers;
+ quiche::QuicheStringPiece headers;
};
// 4.2.3. PRIORITY
@@ -82,12 +82,12 @@
weight == rhs.weight;
}
std::string ToString() const {
- return QuicStrCat("Priority Frame : {prioritized_type: ", prioritized_type,
- ", dependency_type: ", dependency_type,
- ", exclusive: ", exclusive,
- ", prioritized_element_id: ", prioritized_element_id,
- ", element_dependency_id: ", element_dependency_id,
- ", weight: ", weight, "}");
+ return quiche::QuicheStrCat(
+ "Priority Frame : {prioritized_type: ", prioritized_type,
+ ", dependency_type: ", dependency_type, ", exclusive: ", exclusive,
+ ", prioritized_element_id: ", prioritized_element_id,
+ ", element_dependency_id: ", element_dependency_id,
+ ", weight: ", weight, "}");
}
friend QUIC_EXPORT_PRIVATE std::ostream& operator<<(std::ostream& os,
@@ -129,7 +129,7 @@
std::string ToString() const {
std::string s;
for (auto it : values) {
- std::string setting = QuicStrCat(
+ std::string setting = quiche::QuicheStrCat(
SpdyUtils::H3SettingsToString(
static_cast<Http3AndQpackSettingsIdentifiers>(it.first)),
" = ", it.second, "; ");
@@ -150,7 +150,7 @@
// set from server to client, as in HTTP/2.
struct QUIC_EXPORT_PRIVATE PushPromiseFrame {
PushId push_id;
- QuicStringPiece headers;
+ quiche::QuicheStringPiece headers;
bool operator==(const PushPromiseFrame& rhs) const {
return push_id == rhs.push_id && headers == rhs.headers;
diff --git a/quic/core/http/quic_header_list.cc b/quic/core/http/quic_header_list.cc
index cba3e58..cbf60ce 100644
--- a/quic/core/http/quic_header_list.cc
+++ b/quic/core/http/quic_header_list.cc
@@ -9,6 +9,7 @@
#include "net/third_party/quiche/src/quic/core/quic_packets.h"
#include "net/third_party/quiche/src/quic/platform/api/quic_flags.h"
+#include "net/third_party/quiche/src/common/platform/api/quiche_string_piece.h"
#include "net/third_party/quiche/src/spdy/core/spdy_protocol.h"
namespace quic {
@@ -35,7 +36,8 @@
<< "OnHeaderBlockStart called more than once!";
}
-void QuicHeaderList::OnHeader(QuicStringPiece name, QuicStringPiece value) {
+void QuicHeaderList::OnHeader(quiche::QuicheStringPiece name,
+ quiche::QuicheStringPiece value) {
// Avoid infinite buffering of headers. No longer store headers
// once the current headers are over the limit.
if (current_header_list_size_ < max_header_list_size_) {
diff --git a/quic/core/http/quic_header_list.h b/quic/core/http/quic_header_list.h
index cc6e7bc..c019ceb 100644
--- a/quic/core/http/quic_header_list.h
+++ b/quic/core/http/quic_header_list.h
@@ -13,7 +13,7 @@
#include "net/third_party/quiche/src/quic/platform/api/quic_bug_tracker.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_piece.h"
+#include "net/third_party/quiche/src/common/platform/api/quiche_string_piece.h"
#include "net/third_party/quiche/src/spdy/core/spdy_header_block.h"
#include "net/third_party/quiche/src/spdy/core/spdy_headers_handler_interface.h"
@@ -36,7 +36,8 @@
// From SpdyHeadersHandlerInteface.
void OnHeaderBlockStart() override;
- void OnHeader(QuicStringPiece name, QuicStringPiece value) override;
+ void OnHeader(quiche::QuicheStringPiece name,
+ quiche::QuicheStringPiece value) override;
void OnHeaderBlockEnd(size_t uncompressed_header_bytes,
size_t compressed_header_bytes) override;
diff --git a/quic/core/http/quic_headers_stream_test.cc b/quic/core/http/quic_headers_stream_test.cc
index 4cf11cc..35c74fc 100644
--- a/quic/core/http/quic_headers_stream_test.cc
+++ b/quic/core/http/quic_headers_stream_test.cc
@@ -18,14 +18,14 @@
#include "net/third_party/quiche/src/quic/platform/api/quic_expect_bug.h"
#include "net/third_party/quiche/src/quic/platform/api/quic_flags.h"
#include "net/third_party/quiche/src/quic/platform/api/quic_logging.h"
-#include "net/third_party/quiche/src/quic/platform/api/quic_str_cat.h"
-#include "net/third_party/quiche/src/quic/platform/api/quic_string_piece.h"
#include "net/third_party/quiche/src/quic/platform/api/quic_test.h"
#include "net/third_party/quiche/src/quic/test_tools/quic_connection_peer.h"
#include "net/third_party/quiche/src/quic/test_tools/quic_spdy_session_peer.h"
#include "net/third_party/quiche/src/quic/test_tools/quic_stream_peer.h"
#include "net/third_party/quiche/src/quic/test_tools/quic_test_utils.h"
#include "net/third_party/quiche/src/common/platform/api/quiche_endian.h"
+#include "net/third_party/quiche/src/common/platform/api/quiche_str_cat.h"
+#include "net/third_party/quiche/src/common/platform/api/quiche_string_piece.h"
#include "net/third_party/quiche/src/spdy/core/http2_frame_decoder_adapter.h"
#include "net/third_party/quiche/src/spdy/core/spdy_alt_svc_wire_format.h"
#include "net/third_party/quiche/src/spdy/core/spdy_protocol.h"
@@ -128,7 +128,7 @@
MOCK_METHOD2(OnContinuation, void(SpdyStreamId stream_id, bool end));
MOCK_METHOD3(OnAltSvc,
void(SpdyStreamId stream_id,
- QuicStringPiece origin,
+ quiche::QuicheStringPiece origin,
const SpdyAltSvcWireFormat::AlternativeServiceVector&
altsvc_vector));
MOCK_METHOD4(OnPriority,
@@ -163,7 +163,7 @@
// Used by ::testing::PrintToStringParamName().
std::string PrintToString(const TestParams& tp) {
- return QuicStrCat(
+ return quiche::QuicheStrCat(
ParsedQuicVersionToString(tp.version), "_",
(tp.perspective == Perspective::IS_CLIENT ? "client" : "server"));
}
@@ -244,7 +244,7 @@
return true;
}
- void SaveHeaderDataStringPiece(QuicStringPiece data) {
+ void SaveHeaderDataStringPiece(quiche::QuicheStringPiece data) {
saved_header_data_.append(data.data(), data.length());
}
@@ -661,30 +661,34 @@
SpdySerializedFrame frame(framer_->SerializeFrame(data));
EXPECT_CALL(
*connection_,
- CloseConnection(QUIC_INVALID_HEADERS_STREAM_DATA,
- QuicStrCat("Unsupported field of HTTP/2 SETTINGS frame: ",
- SETTINGS_MAX_CONCURRENT_STREAMS),
- _));
+ CloseConnection(
+ QUIC_INVALID_HEADERS_STREAM_DATA,
+ quiche::QuicheStrCat("Unsupported field of HTTP/2 SETTINGS frame: ",
+ SETTINGS_MAX_CONCURRENT_STREAMS),
+ _));
EXPECT_CALL(
*connection_,
- CloseConnection(QUIC_INVALID_HEADERS_STREAM_DATA,
- QuicStrCat("Unsupported field of HTTP/2 SETTINGS frame: ",
- SETTINGS_INITIAL_WINDOW_SIZE),
- _));
+ CloseConnection(
+ QUIC_INVALID_HEADERS_STREAM_DATA,
+ quiche::QuicheStrCat("Unsupported field of HTTP/2 SETTINGS frame: ",
+ SETTINGS_INITIAL_WINDOW_SIZE),
+ _));
if (session_.perspective() == Perspective::IS_CLIENT) {
- EXPECT_CALL(*connection_,
- CloseConnection(
- QUIC_INVALID_HEADERS_STREAM_DATA,
- QuicStrCat("Unsupported field of HTTP/2 SETTINGS frame: ",
- SETTINGS_ENABLE_PUSH),
- _));
+ EXPECT_CALL(
+ *connection_,
+ CloseConnection(
+ QUIC_INVALID_HEADERS_STREAM_DATA,
+ quiche::QuicheStrCat("Unsupported field of HTTP/2 SETTINGS frame: ",
+ SETTINGS_ENABLE_PUSH),
+ _));
}
EXPECT_CALL(
*connection_,
- CloseConnection(QUIC_INVALID_HEADERS_STREAM_DATA,
- QuicStrCat("Unsupported field of HTTP/2 SETTINGS frame: ",
- SETTINGS_MAX_FRAME_SIZE),
- _));
+ CloseConnection(
+ QUIC_INVALID_HEADERS_STREAM_DATA,
+ quiche::QuicheStrCat("Unsupported field of HTTP/2 SETTINGS frame: ",
+ SETTINGS_MAX_FRAME_SIZE),
+ _));
stream_frame_.data_buffer = frame.data();
stream_frame_.data_length = frame.size();
headers_stream_->OnStreamFrame(stream_frame_);
diff --git a/quic/core/http/quic_receive_control_stream.cc b/quic/core/http/quic_receive_control_stream.cc
index c949fa7..26d2e82 100644
--- a/quic/core/http/quic_receive_control_stream.cc
+++ b/quic/core/http/quic_receive_control_stream.cc
@@ -11,6 +11,7 @@
#include "net/third_party/quiche/src/quic/core/http/quic_spdy_session.h"
#include "net/third_party/quiche/src/quic/core/quic_types.h"
#include "net/third_party/quiche/src/quic/platform/api/quic_flags.h"
+#include "net/third_party/quiche/src/common/platform/api/quiche_string_piece.h"
namespace quic {
@@ -95,7 +96,7 @@
return false;
}
- bool OnDataFramePayload(QuicStringPiece /*payload*/) override {
+ bool OnDataFramePayload(quiche::QuicheStringPiece /*payload*/) override {
CloseConnectionOnWrongFrame("Data");
return false;
}
@@ -110,7 +111,7 @@
return false;
}
- bool OnHeadersFramePayload(QuicStringPiece /*payload*/) override {
+ bool OnHeadersFramePayload(quiche::QuicheStringPiece /*payload*/) override {
CloseConnectionOnWrongFrame("Headers");
return false;
}
@@ -131,7 +132,8 @@
return false;
}
- bool OnPushPromiseFramePayload(QuicStringPiece /*payload*/) override {
+ bool OnPushPromiseFramePayload(
+ quiche::QuicheStringPiece /*payload*/) override {
CloseConnectionOnWrongFrame("Push Promise");
return false;
}
@@ -147,7 +149,7 @@
return true;
}
- bool OnUnknownFramePayload(QuicStringPiece /* payload */) override {
+ bool OnUnknownFramePayload(quiche::QuicheStringPiece /* payload */) override {
// Ignore unknown frame types.
return true;
}
@@ -158,11 +160,11 @@
}
private:
- void CloseConnectionOnWrongFrame(QuicStringPiece frame_type) {
+ void CloseConnectionOnWrongFrame(quiche::QuicheStringPiece frame_type) {
// TODO(renjietang): Change to HTTP/3 error type.
stream_->session()->connection()->CloseConnection(
QUIC_HTTP_DECODER_ERROR,
- QuicStrCat(frame_type, " frame received on control stream"),
+ quiche::QuicheStrCat(frame_type, " frame received on control stream"),
ConnectionCloseBehavior::SEND_CONNECTION_CLOSE_PACKET);
}
diff --git a/quic/core/http/quic_receive_control_stream_test.cc b/quic/core/http/quic_receive_control_stream_test.cc
index 8418766..b9a2923 100644
--- a/quic/core/http/quic_receive_control_stream_test.cc
+++ b/quic/core/http/quic_receive_control_stream_test.cc
@@ -8,10 +8,11 @@
#include "net/third_party/quiche/src/quic/core/quic_types.h"
#include "net/third_party/quiche/src/quic/core/quic_utils.h"
#include "net/third_party/quiche/src/quic/platform/api/quic_ptr_util.h"
-#include "net/third_party/quiche/src/quic/platform/api/quic_text_utils.h"
#include "net/third_party/quiche/src/quic/test_tools/quic_spdy_session_peer.h"
#include "net/third_party/quiche/src/quic/test_tools/quic_stream_peer.h"
#include "net/third_party/quiche/src/quic/test_tools/quic_test_utils.h"
+#include "net/third_party/quiche/src/common/platform/api/quiche_string_piece.h"
+#include "net/third_party/quiche/src/common/platform/api/quiche_text_utils.h"
namespace quic {
namespace test {
@@ -43,7 +44,7 @@
// Used by ::testing::PrintToStringParamName().
std::string PrintToString(const TestParams& tp) {
- return QuicStrCat(
+ return quiche::QuicheStrCat(
ParsedQuicVersionToString(tp.version), "_",
(tp.perspective == Perspective::IS_CLIENT ? "client" : "server"));
}
@@ -88,7 +89,7 @@
session_.transport_version(), 3);
char type[] = {kControlStream};
- QuicStreamFrame data1(id, false, 0, QuicStringPiece(type, 1));
+ QuicStreamFrame data1(id, false, 0, quiche::QuicheStringPiece(type, 1));
session_.OnStreamFrame(data1);
receive_control_stream_ =
@@ -285,7 +286,7 @@
// Regression test for b/137554973: unknown frames should be consumed.
TEST_P(QuicReceiveControlStreamTest, ConsumeUnknownFrame) {
- std::string unknown_frame = QuicTextUtils::HexDecode(
+ std::string unknown_frame = quiche::QuicheTextUtils::HexDecode(
"21" // reserved frame type
"03" // payload length
"666f6f"); // payload "foo"
diff --git a/quic/core/http/quic_send_control_stream.cc b/quic/core/http/quic_send_control_stream.cc
index ed7cd7f..abb21ae 100644
--- a/quic/core/http/quic_send_control_stream.cc
+++ b/quic/core/http/quic_send_control_stream.cc
@@ -11,7 +11,7 @@
#include "net/third_party/quiche/src/quic/core/quic_types.h"
#include "net/third_party/quiche/src/quic/core/quic_utils.h"
#include "net/third_party/quiche/src/quic/platform/api/quic_arraysize.h"
-#include "net/third_party/quiche/src/quic/platform/api/quic_string_piece.h"
+#include "net/third_party/quiche/src/common/platform/api/quiche_string_piece.h"
namespace quic {
@@ -46,8 +46,8 @@
char data[sizeof(kControlStream)];
QuicDataWriter writer(QUIC_ARRAYSIZE(data), data);
writer.WriteVarInt62(kControlStream);
- WriteOrBufferData(QuicStringPiece(writer.data(), writer.length()), false,
- nullptr);
+ WriteOrBufferData(quiche::QuicheStringPiece(writer.data(), writer.length()),
+ false, nullptr);
SettingsFrame settings;
settings.values[SETTINGS_QPACK_MAX_TABLE_CAPACITY] =
@@ -66,7 +66,7 @@
if (spdy_session->debug_visitor() != nullptr) {
spdy_session->debug_visitor()->OnSettingsFrameSent(settings);
}
- WriteOrBufferData(QuicStringPiece(buffer.get(), frame_length),
+ WriteOrBufferData(quiche::QuicheStringPiece(buffer.get(), frame_length),
/*fin = */ false, nullptr);
settings_sent_ = true;
}
@@ -78,8 +78,8 @@
QuicByteCount frame_length =
HttpEncoder::SerializePriorityFrame(priority, &buffer);
QUIC_DVLOG(1) << "Control Stream " << id() << " is writing " << priority;
- WriteOrBufferData(QuicStringPiece(buffer.get(), frame_length), false,
- nullptr);
+ WriteOrBufferData(quiche::QuicheStringPiece(buffer.get(), frame_length),
+ false, nullptr);
}
void QuicSendControlStream::SendMaxPushIdFrame(PushId max_push_id) {
@@ -91,7 +91,7 @@
std::unique_ptr<char[]> buffer;
QuicByteCount frame_length =
HttpEncoder::SerializeMaxPushIdFrame(frame, &buffer);
- WriteOrBufferData(QuicStringPiece(buffer.get(), frame_length),
+ WriteOrBufferData(quiche::QuicheStringPiece(buffer.get(), frame_length),
/*fin = */ false, nullptr);
}
@@ -110,8 +110,8 @@
std::unique_ptr<char[]> buffer;
QuicByteCount frame_length =
HttpEncoder::SerializeGoAwayFrame(frame, &buffer);
- WriteOrBufferData(QuicStringPiece(buffer.get(), frame_length), false,
- nullptr);
+ WriteOrBufferData(quiche::QuicheStringPiece(buffer.get(), frame_length),
+ false, nullptr);
}
} // namespace quic
diff --git a/quic/core/http/quic_send_control_stream_test.cc b/quic/core/http/quic_send_control_stream_test.cc
index de2e705..9d3504e 100644
--- a/quic/core/http/quic_send_control_stream_test.cc
+++ b/quic/core/http/quic_send_control_stream_test.cc
@@ -6,10 +6,11 @@
#include <utility>
-#include "net/third_party/quiche/src/quic/platform/api/quic_text_utils.h"
#include "net/third_party/quiche/src/quic/test_tools/quic_config_peer.h"
#include "net/third_party/quiche/src/quic/test_tools/quic_spdy_session_peer.h"
#include "net/third_party/quiche/src/quic/test_tools/quic_test_utils.h"
+#include "net/third_party/quiche/src/common/platform/api/quiche_string_piece.h"
+#include "net/third_party/quiche/src/common/platform/api/quiche_text_utils.h"
namespace quic {
namespace test {
@@ -43,7 +44,7 @@
// Used by ::testing::PrintToStringParamName().
std::string PrintToString(const TestParams& tp) {
- return QuicStrCat(
+ return quiche::QuicheStrCat(
ParsedQuicVersionToString(tp.version), "_",
(tp.perspective == Perspective::IS_CLIENT ? "client" : "server"));
}
@@ -109,7 +110,7 @@
Initialize();
testing::InSequence s;
- std::string expected_write_data = QuicTextUtils::HexDecode(
+ std::string expected_write_data = quiche::QuicheTextUtils::HexDecode(
"00" // stream type: control stream
"04" // frame type: SETTINGS frame
"08" // frame length
@@ -141,7 +142,7 @@
send_control_stream_->MaybeSendSettingsFrame();
EXPECT_EQ(expected_write_data,
- QuicStringPiece(writer.data(), writer.length()));
+ quiche::QuicheStringPiece(writer.data(), writer.length()));
}
TEST_P(QuicSendControlStreamTest, WriteSettingsOnlyOnce) {
diff --git a/quic/core/http/quic_server_session_base_test.cc b/quic/core/http/quic_server_session_base_test.cc
index a1b1b3c..c13709e 100644
--- a/quic/core/http/quic_server_session_base_test.cc
+++ b/quic/core/http/quic_server_session_base_test.cc
@@ -36,6 +36,7 @@
#include "net/third_party/quiche/src/quic/test_tools/quic_test_utils.h"
#include "net/third_party/quiche/src/quic/tools/quic_memory_cache_backend.h"
#include "net/third_party/quiche/src/quic/tools/quic_simple_server_stream.h"
+#include "net/third_party/quiche/src/common/platform/api/quiche_string_piece.h"
using testing::_;
using testing::StrictMock;
@@ -235,7 +236,7 @@
// Open a stream, then reset it.
// Send two bytes of payload to open it.
QuicStreamFrame data1(GetNthClientInitiatedBidirectionalId(0), false, 0,
- QuicStringPiece("HT"));
+ quiche::QuicheStringPiece("HT"));
session_->OnStreamFrame(data1);
EXPECT_EQ(1u, session_->GetNumOpenIncomingStreams());
@@ -294,7 +295,7 @@
// Send two bytes of payload.
QuicStreamFrame data1(GetNthClientInitiatedBidirectionalId(0), false, 0,
- QuicStringPiece("HT"));
+ quiche::QuicheStringPiece("HT"));
session_->OnStreamFrame(data1);
// The stream should never be opened, now that the reset is received.
@@ -305,9 +306,9 @@
TEST_P(QuicServerSessionBaseTest, AcceptClosedStream) {
// Send (empty) compressed headers followed by two bytes of data.
QuicStreamFrame frame1(GetNthClientInitiatedBidirectionalId(0), false, 0,
- QuicStringPiece("\1\0\0\0\0\0\0\0HT"));
+ quiche::QuicheStringPiece("\1\0\0\0\0\0\0\0HT"));
QuicStreamFrame frame2(GetNthClientInitiatedBidirectionalId(1), false, 0,
- QuicStringPiece("\2\0\0\0\0\0\0\0HT"));
+ quiche::QuicheStringPiece("\2\0\0\0\0\0\0\0HT"));
session_->OnStreamFrame(frame1);
session_->OnStreamFrame(frame2);
EXPECT_EQ(2u, session_->GetNumOpenIncomingStreams());
@@ -336,9 +337,9 @@
// past the reset point of stream 3. As it's a closed stream we just drop the
// data on the floor, but accept the packet because it has data for stream 5.
QuicStreamFrame frame3(GetNthClientInitiatedBidirectionalId(0), false, 2,
- QuicStringPiece("TP"));
+ quiche::QuicheStringPiece("TP"));
QuicStreamFrame frame4(GetNthClientInitiatedBidirectionalId(1), false, 2,
- QuicStringPiece("TP"));
+ quiche::QuicheStringPiece("TP"));
session_->OnStreamFrame(frame3);
session_->OnStreamFrame(frame4);
// The stream should never be opened, now that the reset is received.
diff --git a/quic/core/http/quic_spdy_client_session_test.cc b/quic/core/http/quic_spdy_client_session_test.cc
index 685ffc7..d699c85 100644
--- a/quic/core/http/quic_spdy_client_session_test.cc
+++ b/quic/core/http/quic_spdy_client_session_test.cc
@@ -17,7 +17,6 @@
#include "net/third_party/quiche/src/quic/platform/api/quic_arraysize.h"
#include "net/third_party/quiche/src/quic/platform/api/quic_ptr_util.h"
#include "net/third_party/quiche/src/quic/platform/api/quic_socket_address.h"
-#include "net/third_party/quiche/src/quic/platform/api/quic_str_cat.h"
#include "net/third_party/quiche/src/quic/platform/api/quic_test.h"
#include "net/third_party/quiche/src/quic/test_tools/crypto_test_utils.h"
#include "net/third_party/quiche/src/quic/test_tools/mock_quic_spdy_client_stream.h"
@@ -28,6 +27,8 @@
#include "net/third_party/quiche/src/quic/test_tools/quic_session_peer.h"
#include "net/third_party/quiche/src/quic/test_tools/quic_spdy_session_peer.h"
#include "net/third_party/quiche/src/quic/test_tools/quic_test_utils.h"
+#include "net/third_party/quiche/src/common/platform/api/quiche_str_cat.h"
+#include "net/third_party/quiche/src/common/platform/api/quiche_string_piece.h"
using spdy::SpdyHeaderBlock;
using testing::_;
@@ -427,7 +428,7 @@
connection_->transport_version(), 3);
char type[] = {0x00};
- QuicStreamFrame data1(id, false, 0, QuicStringPiece(type, 1));
+ QuicStreamFrame data1(id, false, 0, quiche::QuicheStringPiece(type, 1));
session_->OnStreamFrame(data1);
} else {
id = QuicUtils::GetHeadersStreamId(connection_->transport_version());
@@ -457,7 +458,7 @@
connection_->transport_version(), 3);
char type[] = {0x00};
- QuicStreamFrame data1(id, false, 0, QuicStringPiece(type, 1));
+ QuicStreamFrame data1(id, false, 0, quiche::QuicheStringPiece(type, 1));
session_->OnStreamFrame(data1);
} else {
id = QuicUtils::GetHeadersStreamId(connection_->transport_version());
@@ -744,7 +745,7 @@
TEST_P(QuicSpdyClientSessionTest, ReceivingPromiseEnhanceYourCalm) {
for (size_t i = 0u; i < session_->get_max_promises(); i++) {
- push_promise_[":path"] = QuicStringPrintf("/bar%zu", i);
+ push_promise_[":path"] = quiche::QuicheStringPrintf("/bar%zu", i);
QuicStreamId id =
promised_stream_id_ +
@@ -762,7 +763,7 @@
// One more promise, this should be refused.
int i = session_->get_max_promises();
- push_promise_[":path"] = QuicStringPrintf("/bar%d", i);
+ push_promise_[":path"] = quiche::QuicheStringPrintf("/bar%d", i);
QuicStreamId id =
promised_stream_id_ +
@@ -922,7 +923,7 @@
connection_->transport_version(), promise_count);
auto headers = QuicHeaderList();
headers.OnHeaderBlockStart();
- headers.OnHeader(":path", QuicStrCat("/", promise_count));
+ headers.OnHeader(":path", quiche::QuicheStrCat("/", promise_count));
headers.OnHeader(":authority", "www.google.com");
headers.OnHeader(":method", "GET");
headers.OnHeader(":scheme", "https");
diff --git a/quic/core/http/quic_spdy_client_stream.cc b/quic/core/http/quic_spdy_client_stream.cc
index 5cbb79d..7232f76 100644
--- a/quic/core/http/quic_spdy_client_stream.cc
+++ b/quic/core/http/quic_spdy_client_stream.cc
@@ -11,6 +11,7 @@
#include "net/third_party/quiche/src/quic/core/http/spdy_utils.h"
#include "net/third_party/quiche/src/quic/core/quic_alarm.h"
#include "net/third_party/quiche/src/quic/platform/api/quic_logging.h"
+#include "net/third_party/quiche/src/common/platform/api/quiche_string_piece.h"
#include "net/third_party/quiche/src/spdy/core/spdy_protocol.h"
using spdy::SpdyHeaderBlock;
@@ -140,7 +141,7 @@
}
size_t QuicSpdyClientStream::SendRequest(SpdyHeaderBlock headers,
- QuicStringPiece body,
+ quiche::QuicheStringPiece body,
bool fin) {
QuicConnection::ScopedPacketFlusher flusher(session_->connection());
bool send_fin_with_headers = fin && body.empty();
diff --git a/quic/core/http/quic_spdy_client_stream.h b/quic/core/http/quic_spdy_client_stream.h
index 5cd27d4..dfb9270 100644
--- a/quic/core/http/quic_spdy_client_stream.h
+++ b/quic/core/http/quic_spdy_client_stream.h
@@ -10,7 +10,7 @@
#include "net/third_party/quiche/src/quic/core/http/quic_spdy_stream.h"
#include "net/third_party/quiche/src/quic/core/quic_packets.h"
-#include "net/third_party/quiche/src/quic/platform/api/quic_string_piece.h"
+#include "net/third_party/quiche/src/common/platform/api/quiche_string_piece.h"
#include "net/third_party/quiche/src/spdy/core/spdy_framer.h"
namespace quic {
@@ -52,7 +52,7 @@
// Serializes the headers and body, sends it to the server, and
// returns the number of bytes sent.
size_t SendRequest(spdy::SpdyHeaderBlock headers,
- QuicStringPiece body,
+ quiche::QuicheStringPiece body,
bool fin);
// Returns the response data.
diff --git a/quic/core/http/quic_spdy_client_stream_test.cc b/quic/core/http/quic_spdy_client_stream_test.cc
index 8c1501e..50224cb 100644
--- a/quic/core/http/quic_spdy_client_stream_test.cc
+++ b/quic/core/http/quic_spdy_client_stream_test.cc
@@ -14,10 +14,10 @@
#include "net/third_party/quiche/src/quic/platform/api/quic_logging.h"
#include "net/third_party/quiche/src/quic/platform/api/quic_socket_address.h"
#include "net/third_party/quiche/src/quic/platform/api/quic_test.h"
-#include "net/third_party/quiche/src/quic/platform/api/quic_text_utils.h"
#include "net/third_party/quiche/src/quic/test_tools/crypto_test_utils.h"
#include "net/third_party/quiche/src/quic/test_tools/quic_spdy_session_peer.h"
#include "net/third_party/quiche/src/quic/test_tools/quic_test_utils.h"
+#include "net/third_party/quiche/src/common/platform/api/quiche_text_utils.h"
using spdy::SpdyHeaderBlock;
using testing::_;
@@ -212,7 +212,7 @@
SpdyHeaderBlock trailer_block;
trailer_block["trailer key"] = "trailer value";
trailer_block[kFinalOffsetHeaderKey] =
- QuicTextUtils::Uint64ToString(body_.size());
+ quiche::QuicheTextUtils::Uint64ToString(body_.size());
auto trailers = AsHeaderList(trailer_block);
stream_->OnStreamHeaderList(true, trailers.uncompressed_header_bytes(),
trailers);
diff --git a/quic/core/http/quic_spdy_session.cc b/quic/core/http/quic_spdy_session.cc
index 2d38f86..23c0c63 100644
--- a/quic/core/http/quic_spdy_session.cc
+++ b/quic/core/http/quic_spdy_session.cc
@@ -22,8 +22,9 @@
#include "net/third_party/quiche/src/quic/platform/api/quic_flags.h"
#include "net/third_party/quiche/src/quic/platform/api/quic_logging.h"
#include "net/third_party/quiche/src/quic/platform/api/quic_stack_trace.h"
-#include "net/third_party/quiche/src/quic/platform/api/quic_str_cat.h"
-#include "net/third_party/quiche/src/quic/platform/api/quic_text_utils.h"
+#include "net/third_party/quiche/src/common/platform/api/quiche_str_cat.h"
+#include "net/third_party/quiche/src/common/platform/api/quiche_string_piece.h"
+#include "net/third_party/quiche/src/common/platform/api/quiche_text_utils.h"
#include "net/third_party/quiche/src/spdy/core/http2_frame_decoder_adapter.h"
using http2::Http2DecoderAdapter;
@@ -145,10 +146,10 @@
default:
break;
}
- CloseConnection(
- QuicStrCat("SPDY framing error: ",
- Http2DecoderAdapter::SpdyFramerErrorToString(error)),
- code);
+ CloseConnection(quiche::QuicheStrCat(
+ "SPDY framing error: ",
+ Http2DecoderAdapter::SpdyFramerErrorToString(error)),
+ code);
}
void OnDataFrameHeader(SpdyStreamId /*stream_id*/,
@@ -414,20 +415,22 @@
2 * max_inbound_header_list_size_);
}
-void QuicSpdySession::OnDecoderStreamError(QuicStringPiece error_message) {
+void QuicSpdySession::OnDecoderStreamError(
+ quiche::QuicheStringPiece error_message) {
DCHECK(VersionUsesHttp3(transport_version()));
CloseConnectionWithDetails(
QUIC_QPACK_DECODER_STREAM_ERROR,
- QuicStrCat("Decoder stream error: ", error_message));
+ quiche::QuicheStrCat("Decoder stream error: ", error_message));
}
-void QuicSpdySession::OnEncoderStreamError(QuicStringPiece error_message) {
+void QuicSpdySession::OnEncoderStreamError(
+ quiche::QuicheStringPiece error_message) {
DCHECK(VersionUsesHttp3(transport_version()));
CloseConnectionWithDetails(
QUIC_QPACK_ENCODER_STREAM_ERROR,
- QuicStrCat("Encoder stream error: ", error_message));
+ quiche::QuicheStrCat("Encoder stream error: ", error_message));
}
void QuicSpdySession::OnStreamHeadersPriority(
@@ -460,7 +463,8 @@
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)) {
+ if (!quiche::QuicheTextUtils::StringToSizeT(header_value,
+ &final_byte_offset)) {
connection()->CloseConnection(
QUIC_INVALID_HEADERS_STREAM_DATA,
"Trailers are malformed (no final offset)",
@@ -523,7 +527,7 @@
SpdyPriorityIR priority_frame(id, parent_stream_id, weight, exclusive);
SpdySerializedFrame frame(spdy_framer_.SerializeFrame(priority_frame));
headers_stream()->WriteOrBufferData(
- QuicStringPiece(frame.data(), frame.size()), false, nullptr);
+ quiche::QuicheStringPiece(frame.data(), frame.size()), false, nullptr);
return frame.size();
}
@@ -581,7 +585,7 @@
SpdySerializedFrame frame(spdy_framer_.SerializeFrame(push_promise));
headers_stream()->WriteOrBufferData(
- QuicStringPiece(frame.data(), frame.size()), false, nullptr);
+ quiche::QuicheStringPiece(frame.data(), frame.size()), false, nullptr);
return;
}
@@ -628,7 +632,8 @@
if (stream && stream->is_static()) {
QUIC_BUG << "GetOrCreateSpdyDataStream returns static stream " << stream_id;
connection()->CloseConnection(
- QUIC_INVALID_STREAM_ID, QuicStrCat("stream ", stream_id, " is static"),
+ QUIC_INVALID_STREAM_ID,
+ quiche::QuicheStrCat("stream ", stream_id, " is static"),
ConnectionCloseBehavior::SEND_CONNECTION_CLOSE_PACKET);
return nullptr;
}
@@ -681,7 +686,7 @@
}
SpdySerializedFrame frame(spdy_framer_.SerializeFrame(headers_frame));
headers_stream()->WriteOrBufferData(
- QuicStringPiece(frame.data(), frame.size()), false,
+ quiche::QuicheStringPiece(frame.data(), frame.size()), false,
std::move(ack_listener));
// Calculate compressed header block size without framing overhead.
@@ -766,7 +771,8 @@
if (IsConnected()) {
CloseConnectionWithDetails(
QUIC_INVALID_HEADERS_STREAM_DATA,
- QuicStrCat("Invalid value for SETTINGS_ENABLE_PUSH: ", value));
+ quiche::QuicheStrCat("Invalid value for SETTINGS_ENABLE_PUSH: ",
+ value));
}
return;
}
@@ -782,7 +788,8 @@
if (IsConnected()) {
CloseConnectionWithDetails(
QUIC_INVALID_HEADERS_STREAM_DATA,
- QuicStrCat("Unsupported field of HTTP/2 SETTINGS frame: ", id));
+ quiche::QuicheStrCat(
+ "Unsupported field of HTTP/2 SETTINGS frame: ", id));
}
}
break;
@@ -799,7 +806,8 @@
if (IsConnected()) {
CloseConnectionWithDetails(
QUIC_INVALID_HEADERS_STREAM_DATA,
- QuicStrCat("Unsupported field of HTTP/2 SETTINGS frame: ", id));
+ quiche::QuicheStrCat("Unsupported field of HTTP/2 SETTINGS frame: ",
+ id));
}
}
}
@@ -1062,12 +1070,13 @@
}
void QuicSpdySession::CloseConnectionOnDuplicateHttp3UnidirectionalStreams(
- QuicStringPiece type) {
- QUIC_PEER_BUG << QuicStrCat("Received a duplicate ", type,
- " stream: Closing connection.");
+ quiche::QuicheStringPiece type) {
+ QUIC_PEER_BUG << quiche::QuicheStrCat("Received a duplicate ", type,
+ " stream: Closing connection.");
// TODO(b/124216424): Change to HTTP_STREAM_CREATION_ERROR.
- CloseConnectionWithDetails(QUIC_INVALID_STREAM_ID,
- QuicStrCat(type, " stream is received twice."));
+ CloseConnectionWithDetails(
+ QUIC_INVALID_STREAM_ID,
+ quiche::QuicheStrCat(type, " stream is received twice."));
}
// static
diff --git a/quic/core/http/quic_spdy_session.h b/quic/core/http/quic_spdy_session.h
index 7e952c5..032ee12 100644
--- a/quic/core/http/quic_spdy_session.h
+++ b/quic/core/http/quic_spdy_session.h
@@ -24,7 +24,7 @@
#include "net/third_party/quiche/src/quic/core/quic_session.h"
#include "net/third_party/quiche/src/quic/core/quic_versions.h"
#include "net/third_party/quiche/src/quic/platform/api/quic_export.h"
-#include "net/third_party/quiche/src/quic/platform/api/quic_string_piece.h"
+#include "net/third_party/quiche/src/common/platform/api/quiche_string_piece.h"
#include "net/third_party/quiche/src/spdy/core/http2_frame_decoder_adapter.h"
namespace quic {
@@ -95,10 +95,10 @@
void Initialize() override;
// QpackEncoder::DecoderStreamErrorDelegate implementation.
- void OnDecoderStreamError(QuicStringPiece error_message) override;
+ void OnDecoderStreamError(quiche::QuicheStringPiece error_message) override;
// QpackDecoder::EncoderStreamErrorDelegate implementation.
- void OnEncoderStreamError(QuicStringPiece error_message) override;
+ void OnEncoderStreamError(quiche::QuicheStringPiece error_message) override;
// Called by |headers_stream_| when headers with a priority have been
// received for a stream. This method will only be called for server streams.
@@ -363,7 +363,7 @@
const spdy::SpdyStreamPrecedence& precedence);
void CloseConnectionOnDuplicateHttp3UnidirectionalStreams(
- QuicStringPiece type);
+ quiche::QuicheStringPiece type);
// Sends any data which should be sent at the start of a connection,
// including the initial SETTINGS frame, etc.
diff --git a/quic/core/http/quic_spdy_session_test.cc b/quic/core/http/quic_spdy_session_test.cc
index bf5004e..7503593 100644
--- a/quic/core/http/quic_spdy_session_test.cc
+++ b/quic/core/http/quic_spdy_session_test.cc
@@ -26,10 +26,7 @@
#include "net/third_party/quiche/src/quic/platform/api/quic_flags.h"
#include "net/third_party/quiche/src/quic/platform/api/quic_map_util.h"
#include "net/third_party/quiche/src/quic/platform/api/quic_ptr_util.h"
-#include "net/third_party/quiche/src/quic/platform/api/quic_str_cat.h"
-#include "net/third_party/quiche/src/quic/platform/api/quic_string_piece.h"
#include "net/third_party/quiche/src/quic/platform/api/quic_test.h"
-#include "net/third_party/quiche/src/quic/platform/api/quic_text_utils.h"
#include "net/third_party/quiche/src/quic/test_tools/qpack/qpack_encoder_peer.h"
#include "net/third_party/quiche/src/quic/test_tools/qpack/qpack_header_table_peer.h"
#include "net/third_party/quiche/src/quic/test_tools/qpack/qpack_test_utils.h"
@@ -42,6 +39,9 @@
#include "net/third_party/quiche/src/quic/test_tools/quic_stream_send_buffer_peer.h"
#include "net/third_party/quiche/src/quic/test_tools/quic_test_utils.h"
#include "net/third_party/quiche/src/common/platform/api/quiche_endian.h"
+#include "net/third_party/quiche/src/common/platform/api/quiche_str_cat.h"
+#include "net/third_party/quiche/src/common/platform/api/quiche_string_piece.h"
+#include "net/third_party/quiche/src/common/platform/api/quiche_text_utils.h"
#include "net/third_party/quiche/src/spdy/core/spdy_framer.h"
using spdy::kV3HighestPriority;
@@ -627,8 +627,8 @@
EXPECT_CALL(*connection_, SendControlFrame(_));
EXPECT_CALL(*connection_, OnStreamReset(closed_stream_id, _));
stream2->Reset(QUIC_BAD_APPLICATION_PAYLOAD);
- std::string msg =
- QuicStrCat("Marking unknown stream ", closed_stream_id, " blocked.");
+ std::string msg = quiche::QuicheStrCat("Marking unknown stream ",
+ closed_stream_id, " blocked.");
EXPECT_QUIC_BUG(session_.MarkConnectionLevelWriteBlocked(closed_stream_id),
msg);
}
@@ -1085,7 +1085,7 @@
TEST_P(QuicSpdySessionTestServer, RstStreamBeforeHeadersDecompressed) {
// Send two bytes of payload.
QuicStreamFrame data1(GetNthClientInitiatedBidirectionalId(0), false, 0,
- QuicStringPiece("HT"));
+ quiche::QuicheStringPiece("HT"));
session_.OnStreamFrame(data1);
EXPECT_EQ(1u, session_.GetNumOpenIncomingStreams());
@@ -1129,14 +1129,14 @@
id = GetNthClientInitiatedUnidirectionalStreamId(transport_version(), 3);
char type[] = {kControlStream};
- QuicStreamFrame data1(id, false, 0, QuicStringPiece(type, 1));
+ QuicStreamFrame data1(id, false, 0, quiche::QuicheStringPiece(type, 1));
session_.OnStreamFrame(data1);
} else {
id = QuicUtils::GetHeadersStreamId(transport_version());
}
// Send two bytes of payload.
- QuicStreamFrame data1(id, true, 0, QuicStringPiece("HT"));
+ QuicStreamFrame data1(id, true, 0, quiche::QuicheStringPiece("HT"));
EXPECT_CALL(*connection_,
CloseConnection(
QUIC_INVALID_STREAM_ID, "Attempt to close a static stream",
@@ -1151,7 +1151,7 @@
id = GetNthClientInitiatedUnidirectionalStreamId(transport_version(), 3);
char type[] = {kControlStream};
- QuicStreamFrame data1(id, false, 0, QuicStringPiece(type, 1));
+ QuicStreamFrame data1(id, false, 0, quiche::QuicheStringPiece(type, 1));
session_.OnStreamFrame(data1);
} else {
id = QuicUtils::GetHeadersStreamId(transport_version());
@@ -1170,7 +1170,7 @@
TEST_P(QuicSpdySessionTestServer, OnStreamFrameInvalidStreamId) {
// Send two bytes of payload.
QuicStreamFrame data1(QuicUtils::GetInvalidStreamId(transport_version()),
- true, 0, QuicStringPiece("HT"));
+ true, 0, quiche::QuicheStringPiece("HT"));
EXPECT_CALL(*connection_,
CloseConnection(
QUIC_INVALID_STREAM_ID, "Received data for an invalid stream",
@@ -1320,8 +1320,8 @@
while (!headers_stream->flow_controller()->IsBlocked() && stream_id < 2000) {
EXPECT_FALSE(session_.IsConnectionFlowControlBlocked());
EXPECT_FALSE(session_.IsStreamFlowControlBlocked());
- headers["header"] = QuicStrCat(random.RandUint64(), random.RandUint64(),
- random.RandUint64());
+ headers["header"] = quiche::QuicheStrCat(
+ random.RandUint64(), random.RandUint64(), random.RandUint64());
session_.WriteHeadersOnHeadersStream(stream_id, headers.Clone(), true,
spdy::SpdyStreamPrecedence(0),
nullptr);
@@ -1447,7 +1447,8 @@
// account the total number of bytes sent by the peer.
const QuicStreamOffset kByteOffset = 5678;
std::string body = "hello";
- QuicStreamFrame frame(stream->id(), true, kByteOffset, QuicStringPiece(body));
+ QuicStreamFrame frame(stream->id(), true, kByteOffset,
+ quiche::QuicheStringPiece(body));
session_.OnStreamFrame(frame);
QuicStreamOffset total_stream_bytes_sent_by_peer =
@@ -1564,7 +1565,8 @@
EXPECT_CALL(*connection_, SendControlFrame(_));
EXPECT_CALL(*connection_, OnStreamReset(stream->id(), _));
stream->Reset(QUIC_STREAM_CANCELLED);
- QuicStreamFrame frame(stream->id(), true, kLargeOffset, QuicStringPiece());
+ QuicStreamFrame frame(stream->id(), true, kLargeOffset,
+ quiche::QuicheStringPiece());
session_.OnStreamFrame(frame);
// Check that RST results in connection close.
@@ -1630,7 +1632,7 @@
// FIN or a RST_STREAM from the client.
const QuicStreamId kNextId = QuicUtils::StreamIdDelta(transport_version());
for (QuicStreamId i = kFirstStreamId; i < kFinalStreamId; i += kNextId) {
- QuicStreamFrame data1(i, false, 0, QuicStringPiece("HT"));
+ QuicStreamFrame data1(i, false, 0, quiche::QuicheStringPiece("HT"));
session_.OnStreamFrame(data1);
// EXPECT_EQ(1u, session_.GetNumOpenStreams());
if (!VersionHasIetfQuicFrames(transport_version())) {
@@ -1666,7 +1668,8 @@
_));
}
// Create one more data streams to exceed limit of open stream.
- QuicStreamFrame data1(kFinalStreamId, false, 0, QuicStringPiece("HT"));
+ QuicStreamFrame data1(kFinalStreamId, false, 0,
+ quiche::QuicheStringPiece("HT"));
session_.OnStreamFrame(data1);
}
@@ -1701,7 +1704,7 @@
const QuicStreamId kFinalStreamId =
GetNthClientInitiatedBidirectionalId(kMaxStreams + 1);
for (QuicStreamId i = kFirstStreamId; i < kFinalStreamId; i += IdDelta()) {
- QuicStreamFrame data1(i, true, 0, QuicStringPiece("HT"));
+ QuicStreamFrame data1(i, true, 0, quiche::QuicheStringPiece("HT"));
session_.OnStreamFrame(data1);
EXPECT_EQ(1u, session_.GetNumOpenIncomingStreams());
session_.StreamDraining(i);
@@ -1815,7 +1818,7 @@
QuicStreamPeer::CloseReadSide(stream);
// Receive a stream data frame with FIN.
- QuicStreamFrame frame(stream_id, true, 0, QuicStringPiece());
+ QuicStreamFrame frame(stream_id, true, 0, quiche::QuicheStringPiece());
session_.OnStreamFrame(frame);
EXPECT_TRUE(stream->fin_received());
@@ -1869,8 +1872,8 @@
const QuicMemSlice& slice =
QuicStreamSendBufferPeer::CurrentWriteSlice(&send_buffer)->slice;
- EXPECT_EQ(QuicStringPiece(frame.data(), frame.size()),
- QuicStringPiece(slice.data(), slice.length()));
+ EXPECT_EQ(quiche::QuicheStringPiece(frame.data(), frame.size()),
+ quiche::QuicheStringPiece(slice.data(), slice.length()));
}
TEST_P(QuicSpdySessionTestClient, Http3ServerPush) {
@@ -1881,7 +1884,7 @@
EXPECT_EQ(0u, session_.GetNumOpenIncomingStreams());
// Push unidirectional stream is type 0x01.
- std::string frame_type1 = QuicTextUtils::HexDecode("01");
+ std::string frame_type1 = quiche::QuicheTextUtils::HexDecode("01");
QuicStreamId stream_id1 =
GetNthServerInitiatedUnidirectionalStreamId(transport_version(), 0);
session_.OnStreamFrame(QuicStreamFrame(stream_id1, /* fin = */ false,
@@ -1893,7 +1896,7 @@
EXPECT_EQ(1u, session_.flow_controller()->bytes_consumed());
// The same stream type can be encoded differently.
- std::string frame_type2 = QuicTextUtils::HexDecode("80000001");
+ std::string frame_type2 = quiche::QuicheTextUtils::HexDecode("80000001");
QuicStreamId stream_id2 =
GetNthServerInitiatedUnidirectionalStreamId(transport_version(), 1);
session_.OnStreamFrame(QuicStreamFrame(stream_id2, /* fin = */ false,
@@ -1913,9 +1916,9 @@
EXPECT_EQ(0u, session_.GetNumOpenIncomingStreams());
// Push unidirectional stream is type 0x01.
- std::string frame_type = QuicTextUtils::HexDecode("01");
+ std::string frame_type = quiche::QuicheTextUtils::HexDecode("01");
// The first field of a push stream is the Push ID.
- std::string push_id = QuicTextUtils::HexDecode("4000");
+ std::string push_id = quiche::QuicheTextUtils::HexDecode("4000");
QuicStreamId stream_id =
GetNthServerInitiatedUnidirectionalStreamId(transport_version(), 0);
@@ -2120,7 +2123,7 @@
char input[] = {0x04, // type
'a', 'b', 'c'}; // data
- QuicStringPiece payload(input, QUIC_ARRAYSIZE(input));
+ quiche::QuicheStringPiece payload(input, QUIC_ARRAYSIZE(input));
// This is a server test with a client-initiated unidirectional stream.
QuicStreamId stream_id = QuicUtils::GetFirstUnidirectionalStreamId(
@@ -2156,7 +2159,7 @@
char input[] = {0x04, // type
'a', 'b', 'c'}; // data
- QuicStringPiece payload(input, QUIC_ARRAYSIZE(input));
+ quiche::QuicheStringPiece payload(input, QUIC_ARRAYSIZE(input));
// This is a server test with a client-initiated unidirectional stream.
QuicStreamId stream_id = QuicUtils::GetFirstUnidirectionalStreamId(
@@ -2197,7 +2200,7 @@
char input[] = {0x41, 0x00, // type (256)
'a', 'b', 'c'}; // data
- QuicStringPiece payload(input, QUIC_ARRAYSIZE(input));
+ quiche::QuicheStringPiece payload(input, QUIC_ARRAYSIZE(input));
// This is a server test with a client-initiated unidirectional stream.
QuicStreamId stream_id = QuicUtils::GetFirstUnidirectionalStreamId(
@@ -2244,7 +2247,8 @@
GetNthClientInitiatedUnidirectionalStreamId(transport_version(), 3);
char type[] = {kControlStream};
- QuicStreamFrame data1(stream_id, false, 0, QuicStringPiece(type, 1));
+ QuicStreamFrame data1(stream_id, false, 0,
+ quiche::QuicheStringPiece(type, 1));
EXPECT_CALL(debug_visitor, OnPeerControlStreamCreated(stream_id)).Times(0);
session_.OnStreamFrame(data1);
EXPECT_EQ(stream_id,
@@ -2256,7 +2260,7 @@
settings.values[SETTINGS_MAX_HEADER_LIST_SIZE] = 5;
settings.values[SETTINGS_QPACK_BLOCKED_STREAMS] = 42;
std::string data = EncodeSettings(settings);
- QuicStreamFrame frame(stream_id, false, 1, QuicStringPiece(data));
+ QuicStreamFrame frame(stream_id, false, 1, quiche::QuicheStringPiece(data));
QpackEncoder* qpack_encoder = session_.qpack_encoder();
QpackHeaderTable* header_table =
@@ -2289,8 +2293,9 @@
settings.values[SETTINGS_MAX_HEADER_LIST_SIZE] = 5;
std::string data = EncodeSettings(settings);
- QuicStreamFrame data1(stream_id, false, 1, QuicStringPiece(data));
- QuicStreamFrame data2(stream_id, false, 0, QuicStringPiece(type, 1));
+ QuicStreamFrame data1(stream_id, false, 1, quiche::QuicheStringPiece(data));
+ QuicStreamFrame data2(stream_id, false, 0,
+ quiche::QuicheStringPiece(type, 1));
session_.OnStreamFrame(data1);
EXPECT_NE(5u, session_.max_outbound_header_list_size());
@@ -2310,14 +2315,15 @@
TestStream* stream = session_.CreateIncomingStream(stream_id);
// HEADERS frame referencing first dynamic table entry.
- std::string headers_payload = QuicTextUtils::HexDecode("020080");
+ std::string headers_payload = quiche::QuicheTextUtils::HexDecode("020080");
std::unique_ptr<char[]> headers_buffer;
QuicByteCount headers_frame_header_length =
HttpEncoder::SerializeHeadersFrameHeader(headers_payload.length(),
&headers_buffer);
- QuicStringPiece headers_frame_header(headers_buffer.get(),
- headers_frame_header_length);
- std::string headers = QuicStrCat(headers_frame_header, headers_payload);
+ quiche::QuicheStringPiece headers_frame_header(headers_buffer.get(),
+ headers_frame_header_length);
+ std::string headers =
+ quiche::QuicheStrCat(headers_frame_header, headers_payload);
stream->OnStreamFrame(QuicStreamFrame(stream_id, false, 0, headers));
// Decoding is blocked because dynamic table entry has not been received yet.
@@ -2344,14 +2350,15 @@
TestStream* stream = session_.CreateIncomingStream(stream_id);
// HEADERS frame referencing first dynamic table entry.
- std::string headers_payload = QuicTextUtils::HexDecode("020080");
+ std::string headers_payload = quiche::QuicheTextUtils::HexDecode("020080");
std::unique_ptr<char[]> headers_buffer;
QuicByteCount headers_frame_header_length =
HttpEncoder::SerializeHeadersFrameHeader(headers_payload.length(),
&headers_buffer);
- QuicStringPiece headers_frame_header(headers_buffer.get(),
- headers_frame_header_length);
- std::string headers = QuicStrCat(headers_frame_header, headers_payload);
+ quiche::QuicheStringPiece headers_frame_header(headers_buffer.get(),
+ headers_frame_header_length);
+ std::string headers =
+ quiche::QuicheStrCat(headers_frame_header, headers_payload);
stream->OnStreamFrame(QuicStreamFrame(stream_id, false, 0, headers));
// Decoding is blocked because dynamic table entry has not been received yet.
@@ -2376,7 +2383,7 @@
// Payload consists of two bytes. The first byte is an unknown unidirectional
// stream type. The second one would be the type of a push stream, but it
// must not be interpreted as stream type.
- std::string payload = QuicTextUtils::HexDecode("3f01");
+ std::string payload = quiche::QuicheTextUtils::HexDecode("3f01");
QuicStreamFrame frame(stream_id, /* fin = */ false, /* offset = */ 0,
payload);
@@ -2422,7 +2429,7 @@
// Payload consists of two bytes. The first byte is an unknown unidirectional
// stream type. The second one would be the type of a push stream, but it
// must not be interpreted as stream type.
- std::string payload = QuicTextUtils::HexDecode("3f01");
+ std::string payload = quiche::QuicheTextUtils::HexDecode("3f01");
QuicStreamFrame frame(stream_id, /* fin = */ false, /* offset = */ 0,
payload);
@@ -2459,7 +2466,7 @@
GetNthServerInitiatedUnidirectionalStreamId(transport_version(), 0);
// Payload is the first byte of a two byte varint encoding.
- std::string payload = QuicTextUtils::HexDecode("40");
+ std::string payload = quiche::QuicheTextUtils::HexDecode("40");
QuicStreamFrame frame(stream_id, /* fin = */ false, /* offset = */ 0,
payload);
@@ -2487,7 +2494,7 @@
GetNthServerInitiatedUnidirectionalStreamId(transport_version(), 0);
// Payload is the first byte of a two byte varint encoding with a FIN.
- std::string payload = QuicTextUtils::HexDecode("40");
+ std::string payload = quiche::QuicheTextUtils::HexDecode("40");
QuicStreamFrame frame(stream_id, /* fin = */ true, /* offset = */ 0, payload);
session_.OnStreamFrame(frame);
@@ -2506,12 +2513,12 @@
GetNthServerInitiatedUnidirectionalStreamId(transport_version(), 0);
char type1[] = {kControlStream};
- QuicStreamFrame data1(id1, false, 0, QuicStringPiece(type1, 1));
+ QuicStreamFrame data1(id1, false, 0, quiche::QuicheStringPiece(type1, 1));
EXPECT_CALL(debug_visitor, OnPeerControlStreamCreated(id1));
session_.OnStreamFrame(data1);
QuicStreamId id2 =
GetNthServerInitiatedUnidirectionalStreamId(transport_version(), 1);
- QuicStreamFrame data2(id2, false, 0, QuicStringPiece(type1, 1));
+ QuicStreamFrame data2(id2, false, 0, quiche::QuicheStringPiece(type1, 1));
EXPECT_CALL(debug_visitor, OnPeerControlStreamCreated(id2)).Times(0);
EXPECT_CALL(*connection_,
CloseConnection(QUIC_INVALID_STREAM_ID,
@@ -2524,13 +2531,13 @@
GetNthServerInitiatedUnidirectionalStreamId(transport_version(), 2);
char type2[]{kQpackEncoderStream};
- QuicStreamFrame data3(id3, false, 0, QuicStringPiece(type2, 1));
+ QuicStreamFrame data3(id3, false, 0, quiche::QuicheStringPiece(type2, 1));
EXPECT_CALL(debug_visitor, OnPeerQpackEncoderStreamCreated(id3));
session_.OnStreamFrame(data3);
QuicStreamId id4 =
GetNthServerInitiatedUnidirectionalStreamId(transport_version(), 3);
- QuicStreamFrame data4(id4, false, 0, QuicStringPiece(type2, 1));
+ QuicStreamFrame data4(id4, false, 0, quiche::QuicheStringPiece(type2, 1));
EXPECT_CALL(debug_visitor, OnPeerQpackEncoderStreamCreated(id4)).Times(0);
EXPECT_CALL(*connection_,
CloseConnection(QUIC_INVALID_STREAM_ID,
@@ -2543,13 +2550,13 @@
GetNthServerInitiatedUnidirectionalStreamId(transport_version(), 4);
char type3[]{kQpackDecoderStream};
- QuicStreamFrame data5(id5, false, 0, QuicStringPiece(type3, 1));
+ QuicStreamFrame data5(id5, false, 0, quiche::QuicheStringPiece(type3, 1));
EXPECT_CALL(debug_visitor, OnPeerQpackDecoderStreamCreated(id5));
session_.OnStreamFrame(data5);
QuicStreamId id6 =
GetNthServerInitiatedUnidirectionalStreamId(transport_version(), 5);
- QuicStreamFrame data6(id6, false, 0, QuicStringPiece(type3, 1));
+ QuicStreamFrame data6(id6, false, 0, quiche::QuicheStringPiece(type3, 1));
EXPECT_CALL(debug_visitor, OnPeerQpackDecoderStreamCreated(id6)).Times(0);
EXPECT_CALL(*connection_,
CloseConnection(QUIC_INVALID_STREAM_ID,
@@ -2564,7 +2571,7 @@
return;
}
- std::string data = QuicTextUtils::HexDecode(
+ std::string data = quiche::QuicheTextUtils::HexDecode(
"02" // Encoder stream.
"00"); // Duplicate entry 0, but no entries exist.
@@ -2585,7 +2592,7 @@
return;
}
- std::string data = QuicTextUtils::HexDecode(
+ std::string data = quiche::QuicheTextUtils::HexDecode(
"03" // Decoder stream.
"00"); // Insert Count Increment with forbidden increment value of zero.
diff --git a/quic/core/http/quic_spdy_stream.cc b/quic/core/http/quic_spdy_stream.cc
index bf1f127..a65e964 100644
--- a/quic/core/http/quic_spdy_stream.cc
+++ b/quic/core/http/quic_spdy_stream.cc
@@ -23,8 +23,8 @@
#include "net/third_party/quiche/src/quic/platform/api/quic_flags.h"
#include "net/third_party/quiche/src/quic/platform/api/quic_logging.h"
#include "net/third_party/quiche/src/quic/platform/api/quic_mem_slice_storage.h"
-#include "net/third_party/quiche/src/quic/platform/api/quic_string_piece.h"
-#include "net/third_party/quiche/src/quic/platform/api/quic_text_utils.h"
+#include "net/third_party/quiche/src/common/platform/api/quiche_string_piece.h"
+#include "net/third_party/quiche/src/common/platform/api/quiche_text_utils.h"
#include "net/third_party/quiche/src/spdy/core/spdy_protocol.h"
using spdy::SpdyHeaderBlock;
@@ -91,7 +91,7 @@
return stream_->OnDataFrameStart(header_length);
}
- bool OnDataFramePayload(QuicStringPiece payload) override {
+ bool OnDataFramePayload(quiche::QuicheStringPiece payload) override {
DCHECK(!payload.empty());
return stream_->OnDataFramePayload(payload);
}
@@ -106,7 +106,7 @@
return stream_->OnHeadersFrameStart(header_length);
}
- bool OnHeadersFramePayload(QuicStringPiece payload) override {
+ bool OnHeadersFramePayload(quiche::QuicheStringPiece payload) override {
DCHECK(!payload.empty());
if (!VersionUsesHttp3(stream_->transport_version())) {
CloseConnectionOnWrongFrame("Headers");
@@ -140,7 +140,7 @@
return stream_->OnPushPromiseFramePushId(push_id, push_id_length);
}
- bool OnPushPromiseFramePayload(QuicStringPiece payload) override {
+ bool OnPushPromiseFramePayload(quiche::QuicheStringPiece payload) override {
DCHECK(!payload.empty());
if (!VersionUsesHttp3(stream_->transport_version())) {
CloseConnectionOnWrongFrame("Push Promise");
@@ -162,17 +162,17 @@
return stream_->OnUnknownFrameStart(frame_type, header_length);
}
- bool OnUnknownFramePayload(QuicStringPiece payload) override {
+ bool OnUnknownFramePayload(quiche::QuicheStringPiece payload) override {
return stream_->OnUnknownFramePayload(payload);
}
bool OnUnknownFrameEnd() override { return stream_->OnUnknownFrameEnd(); }
private:
- void CloseConnectionOnWrongFrame(QuicStringPiece frame_type) {
+ void CloseConnectionOnWrongFrame(quiche::QuicheStringPiece frame_type) {
stream_->session()->connection()->CloseConnection(
QUIC_HTTP_DECODER_ERROR,
- QuicStrCat(frame_type, " frame received on data stream"),
+ quiche::QuicheStrCat(frame_type, " frame received on data stream"),
ConnectionCloseBehavior::SEND_CONNECTION_CLOSE_PACKET);
}
@@ -273,8 +273,8 @@
QUIC_LOG(INFO) << ENDPOINT << "Stream " << id()
<< " is writing type as server push";
- WriteOrBufferData(QuicStringPiece(writer.data(), writer.length()), false,
- nullptr);
+ WriteOrBufferData(quiche::QuicheStringPiece(writer.data(), writer.length()),
+ false, nullptr);
}
size_t bytes_written =
WriteHeadersImpl(std::move(header_block), fin, std::move(ack_listener));
@@ -289,7 +289,8 @@
return bytes_written;
}
-void QuicSpdyStream::WriteOrBufferBody(QuicStringPiece data, bool fin) {
+void QuicSpdyStream::WriteOrBufferBody(quiche::QuicheStringPiece data,
+ bool fin) {
if (!VersionUsesHttp3(transport_version()) || data.length() == 0) {
WriteOrBufferData(data, fin, nullptr);
return;
@@ -306,8 +307,8 @@
QUIC_DLOG(INFO) << ENDPOINT << "Stream " << id()
<< " is writing DATA frame header of length "
<< header_length;
- WriteOrBufferData(QuicStringPiece(buffer.get(), header_length), false,
- nullptr);
+ WriteOrBufferData(quiche::QuicheStringPiece(buffer.get(), header_length),
+ false, nullptr);
// Write body.
QUIC_DLOG(INFO) << ENDPOINT << "Stream " << id()
@@ -331,8 +332,9 @@
stream_bytes_written() + BufferedDataBytes();
QUIC_DLOG(INFO) << ENDPOINT << "Inserting trailer: ("
<< kFinalOffsetHeaderKey << ", " << final_offset << ")";
- trailer_block.insert(std::make_pair(
- kFinalOffsetHeaderKey, QuicTextUtils::Uint64ToString(final_offset)));
+ trailer_block.insert(
+ std::make_pair(kFinalOffsetHeaderKey,
+ quiche::QuicheTextUtils::Uint64ToString(final_offset)));
}
// Write the trailing headers with a FIN, and close stream for writing:
@@ -373,8 +375,8 @@
<< " is writing Push Promise frame header of length "
<< push_promise_frame_length << " , with promised id "
<< frame.push_id;
- WriteOrBufferData(QuicStringPiece(push_promise_frame_with_id.get(),
- push_promise_frame_length),
+ WriteOrBufferData(quiche::QuicheStringPiece(push_promise_frame_with_id.get(),
+ push_promise_frame_length),
/* fin = */ false, /* ack_listener = */ nullptr);
// Write response headers.
@@ -565,10 +567,11 @@
}
}
-void QuicSpdyStream::OnHeaderDecodingError(QuicStringPiece error_message) {
+void QuicSpdyStream::OnHeaderDecodingError(
+ quiche::QuicheStringPiece error_message) {
qpack_decoded_headers_accumulator_.reset();
- std::string connection_close_error_message = QuicStrCat(
+ std::string connection_close_error_message = quiche::QuicheStrCat(
"Error decoding ", headers_decompressed_ ? "trailers" : "headers",
" on stream ", id(), ": ", error_message);
CloseConnectionWithDetails(QUIC_QPACK_DECOMPRESSION_FAILED,
@@ -580,7 +583,7 @@
// TODO(b/124216424): Reset stream with H3_REQUEST_CANCELLED (if client)
// or with H3_REQUEST_REJECTED (if server).
std::string error_message =
- QuicStrCat("Too large headers received on stream ", id());
+ quiche::QuicheStrCat("Too large headers received on stream ", id());
CloseConnectionWithDetails(QUIC_HEADERS_STREAM_DATA_DECOMPRESS_FAILURE,
error_message);
} else {
@@ -601,14 +604,14 @@
OnStreamFrame(
QuicStreamFrame(id(), /* fin = */ true,
flow_controller()->highest_received_byte_offset(),
- QuicStringPiece()));
+ quiche::QuicheStringPiece()));
}
return;
}
if (fin && !rst_sent()) {
- OnStreamFrame(
- QuicStreamFrame(id(), fin, /* offset = */ 0, QuicStringPiece()));
+ OnStreamFrame(QuicStreamFrame(id(), fin, /* offset = */ 0,
+ quiche::QuicheStringPiece()));
}
if (FinishedReadingHeaders()) {
sequencer()->SetUnblocked();
@@ -668,7 +671,8 @@
VersionUsesHttp3(transport_version())
? flow_controller()->highest_received_byte_offset()
: final_byte_offset;
- OnStreamFrame(QuicStreamFrame(id(), fin, offset, QuicStringPiece()));
+ OnStreamFrame(
+ QuicStreamFrame(id(), fin, offset, quiche::QuicheStringPiece()));
}
}
@@ -794,7 +798,7 @@
if (it == header.end()) {
return false;
}
- const QuicStringPiece status(it->second);
+ const quiche::QuicheStringPiece status(it->second);
if (status.size() != 3) {
return false;
}
@@ -806,7 +810,7 @@
if (!isdigit(status[1]) || !isdigit(status[2])) {
return false;
}
- return QuicTextUtils::StringToInt(status, status_code);
+ return quiche::QuicheTextUtils::StringToInt(status, status_code);
}
bool QuicSpdyStream::FinishedReadingTrailers() const {
@@ -840,7 +844,7 @@
return true;
}
-bool QuicSpdyStream::OnDataFramePayload(QuicStringPiece payload) {
+bool QuicSpdyStream::OnDataFramePayload(quiche::QuicheStringPiece payload) {
DCHECK(VersionUsesHttp3(transport_version()));
body_manager_.OnBody(payload);
@@ -926,7 +930,7 @@
return true;
}
-bool QuicSpdyStream::OnHeadersFramePayload(QuicStringPiece payload) {
+bool QuicSpdyStream::OnHeadersFramePayload(quiche::QuicheStringPiece payload) {
DCHECK(VersionUsesHttp3(transport_version()));
DCHECK(qpack_decoded_headers_accumulator_);
@@ -989,7 +993,8 @@
return true;
}
-bool QuicSpdyStream::OnPushPromiseFramePayload(QuicStringPiece payload) {
+bool QuicSpdyStream::OnPushPromiseFramePayload(
+ quiche::QuicheStringPiece payload) {
spdy_session_->OnCompressedFrameSize(payload.length());
return OnHeadersFramePayload(payload);
}
@@ -1010,7 +1015,7 @@
return true;
}
-bool QuicSpdyStream::OnUnknownFramePayload(QuicStringPiece payload) {
+bool QuicSpdyStream::OnUnknownFramePayload(quiche::QuicheStringPiece payload) {
// Ignore unknown frames, but consume frame payload.
QUIC_DVLOG(1) << ENDPOINT << "Discarding " << payload.size()
<< " bytes of payload of frame of unknown type.";
@@ -1058,9 +1063,9 @@
QUIC_DLOG(INFO) << ENDPOINT << "Stream " << id()
<< " is writing HEADERS frame header of length "
<< headers_frame_header_length;
- WriteOrBufferData(
- QuicStringPiece(headers_frame_header.get(), headers_frame_header_length),
- /* fin = */ false, /* ack_listener = */ nullptr);
+ WriteOrBufferData(quiche::QuicheStringPiece(headers_frame_header.get(),
+ headers_frame_header_length),
+ /* fin = */ false, /* ack_listener = */ nullptr);
QUIC_DLOG(INFO) << ENDPOINT << "Stream " << id()
<< " is writing HEADERS frame payload of length "
diff --git a/quic/core/http/quic_spdy_stream.h b/quic/core/http/quic_spdy_stream.h
index c4333f3..9650744 100644
--- a/quic/core/http/quic_spdy_stream.h
+++ b/quic/core/http/quic_spdy_stream.h
@@ -26,6 +26,7 @@
#include "net/third_party/quiche/src/quic/platform/api/quic_export.h"
#include "net/third_party/quiche/src/quic/platform/api/quic_flags.h"
#include "net/third_party/quiche/src/quic/platform/api/quic_socket_address.h"
+#include "net/third_party/quiche/src/common/platform/api/quiche_string_piece.h"
#include "net/third_party/quiche/src/spdy/core/spdy_framer.h"
namespace quic {
@@ -121,7 +122,7 @@
QuicReferenceCountedPointer<QuicAckListenerInterface> ack_listener);
// Sends |data| to the peer, or buffers if it can't be sent immediately.
- void WriteOrBufferBody(QuicStringPiece data, bool fin);
+ void WriteOrBufferBody(quiche::QuicheStringPiece data, bool fin);
// Writes the trailers contained in |trailer_block| on the dedicated headers
// stream or on this stream, depending on VersionUsesHttp3(). Trailers will
@@ -216,7 +217,7 @@
// QpackDecodedHeadersAccumulator::Visitor implementation.
void OnHeadersDecoded(QuicHeaderList headers,
bool header_list_size_limit_exceeded) override;
- void OnHeaderDecodingError(QuicStringPiece error_message) override;
+ void OnHeaderDecodingError(quiche::QuicheStringPiece error_message) override;
protected:
// Called when the received headers are too large. By default this will
@@ -255,17 +256,17 @@
// Called by HttpDecoderVisitor.
bool OnDataFrameStart(QuicByteCount header_length);
- bool OnDataFramePayload(QuicStringPiece payload);
+ bool OnDataFramePayload(quiche::QuicheStringPiece payload);
bool OnDataFrameEnd();
bool OnHeadersFrameStart(QuicByteCount header_length);
- bool OnHeadersFramePayload(QuicStringPiece payload);
+ bool OnHeadersFramePayload(quiche::QuicheStringPiece payload);
bool OnHeadersFrameEnd();
bool OnPushPromiseFrameStart(QuicByteCount header_length);
bool OnPushPromiseFramePushId(PushId push_id, QuicByteCount push_id_length);
- bool OnPushPromiseFramePayload(QuicStringPiece payload);
+ bool OnPushPromiseFramePayload(quiche::QuicheStringPiece payload);
bool OnPushPromiseFrameEnd();
bool OnUnknownFrameStart(uint64_t frame_type, QuicByteCount header_length);
- bool OnUnknownFramePayload(QuicStringPiece payload);
+ bool OnUnknownFramePayload(quiche::QuicheStringPiece payload);
bool OnUnknownFrameEnd();
// Given the interval marked by [|offset|, |offset| + |data_length|), return
diff --git a/quic/core/http/quic_spdy_stream_body_manager.cc b/quic/core/http/quic_spdy_stream_body_manager.cc
index 798f551..1e36aa7 100644
--- a/quic/core/http/quic_spdy_stream_body_manager.cc
+++ b/quic/core/http/quic_spdy_stream_body_manager.cc
@@ -7,6 +7,7 @@
#include <algorithm>
#include "net/third_party/quiche/src/quic/platform/api/quic_logging.h"
+#include "net/third_party/quiche/src/common/platform/api/quiche_string_piece.h"
namespace quic {
@@ -27,7 +28,7 @@
return 0;
}
-void QuicSpdyStreamBodyManager::OnBody(QuicStringPiece body) {
+void QuicSpdyStreamBodyManager::OnBody(quiche::QuicheStringPiece body) {
DCHECK(!body.empty());
fragments_.push_back({body, 0});
@@ -45,7 +46,7 @@
}
Fragment& fragment = fragments_.front();
- const QuicStringPiece body = fragment.body;
+ const quiche::QuicheStringPiece body = fragment.body;
if (body.length() > remaining_bytes) {
// Consume leading |remaining_bytes| bytes of body.
@@ -77,7 +78,7 @@
size_t iov_filled = 0;
while (iov_filled < fragments_.size() && iov_filled < iov_len) {
- QuicStringPiece body = fragments_[iov_filled].body;
+ quiche::QuicheStringPiece body = fragments_[iov_filled].body;
iov[iov_filled].iov_base = const_cast<char*>(body.data());
iov[iov_filled].iov_len = body.size();
iov_filled++;
@@ -101,7 +102,7 @@
while (!fragments_.empty()) {
Fragment& fragment = fragments_.front();
- const QuicStringPiece body = fragment.body;
+ const quiche::QuicheStringPiece body = fragment.body;
const size_t bytes_to_copy =
std::min<size_t>(body.length(), dest_remaining);
diff --git a/quic/core/http/quic_spdy_stream_body_manager.h b/quic/core/http/quic_spdy_stream_body_manager.h
index 1942c26..ac22978 100644
--- a/quic/core/http/quic_spdy_stream_body_manager.h
+++ b/quic/core/http/quic_spdy_stream_body_manager.h
@@ -11,7 +11,7 @@
#include "net/third_party/quiche/src/quic/platform/api/quic_export.h"
#include "net/third_party/quiche/src/quic/platform/api/quic_iovec.h"
#include "net/third_party/quiche/src/quic/platform/api/quic_macros.h"
-#include "net/third_party/quiche/src/quic/platform/api/quic_string_piece.h"
+#include "net/third_party/quiche/src/common/platform/api/quiche_string_piece.h"
namespace quic {
@@ -43,7 +43,7 @@
// Called when body is received. |body| is added to |fragments_|. The data
// pointed to by |body| must be kept alive until an OnBodyConsumed() or
// ReadBody() call consumes it. |body| must not be empty.
- void OnBody(QuicStringPiece body);
+ void OnBody(quiche::QuicheStringPiece body);
// Internally marks |num_bytes| of body consumed. |num_bytes| might be zero.
// Returns the number of bytes that the caller should mark consumed with the
@@ -79,7 +79,7 @@
// consumed as soon as all of the body fragment is read.
struct QUIC_EXPORT_PRIVATE Fragment {
// |body| must not be empty.
- QuicStringPiece body;
+ quiche::QuicheStringPiece body;
// Might be zero.
QuicByteCount trailing_non_body_byte_count;
};
diff --git a/quic/core/http/quic_spdy_stream_body_manager_test.cc b/quic/core/http/quic_spdy_stream_body_manager_test.cc
index 10b19f1..b9e63ab 100644
--- a/quic/core/http/quic_spdy_stream_body_manager_test.cc
+++ b/quic/core/http/quic_spdy_stream_body_manager_test.cc
@@ -12,6 +12,7 @@
#include "net/third_party/quiche/src/quic/platform/api/quic_expect_bug.h"
#include "net/third_party/quiche/src/quic/platform/api/quic_logging.h"
#include "net/third_party/quiche/src/quic/platform/api/quic_test.h"
+#include "net/third_party/quiche/src/common/platform/api/quiche_string_piece.h"
namespace quic {
@@ -152,7 +153,7 @@
static_cast<size_t>(body_manager.PeekBody(&iovecs[0], iov_len)));
for (size_t iovec_index = 0; iovec_index < iovs_filled; ++iovec_index) {
EXPECT_EQ(frame_payloads[iovec_index],
- QuicStringPiece(
+ quiche::QuicheStringPiece(
static_cast<const char*>(iovecs[iovec_index].iov_base),
iovecs[iovec_index].iov_len));
}
diff --git a/quic/core/http/quic_spdy_stream_test.cc b/quic/core/http/quic_spdy_stream_test.cc
index efb34ac..c5dc417 100644
--- a/quic/core/http/quic_spdy_stream_test.cc
+++ b/quic/core/http/quic_spdy_stream_test.cc
@@ -19,9 +19,7 @@
#include "net/third_party/quiche/src/quic/platform/api/quic_expect_bug.h"
#include "net/third_party/quiche/src/quic/platform/api/quic_map_util.h"
#include "net/third_party/quiche/src/quic/platform/api/quic_ptr_util.h"
-#include "net/third_party/quiche/src/quic/platform/api/quic_string_piece.h"
#include "net/third_party/quiche/src/quic/platform/api/quic_test.h"
-#include "net/third_party/quiche/src/quic/platform/api/quic_text_utils.h"
#include "net/third_party/quiche/src/quic/test_tools/qpack/qpack_test_utils.h"
#include "net/third_party/quiche/src/quic/test_tools/quic_config_peer.h"
#include "net/third_party/quiche/src/quic/test_tools/quic_flow_controller_peer.h"
@@ -30,6 +28,8 @@
#include "net/third_party/quiche/src/quic/test_tools/quic_spdy_stream_peer.h"
#include "net/third_party/quiche/src/quic/test_tools/quic_stream_peer.h"
#include "net/third_party/quiche/src/quic/test_tools/quic_test_utils.h"
+#include "net/third_party/quiche/src/common/platform/api/quiche_string_piece.h"
+#include "net/third_party/quiche/src/common/platform/api/quiche_text_utils.h"
using spdy::kV3HighestPriority;
using spdy::kV3LowestPriority;
@@ -168,7 +168,8 @@
// Return QPACK-encoded header block without using the dynamic table.
std::string EncodeQpackHeaders(
- std::vector<std::pair<QuicStringPiece, QuicStringPiece>> headers) {
+ std::vector<std::pair<quiche::QuicheStringPiece,
+ quiche::QuicheStringPiece>> headers) {
SpdyHeaderBlock header_block;
for (const auto& header_field : headers) {
header_block.AppendValueOrAddHeader(header_field.first,
@@ -280,7 +281,8 @@
// Construct HEADERS frame with QPACK-encoded |headers| without using the
// dynamic table.
std::string HeadersFrame(
- std::vector<std::pair<QuicStringPiece, QuicStringPiece>> headers) {
+ std::vector<std::pair<quiche::QuicheStringPiece,
+ quiche::QuicheStringPiece>> headers) {
return HeadersFrame(EncodeQpackHeaders(headers));
}
@@ -291,26 +293,27 @@
}
// Construct HEADERS frame with given payload.
- std::string HeadersFrame(QuicStringPiece payload) {
+ std::string HeadersFrame(quiche::QuicheStringPiece payload) {
std::unique_ptr<char[]> headers_buffer;
QuicByteCount headers_frame_header_length =
HttpEncoder::SerializeHeadersFrameHeader(payload.length(),
&headers_buffer);
- QuicStringPiece headers_frame_header(headers_buffer.get(),
- headers_frame_header_length);
- return QuicStrCat(headers_frame_header, payload);
+ quiche::QuicheStringPiece headers_frame_header(headers_buffer.get(),
+ headers_frame_header_length);
+ return quiche::QuicheStrCat(headers_frame_header, payload);
}
- std::string DataFrame(QuicStringPiece payload) {
+ std::string DataFrame(quiche::QuicheStringPiece payload) {
std::unique_ptr<char[]> data_buffer;
QuicByteCount data_frame_header_length =
HttpEncoder::SerializeDataFrameHeader(payload.length(), &data_buffer);
- QuicStringPiece data_frame_header(data_buffer.get(),
- data_frame_header_length);
- return QuicStrCat(data_frame_header, payload);
+ quiche::QuicheStringPiece data_frame_header(data_buffer.get(),
+ data_frame_header_length);
+ return quiche::QuicheStrCat(data_frame_header, payload);
}
- std::string UnknownFrame(uint64_t frame_type, QuicStringPiece payload) {
+ std::string UnknownFrame(uint64_t frame_type,
+ quiche::QuicheStringPiece payload) {
std::string frame;
const size_t length = QuicDataWriter::GetVarInt62Len(frame_type) +
QuicDataWriter::GetVarInt62Len(payload.size()) +
@@ -498,7 +501,7 @@
EXPECT_EQ(headers, stream_->header_list());
stream_->ConsumeHeaderList();
QuicStreamFrame frame(GetNthClientInitiatedBidirectionalId(0), false, 0,
- QuicStringPiece(data));
+ quiche::QuicheStringPiece(data));
EXPECT_CALL(*connection_, CloseConnection(QUIC_HTTP_DECODER_ERROR, _, _))
.WillOnce(
@@ -530,7 +533,7 @@
EXPECT_EQ(headers, stream_->header_list());
stream_->ConsumeHeaderList();
QuicStreamFrame frame(GetNthClientInitiatedBidirectionalId(0), false, 0,
- QuicStringPiece(data));
+ quiche::QuicheStringPiece(data));
stream_->OnStreamFrame(frame);
EXPECT_EQ(QuicHeaderList(), stream_->header_list());
EXPECT_EQ(body, stream_->data());
@@ -547,10 +550,10 @@
stream_->ConsumeHeaderList();
for (size_t offset = 0; offset < data.size(); offset += fragment_size) {
size_t remaining_data = data.size() - offset;
- QuicStringPiece fragment(data.data() + offset,
- std::min(fragment_size, remaining_data));
+ quiche::QuicheStringPiece fragment(
+ data.data() + offset, std::min(fragment_size, remaining_data));
QuicStreamFrame frame(GetNthClientInitiatedBidirectionalId(0), false,
- offset, QuicStringPiece(fragment));
+ offset, quiche::QuicheStringPiece(fragment));
stream_->OnStreamFrame(frame);
}
ASSERT_EQ(body, stream_->data()) << "fragment_size: " << fragment_size;
@@ -567,15 +570,15 @@
ASSERT_EQ(headers, stream_->header_list());
stream_->ConsumeHeaderList();
- QuicStringPiece fragment1(data.data(), split_point);
+ quiche::QuicheStringPiece fragment1(data.data(), split_point);
QuicStreamFrame frame1(GetNthClientInitiatedBidirectionalId(0), false, 0,
- QuicStringPiece(fragment1));
+ quiche::QuicheStringPiece(fragment1));
stream_->OnStreamFrame(frame1);
- QuicStringPiece fragment2(data.data() + split_point,
- data.size() - split_point);
+ quiche::QuicheStringPiece fragment2(data.data() + split_point,
+ data.size() - split_point);
QuicStreamFrame frame2(GetNthClientInitiatedBidirectionalId(0), false,
- split_point, QuicStringPiece(fragment2));
+ split_point, quiche::QuicheStringPiece(fragment2));
stream_->OnStreamFrame(frame2);
ASSERT_EQ(body, stream_->data()) << "split_point: " << split_point;
@@ -590,7 +593,7 @@
ProcessHeaders(false, headers_);
QuicStreamFrame frame(GetNthClientInitiatedBidirectionalId(0), false, 0,
- QuicStringPiece(data));
+ quiche::QuicheStringPiece(data));
stream_->OnStreamFrame(frame);
stream_->ConsumeHeaderList();
@@ -613,7 +616,7 @@
ProcessHeaders(false, headers_);
QuicStreamFrame frame(GetNthClientInitiatedBidirectionalId(0), false, 0,
- QuicStringPiece(data));
+ quiche::QuicheStringPiece(data));
stream_->OnStreamFrame(frame);
stream_->ConsumeHeaderList();
char buffer[2048];
@@ -637,7 +640,7 @@
ProcessHeaders(false, headers_);
QuicStreamFrame frame(GetNthClientInitiatedBidirectionalId(0), false, 0,
- QuicStringPiece(data));
+ quiche::QuicheStringPiece(data));
stream_->OnStreamFrame(frame);
stream_->ConsumeHeaderList();
@@ -660,9 +663,9 @@
ProcessHeaders(false, headers_);
QuicStreamFrame frame1(GetNthClientInitiatedBidirectionalId(0), false, 0,
- QuicStringPiece(data1));
+ quiche::QuicheStringPiece(data1));
QuicStreamFrame frame2(GetNthClientInitiatedBidirectionalId(0), false,
- data1.length(), QuicStringPiece(data2));
+ data1.length(), quiche::QuicheStringPiece(data2));
stream_->OnStreamFrame(frame1);
stream_->OnStreamFrame(frame2);
stream_->ConsumeHeaderList();
@@ -680,7 +683,7 @@
ProcessHeaders(false, headers_);
QuicStreamFrame frame(GetNthClientInitiatedBidirectionalId(0), false, 0,
- QuicStringPiece(data));
+ quiche::QuicheStringPiece(data));
stream_->OnStreamFrame(frame);
stream_->ConsumeHeaderList();
@@ -704,7 +707,7 @@
ProcessHeaders(false, headers_);
QuicStreamFrame frame(GetNthClientInitiatedBidirectionalId(0), false, 0,
- QuicStringPiece(data));
+ quiche::QuicheStringPiece(data));
stream_->OnStreamFrame(frame);
stream_->ConsumeHeaderList();
@@ -795,7 +798,7 @@
ProcessHeaders(false, headers_);
QuicStreamFrame frame1(GetNthClientInitiatedBidirectionalId(0), false, 0,
- QuicStringPiece(data));
+ quiche::QuicheStringPiece(data));
stream_->OnStreamFrame(frame1);
EXPECT_EQ(
kWindow - (kWindow / 3) - header_length,
@@ -805,7 +808,8 @@
// half full. This should all be buffered, decreasing the receive window but
// not sending WINDOW_UPDATE.
QuicStreamFrame frame2(GetNthClientInitiatedBidirectionalId(0), false,
- kWindow / 3 + header_length, QuicStringPiece(data));
+ kWindow / 3 + header_length,
+ quiche::QuicheStringPiece(data));
stream_->OnStreamFrame(frame2);
EXPECT_EQ(
kWindow - (2 * kWindow / 3) - 2 * header_length,
@@ -846,7 +850,7 @@
stream_->ConsumeHeaderList();
QuicStreamFrame frame1(GetNthClientInitiatedBidirectionalId(0), false, 0,
- QuicStringPiece(data));
+ quiche::QuicheStringPiece(data));
stream_->OnStreamFrame(frame1);
EXPECT_EQ(
kWindow - (kWindow / 3) - header_length,
@@ -857,7 +861,8 @@
// offset and send a WINDOW_UPDATE. The result will be again an available
// window of kWindow bytes.
QuicStreamFrame frame2(GetNthClientInitiatedBidirectionalId(0), false,
- kWindow / 3 + header_length, QuicStringPiece(data));
+ kWindow / 3 + header_length,
+ quiche::QuicheStringPiece(data));
EXPECT_CALL(*connection_, SendControlFrame(_));
stream_->OnStreamFrame(frame2);
EXPECT_EQ(kWindow, QuicFlowControllerPeer::ReceiveWindowSize(
@@ -921,10 +926,10 @@
}
QuicStreamFrame frame1(GetNthClientInitiatedBidirectionalId(0), false, 0,
- QuicStringPiece(data));
+ quiche::QuicheStringPiece(data));
stream_->OnStreamFrame(frame1);
QuicStreamFrame frame2(GetNthClientInitiatedBidirectionalId(1), false, 0,
- QuicStringPiece(data));
+ quiche::QuicheStringPiece(data));
stream2_->OnStreamFrame(frame2);
// Now receive a further single byte on one stream - again this does not
@@ -932,7 +937,8 @@
// is over half full and thus a connection WINDOW_UPDATE is sent.
EXPECT_CALL(*connection_, SendControlFrame(_));
QuicStreamFrame frame3(GetNthClientInitiatedBidirectionalId(0), false,
- body.length() + header_length, QuicStringPiece(data2));
+ body.length() + header_length,
+ quiche::QuicheStringPiece(data2));
stream_->OnStreamFrame(frame3);
}
@@ -954,7 +960,7 @@
std::string body(kWindow + 1, 'a');
std::string data = UsesHttp3() ? DataFrame(body) : body;
QuicStreamFrame frame(GetNthClientInitiatedBidirectionalId(0), false, 0,
- QuicStringPiece(data));
+ quiche::QuicheStringPiece(data));
EXPECT_CALL(*connection_,
CloseConnection(QUIC_FLOW_CONTROL_RECEIVED_TOO_MUCH_DATA, _, _));
stream_->OnStreamFrame(frame);
@@ -994,7 +1000,7 @@
EXPECT_LT(data.size(), kStreamWindow);
QuicStreamFrame frame(GetNthClientInitiatedBidirectionalId(0), false, 0,
- QuicStringPiece(data));
+ quiche::QuicheStringPiece(data));
EXPECT_CALL(*connection_,
CloseConnection(QUIC_FLOW_CONTROL_RECEIVED_TOO_MUCH_DATA, _, _));
@@ -1094,7 +1100,7 @@
trailers_block["key2"] = "value2";
trailers_block["key3"] = "value3";
trailers_block[kFinalOffsetHeaderKey] =
- QuicTextUtils::Uint64ToString(data.size());
+ quiche::QuicheTextUtils::Uint64ToString(data.size());
QuicHeaderList trailers = ProcessHeaders(true, trailers_block);
@@ -1343,7 +1349,7 @@
// on the headers stream.
if (!UsesHttp3()) {
expected_trailers[kFinalOffsetHeaderKey] =
- QuicTextUtils::Uint64ToString(body.length() + header_length);
+ quiche::QuicheTextUtils::Uint64ToString(body.length() + header_length);
}
EXPECT_CALL(*stream_, WriteHeadersMock(true));
@@ -1786,7 +1792,8 @@
std::string trailers =
HeadersFrame({std::make_pair("custom-key", "custom-value")});
- std::string stream_frame_payload = QuicStrCat(headers, data, trailers);
+ std::string stream_frame_payload =
+ quiche::QuicheStrCat(headers, data, trailers);
QuicStreamFrame frame(stream_->id(), false, 0, stream_frame_payload);
stream_->OnStreamFrame(frame);
@@ -1820,7 +1827,8 @@
std::string trailers = HeadersFrame(trailers_block);
// Feed all three HTTP/3 frames in a single stream frame.
- std::string stream_frame_payload = QuicStrCat(headers, data, trailers);
+ std::string stream_frame_payload =
+ quiche::QuicheStrCat(headers, data, trailers);
QuicStreamFrame frame(stream_->id(), false, 0, stream_frame_payload);
stream_->OnStreamFrame(frame);
@@ -1838,7 +1846,7 @@
vec.iov_base = buffer;
vec.iov_len = QUIC_ARRAYSIZE(buffer);
size_t bytes_read = stream_->Readv(&vec, 1);
- EXPECT_EQ(kDataFramePayload, QuicStringPiece(buffer, bytes_read));
+ EXPECT_EQ(kDataFramePayload, quiche::QuicheStringPiece(buffer, bytes_read));
EXPECT_FALSE(stream_->HasBytesToRead());
}
@@ -1858,10 +1866,10 @@
// Random bad headers.
std::string headers =
- HeadersFrame(QuicTextUtils::HexDecode("00002a94e7036261"));
+ HeadersFrame(quiche::QuicheTextUtils::HexDecode("00002a94e7036261"));
std::string data = DataFrame(kDataFramePayload);
- std::string stream_frame_payload = QuicStrCat(headers, data);
+ std::string stream_frame_payload = quiche::QuicheStrCat(headers, data);
QuicStreamFrame frame(stream_->id(), false, 0, stream_frame_payload);
EXPECT_CALL(
@@ -1924,7 +1932,8 @@
// Invalid headers: Required Insert Count is zero, but the header block
// contains a dynamic table reference.
- std::string headers = HeadersFrame(QuicTextUtils::HexDecode("000080"));
+ std::string headers =
+ HeadersFrame(quiche::QuicheTextUtils::HexDecode("000080"));
QuicStreamFrame frame(stream_->id(), false, 0, headers);
stream_->OnStreamFrame(frame);
}
@@ -1948,7 +1957,8 @@
session_->qpack_decoder()->OnInsertWithoutNameReference("foo", "bar");
// HEADERS frame referencing first dynamic table entry.
- std::string headers = HeadersFrame(QuicTextUtils::HexDecode("020080"));
+ std::string headers =
+ HeadersFrame(quiche::QuicheTextUtils::HexDecode("020080"));
stream_->OnStreamFrame(QuicStreamFrame(stream_->id(), false, 0, headers));
// Headers can be decoded immediately.
@@ -1970,7 +1980,8 @@
session_->qpack_decoder()->OnInsertWithoutNameReference("trailing", "foobar");
// Trailing HEADERS frame referencing second dynamic table entry.
- std::string trailers = HeadersFrame(QuicTextUtils::HexDecode("030080"));
+ std::string trailers =
+ HeadersFrame(quiche::QuicheTextUtils::HexDecode("030080"));
stream_->OnStreamFrame(QuicStreamFrame(stream_->id(), true, /* offset = */
headers.length() + data.length(),
trailers));
@@ -1994,7 +2005,8 @@
session_->qpack_decoder()->OnSetDynamicTableCapacity(1024);
// HEADERS frame referencing first dynamic table entry.
- std::string headers = HeadersFrame(QuicTextUtils::HexDecode("020080"));
+ std::string headers =
+ HeadersFrame(quiche::QuicheTextUtils::HexDecode("020080"));
stream_->OnStreamFrame(QuicStreamFrame(stream_->id(), false, 0, headers));
// Decoding is blocked because dynamic table entry has not been received yet.
@@ -2021,7 +2033,8 @@
EXPECT_EQ(kDataFramePayload, stream_->data());
// Trailing HEADERS frame referencing second dynamic table entry.
- std::string trailers = HeadersFrame(QuicTextUtils::HexDecode("030080"));
+ std::string trailers =
+ HeadersFrame(quiche::QuicheTextUtils::HexDecode("030080"));
stream_->OnStreamFrame(QuicStreamFrame(stream_->id(), true, /* offset = */
headers.length() + data.length(),
trailers));
@@ -2051,7 +2064,8 @@
// HEADERS frame only referencing entry with absolute index 0 but with
// Required Insert Count = 2, which is incorrect.
- std::string headers = HeadersFrame(QuicTextUtils::HexDecode("030081"));
+ std::string headers =
+ HeadersFrame(quiche::QuicheTextUtils::HexDecode("030081"));
stream_->OnStreamFrame(QuicStreamFrame(stream_->id(), false, 0, headers));
// Even though entire header block is received and every referenced entry is
@@ -2083,7 +2097,8 @@
session_->qpack_decoder()->OnSetDynamicTableCapacity(1024);
// Relative index 2 is invalid because it is larger than or equal to the Base.
- std::string headers = HeadersFrame(QuicTextUtils::HexDecode("020082"));
+ std::string headers =
+ HeadersFrame(quiche::QuicheTextUtils::HexDecode("020082"));
stream_->OnStreamFrame(QuicStreamFrame(stream_->id(), false, 0, headers));
// Decoding is blocked.
@@ -2111,7 +2126,8 @@
session_->qpack_decoder()->OnSetDynamicTableCapacity(1024);
// HEADERS frame referencing first dynamic table entry.
- std::string headers = HeadersFrame(QuicTextUtils::HexDecode("020080"));
+ std::string headers =
+ HeadersFrame(quiche::QuicheTextUtils::HexDecode("020080"));
stream_->OnStreamFrame(QuicStreamFrame(stream_->id(), false, 0, headers));
// Decoding is blocked because dynamic table entry has not been received yet.
@@ -2139,7 +2155,8 @@
// Trailing HEADERS frame only referencing entry with absolute index 0 but
// with Required Insert Count = 2, which is incorrect.
- std::string trailers = HeadersFrame(QuicTextUtils::HexDecode("030081"));
+ std::string trailers =
+ HeadersFrame(quiche::QuicheTextUtils::HexDecode("030081"));
stream_->OnStreamFrame(QuicStreamFrame(stream_->id(), true, /* offset = */
headers.length() + data.length(),
trailers));
@@ -2168,7 +2185,7 @@
// Create QuicStreamFrame with |payload|
// and pass it to stream_->OnStreamFrame().
- void OnStreamFrame(QuicStringPiece payload) {
+ void OnStreamFrame(quiche::QuicheStringPiece payload) {
QuicStreamFrame frame(stream_->id(), /* fin = */ false, offset_, payload);
stream_->OnStreamFrame(frame);
offset_ += payload.size();
@@ -2221,11 +2238,12 @@
// All HEADERS frame bytes are consumed even if the frame is not received
// completely.
- OnStreamFrame(QuicStringPiece(headers).substr(0, headers.size() - 1));
+ OnStreamFrame(
+ quiche::QuicheStringPiece(headers).substr(0, headers.size() - 1));
EXPECT_EQ(headers.size() - 1, NewlyConsumedBytes());
// The rest of the HEADERS frame is also consumed immediately.
- OnStreamFrame(QuicStringPiece(headers).substr(headers.size() - 1));
+ OnStreamFrame(quiche::QuicheStringPiece(headers).substr(headers.size() - 1));
EXPECT_EQ(1u, NewlyConsumedBytes());
// Verify headers.
@@ -2233,7 +2251,7 @@
stream_->ConsumeHeaderList();
// DATA frame.
- QuicStringPiece data_payload(kDataFramePayload);
+ quiche::QuicheStringPiece data_payload(kDataFramePayload);
std::string data_frame = DataFrame(data_payload);
QuicByteCount data_frame_header_length =
data_frame.size() - data_payload.size();
@@ -2252,7 +2270,8 @@
HeadersFrame({std::make_pair("custom-key", "custom-value")});
// No bytes are consumed, because last byte of DATA payload is still buffered.
- OnStreamFrame(QuicStringPiece(trailers).substr(0, trailers.size() - 1));
+ OnStreamFrame(
+ quiche::QuicheStringPiece(trailers).substr(0, trailers.size() - 1));
EXPECT_EQ(0u, NewlyConsumedBytes());
// Reading last byte of DATA payload triggers consumption of all data received
@@ -2261,7 +2280,8 @@
EXPECT_EQ(1 + trailers.size() - 1, NewlyConsumedBytes());
// Last byte of trailers is immediately consumed.
- OnStreamFrame(QuicStringPiece(trailers).substr(trailers.size() - 1));
+ OnStreamFrame(
+ quiche::QuicheStringPiece(trailers).substr(trailers.size() - 1));
EXPECT_EQ(1u, NewlyConsumedBytes());
// Verify trailers.
@@ -2285,11 +2305,12 @@
// All HEADERS frame bytes are consumed even if the frame is not received
// completely.
- OnStreamFrame(QuicStringPiece(headers).substr(0, headers.size() - 1));
+ OnStreamFrame(
+ quiche::QuicheStringPiece(headers).substr(0, headers.size() - 1));
EXPECT_EQ(headers.size() - 1, NewlyConsumedBytes());
// The rest of the HEADERS frame is also consumed immediately.
- OnStreamFrame(QuicStringPiece(headers).substr(headers.size() - 1));
+ OnStreamFrame(quiche::QuicheStringPiece(headers).substr(headers.size() - 1));
EXPECT_EQ(1u, NewlyConsumedBytes());
// Verify headers.
@@ -2303,7 +2324,7 @@
EXPECT_EQ(unknown_frame2.size(), NewlyConsumedBytes());
// DATA frame.
- QuicStringPiece data_payload(kDataFramePayload);
+ quiche::QuicheStringPiece data_payload(kDataFramePayload);
std::string data_frame = DataFrame(data_payload);
QuicByteCount data_frame_header_length =
data_frame.size() - data_payload.size();
@@ -2328,7 +2349,8 @@
HeadersFrame({std::make_pair("custom-key", "custom-value")});
// No bytes are consumed, because last byte of DATA payload is still buffered.
- OnStreamFrame(QuicStringPiece(trailers).substr(0, trailers.size() - 1));
+ OnStreamFrame(
+ quiche::QuicheStringPiece(trailers).substr(0, trailers.size() - 1));
EXPECT_EQ(0u, NewlyConsumedBytes());
// Reading last byte of DATA payload triggers consumption of all data received
@@ -2338,7 +2360,8 @@
NewlyConsumedBytes());
// Last byte of trailers is immediately consumed.
- OnStreamFrame(QuicStringPiece(trailers).substr(trailers.size() - 1));
+ OnStreamFrame(
+ quiche::QuicheStringPiece(trailers).substr(trailers.size() - 1));
EXPECT_EQ(1u, NewlyConsumedBytes());
// Verify trailers.
@@ -2508,7 +2531,7 @@
Initialize(kShouldProcessData);
// SETTINGS frame with empty payload.
- std::string settings = QuicTextUtils::HexDecode("0400");
+ std::string settings = quiche::QuicheTextUtils::HexDecode("0400");
// HEADERS frame.
// Since it arrives after a SETTINGS frame, it should never be read.
@@ -2516,7 +2539,7 @@
// Combine the two frames to make sure they are processed in a single
// QuicSpdyStream::OnDataAvailable() call.
- std::string frames = QuicStrCat(settings, headers);
+ std::string frames = quiche::QuicheStrCat(settings, headers);
EXPECT_EQ(0u, stream_->sequencer()->NumBytesConsumed());
diff --git a/quic/core/http/spdy_server_push_utils.cc b/quic/core/http/spdy_server_push_utils.cc
index 02c963c..4ba3289 100644
--- a/quic/core/http/spdy_server_push_utils.cc
+++ b/quic/core/http/spdy_server_push_utils.cc
@@ -5,6 +5,7 @@
#include "net/third_party/quiche/src/quic/core/http/spdy_server_push_utils.h"
#include "url/gurl.h"
+#include "net/third_party/quiche/src/common/platform/api/quiche_string_piece.h"
using spdy::SpdyHeaderBlock;
@@ -39,7 +40,7 @@
if (it == headers.end() || it->second.empty()) {
return std::string();
}
- QuicStringPiece scheme = it->second;
+ quiche::QuicheStringPiece scheme = it->second;
// RFC 7540, Section 8.2: The server MUST include a value in the
// ":authority" pseudo-header field for which the server is authoritative
@@ -48,7 +49,7 @@
if (it == headers.end() || it->second.empty()) {
return std::string();
}
- QuicStringPiece authority = it->second;
+ quiche::QuicheStringPiece authority = it->second;
// RFC 7540, Section 8.1.2.3 requires that the ":path" pseudo-header MUST
// NOT be empty for "http" or "https" URIs;
@@ -59,7 +60,7 @@
if (it == headers.end()) {
return std::string();
}
- QuicStringPiece path = it->second;
+ quiche::QuicheStringPiece path = it->second;
return GetPushPromiseUrl(scheme, authority, path);
}
@@ -79,9 +80,10 @@
}
// static
-std::string SpdyServerPushUtils::GetPushPromiseUrl(QuicStringPiece scheme,
- QuicStringPiece authority,
- QuicStringPiece path) {
+std::string SpdyServerPushUtils::GetPushPromiseUrl(
+ quiche::QuicheStringPiece scheme,
+ quiche::QuicheStringPiece authority,
+ quiche::QuicheStringPiece 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
diff --git a/quic/core/http/spdy_server_push_utils.h b/quic/core/http/spdy_server_push_utils.h
index 3d11b65..16e1ac6 100644
--- a/quic/core/http/spdy_server_push_utils.h
+++ b/quic/core/http/spdy_server_push_utils.h
@@ -6,7 +6,7 @@
#define QUICHE_QUIC_CORE_HTTP_SPDY_SERVER_PUSH_UTILS_H_
#include "net/third_party/quiche/src/quic/platform/api/quic_export.h"
-#include "net/third_party/quiche/src/quic/platform/api/quic_string_piece.h"
+#include "net/third_party/quiche/src/common/platform/api/quiche_string_piece.h"
#include "net/third_party/quiche/src/spdy/core/spdy_header_block.h"
namespace quic {
@@ -33,9 +33,9 @@
// 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 std::string GetPushPromiseUrl(QuicStringPiece scheme,
- QuicStringPiece authority,
- QuicStringPiece path);
+ static std::string GetPushPromiseUrl(quiche::QuicheStringPiece scheme,
+ quiche::QuicheStringPiece authority,
+ quiche::QuicheStringPiece path);
};
} // namespace quic
diff --git a/quic/core/http/spdy_server_push_utils_test.cc b/quic/core/http/spdy_server_push_utils_test.cc
index 0f6ec8a..aa35550 100644
--- a/quic/core/http/spdy_server_push_utils_test.cc
+++ b/quic/core/http/spdy_server_push_utils_test.cc
@@ -8,9 +8,7 @@
#include <string>
#include "net/third_party/quiche/src/quic/platform/api/quic_arraysize.h"
-#include "net/third_party/quiche/src/quic/platform/api/quic_string_piece.h"
#include "net/third_party/quiche/src/quic/platform/api/quic_test.h"
-#include "net/third_party/quiche/src/quic/platform/api/quic_text_utils.h"
using spdy::SpdyHeaderBlock;
diff --git a/quic/core/http/spdy_utils.cc b/quic/core/http/spdy_utils.cc
index 56d3b19..98d22cb 100644
--- a/quic/core/http/spdy_utils.cc
+++ b/quic/core/http/spdy_utils.cc
@@ -12,9 +12,9 @@
#include "net/third_party/quiche/src/quic/platform/api/quic_flags.h"
#include "net/third_party/quiche/src/quic/platform/api/quic_logging.h"
#include "net/third_party/quiche/src/quic/platform/api/quic_map_util.h"
-#include "net/third_party/quiche/src/quic/platform/api/quic_str_cat.h"
-#include "net/third_party/quiche/src/quic/platform/api/quic_string_piece.h"
-#include "net/third_party/quiche/src/quic/platform/api/quic_text_utils.h"
+#include "net/third_party/quiche/src/common/platform/api/quiche_str_cat.h"
+#include "net/third_party/quiche/src/common/platform/api/quiche_string_piece.h"
+#include "net/third_party/quiche/src/common/platform/api/quiche_text_utils.h"
#include "net/third_party/quiche/src/spdy/core/spdy_protocol.h"
using spdy::SpdyHeaderBlock;
@@ -29,12 +29,12 @@
return false;
} else {
// Check whether multiple values are consistent.
- QuicStringPiece content_length_header = it->second;
- std::vector<QuicStringPiece> values =
- QuicTextUtils::Split(content_length_header, '\0');
- for (const QuicStringPiece& value : values) {
+ quiche::QuicheStringPiece content_length_header = it->second;
+ std::vector<quiche::QuicheStringPiece> values =
+ quiche::QuicheTextUtils::Split(content_length_header, '\0');
+ for (const quiche::QuicheStringPiece& value : values) {
uint64_t new_value;
- if (!QuicTextUtils::StringToUint64(value, &new_value)) {
+ if (!quiche::QuicheTextUtils::StringToUint64(value, &new_value)) {
QUIC_DLOG(ERROR)
<< "Content length was either unparseable or negative.";
return false;
@@ -65,7 +65,7 @@
return false;
}
- if (QuicTextUtils::ContainsUpperCase(name)) {
+ if (quiche::QuicheTextUtils::ContainsUpperCase(name)) {
QUIC_DLOG(ERROR) << "Malformed header: Header name " << name
<< " contains upper-case characters.";
return false;
@@ -95,7 +95,7 @@
// response body bytes expected.
if (expect_final_byte_offset && !found_final_byte_offset &&
name == kFinalOffsetHeaderKey &&
- QuicTextUtils::StringToSizeT(p.second, final_byte_offset)) {
+ quiche::QuicheTextUtils::StringToSizeT(p.second, final_byte_offset)) {
found_final_byte_offset = true;
continue;
}
@@ -107,7 +107,7 @@
return false;
}
- if (QuicTextUtils::ContainsUpperCase(name)) {
+ if (quiche::QuicheTextUtils::ContainsUpperCase(name)) {
QUIC_DLOG(ERROR) << "Malformed header: Header name " << name
<< " contains upper-case characters.";
return false;
@@ -162,7 +162,7 @@
RETURN_STRING_LITERAL(SETTINGS_MAX_HEADER_LIST_SIZE);
RETURN_STRING_LITERAL(SETTINGS_QPACK_BLOCKED_STREAMS);
}
- return QuicStrCat("UNSUPPORTED_SETTINGS_TYPE(", identifier, ")");
+ return quiche::QuicheStrCat("UNSUPPORTED_SETTINGS_TYPE(", identifier, ")");
}
#undef RETURN_STRING_LITERAL // undef for jumbo builds
diff --git a/quic/core/http/spdy_utils_test.cc b/quic/core/http/spdy_utils_test.cc
index 2ebf0cf..898d5f7 100644
--- a/quic/core/http/spdy_utils_test.cc
+++ b/quic/core/http/spdy_utils_test.cc
@@ -7,9 +7,9 @@
#include "net/third_party/quiche/src/quic/core/http/spdy_utils.h"
#include "net/third_party/quiche/src/quic/platform/api/quic_arraysize.h"
-#include "net/third_party/quiche/src/quic/platform/api/quic_string_piece.h"
#include "net/third_party/quiche/src/quic/platform/api/quic_test.h"
-#include "net/third_party/quiche/src/quic/platform/api/quic_text_utils.h"
+#include "net/third_party/quiche/src/common/platform/api/quiche_string_piece.h"
+#include "net/third_party/quiche/src/common/platform/api/quiche_text_utils.h"
using spdy::SpdyHeaderBlock;
using testing::Pair;
@@ -66,13 +66,14 @@
SpdyHeaderBlock block;
ASSERT_TRUE(
SpdyUtils::CopyAndValidateHeaders(*headers, &content_length, &block));
- EXPECT_THAT(block,
- UnorderedElementsAre(
- Pair("cookie", " part 1; part 2 ; part3; fin!"),
- Pair("passed-through", QuicStringPiece("foo\0baz", 7)),
- Pair("joined", QuicStringPiece("value 1\0value 2", 15)),
- Pair("empty", ""),
- Pair("empty-joined", QuicStringPiece("\0foo\0\0", 6))));
+ EXPECT_THAT(
+ block,
+ UnorderedElementsAre(
+ Pair("cookie", " part 1; part 2 ; part3; fin!"),
+ Pair("passed-through", quiche::QuicheStringPiece("foo\0baz", 7)),
+ Pair("joined", quiche::QuicheStringPiece("value 1\0value 2", 15)),
+ Pair("empty", ""),
+ Pair("empty-joined", quiche::QuicheStringPiece("\0foo\0\0", 6))));
EXPECT_EQ(-1, content_length);
}
@@ -103,10 +104,11 @@
SpdyHeaderBlock block;
ASSERT_TRUE(
SpdyUtils::CopyAndValidateHeaders(*headers, &content_length, &block));
- EXPECT_THAT(block, UnorderedElementsAre(
- Pair("foo", "foovalue"), Pair("bar", "barvalue"),
- Pair("content-length", QuicStringPiece("9\09", 3)),
- Pair("baz", "")));
+ EXPECT_THAT(block,
+ UnorderedElementsAre(
+ Pair("foo", "foovalue"), Pair("bar", "barvalue"),
+ Pair("content-length", quiche::QuicheStringPiece("9\09", 3)),
+ Pair("baz", "")));
EXPECT_EQ(9, content_length);
}
@@ -133,7 +135,8 @@
SpdyUtils::CopyAndValidateHeaders(*headers, &content_length, &block));
EXPECT_THAT(block, UnorderedElementsAre(
Pair("foo", "foovalue"), Pair("bar", "barvalue"),
- Pair("content-length", QuicStringPiece("9000000000")),
+ Pair("content-length",
+ quiche::QuicheStringPiece("9000000000")),
Pair("baz", "")));
EXPECT_EQ(9000000000, content_length);
}
@@ -148,10 +151,11 @@
SpdyHeaderBlock block;
ASSERT_TRUE(
SpdyUtils::CopyAndValidateHeaders(*headers, &content_length, &block));
- EXPECT_THAT(block, UnorderedElementsAre(
- Pair("foo", QuicStringPiece("foovalue\0boo", 12)),
- Pair("bar", "barvalue"),
- Pair("baz", QuicStringPiece("\0buzz", 5))));
+ EXPECT_THAT(block,
+ UnorderedElementsAre(
+ Pair("foo", quiche::QuicheStringPiece("foovalue\0boo", 12)),
+ Pair("bar", "barvalue"),
+ Pair("baz", quiche::QuicheStringPiece("\0buzz", 5))));
EXPECT_EQ(-1, content_length);
}
@@ -163,9 +167,9 @@
SpdyHeaderBlock block;
ASSERT_TRUE(
SpdyUtils::CopyAndValidateHeaders(*headers, &content_length, &block));
- EXPECT_THAT(
- block, UnorderedElementsAre(Pair(
- "set-cookie", QuicStringPiece("value1\0value2\0value3", 20))));
+ EXPECT_THAT(block, UnorderedElementsAre(Pair(
+ "set-cookie", quiche::QuicheStringPiece(
+ "value1\0value2\0value3", 20))));
EXPECT_EQ(-1, content_length);
}
@@ -307,7 +311,7 @@
block,
UnorderedElementsAre(
Pair("key",
- QuicStringPiece(
+ quiche::QuicheStringPiece(
"value0\0value1\0\0\0value2\0\0non_contiguous_duplicate",
48)),
Pair("other_key", "value")));