Replace QuicString with std::string, pass 1
This replaces QuicString with std::string in all of the "QUIC proper". I will
delete QuicString once all code using it is gone.
gfe-relnote: n/a (no functional change)
PiperOrigin-RevId: 237872023
Change-Id: I82de62c9855516b15039734d05155917e68ff4ee
diff --git a/quic/core/http/end_to_end_test.cc b/quic/core/http/end_to_end_test.cc
index c26ffa6..d439e95 100644
--- a/quic/core/http/end_to_end_test.cc
+++ b/quic/core/http/end_to_end_test.cc
@@ -622,7 +622,7 @@
// Default is true.
bool connect_to_server_on_initialize_;
QuicSocketAddress server_address_;
- QuicString server_hostname_;
+ std::string server_hostname_;
QuicMemoryCacheBackend memory_cache_backend_;
std::unique_ptr<ServerThread> server_thread_;
std::unique_ptr<QuicTestClient> client_;
@@ -637,8 +637,8 @@
size_t chlo_multiplier_;
QuicTestServer::StreamFactory* stream_factory_;
bool support_server_push_;
- QuicString pre_shared_key_client_;
- QuicString pre_shared_key_server_;
+ std::string pre_shared_key_client_;
+ std::string pre_shared_key_server_;
QuicConnectionId* override_connection_id_;
};
@@ -854,8 +854,8 @@
TEST_P(EndToEndTestWithTls, RequestOverMultiplePackets) {
// Send a large enough request to guarantee fragmentation.
- QuicString huge_request =
- "/some/path?query=" + QuicString(kMaxPacketSize, '.');
+ std::string huge_request =
+ "/some/path?query=" + std::string(kMaxPacketSize, '.');
AddToCache(huge_request, 200, kBarResponseBody);
ASSERT_TRUE(Initialize());
@@ -866,8 +866,8 @@
TEST_P(EndToEndTestWithTls, MultiplePacketsRandomOrder) {
// Send a large enough request to guarantee fragmentation.
- QuicString huge_request =
- "/some/path?query=" + QuicString(kMaxPacketSize, '.');
+ std::string huge_request =
+ "/some/path?query=" + std::string(kMaxPacketSize, '.');
AddToCache(huge_request, 200, kBarResponseBody);
ASSERT_TRUE(Initialize());
@@ -903,7 +903,7 @@
EXPECT_TRUE(client_->client()->WaitForCryptoHandshakeConfirmed());
// 1 MB body.
- QuicString body(1024 * 1024, 'a');
+ std::string body(1024 * 1024, 'a');
SpdyHeaderBlock headers;
headers[":method"] = "POST";
headers[":path"] = "/foo";
@@ -924,7 +924,7 @@
EXPECT_TRUE(client_->client()->WaitForCryptoHandshakeConfirmed());
// 100 KB body.
- QuicString body(100 * 1024, 'a');
+ std::string body(100 * 1024, 'a');
SpdyHeaderBlock headers;
headers[":method"] = "POST";
headers[":path"] = "/foo";
@@ -952,7 +952,7 @@
SetPacketLossPercentage(30);
// 10 KB body.
- QuicString body(1024 * 10, 'a');
+ std::string body(1024 * 10, 'a');
SpdyHeaderBlock headers;
headers[":method"] = "POST";
headers[":path"] = "/foo";
@@ -983,7 +983,7 @@
SetPacketLossPercentage(30);
// 10 KB body.
- QuicString body(1024 * 10, 'a');
+ std::string body(1024 * 10, 'a');
SpdyHeaderBlock headers;
headers[":method"] = "POST";
headers[":path"] = "/foo";
@@ -1011,7 +1011,7 @@
client_writer_->set_fake_blocked_socket_percentage(10);
// 10 KB body.
- QuicString body(1024 * 10, 'a');
+ std::string body(1024 * 10, 'a');
SpdyHeaderBlock headers;
headers[":method"] = "POST";
headers[":path"] = "/foo";
@@ -1031,7 +1031,7 @@
SetReorderPercentage(30);
// 1 MB body.
- QuicString body(1024 * 1024, 'a');
+ std::string body(1024 * 1024, 'a');
SpdyHeaderBlock headers;
headers[":method"] = "POST";
headers[":path"] = "/foo";
@@ -1047,7 +1047,7 @@
// a 0-RTT handshake for the next request.
ASSERT_TRUE(Initialize());
- QuicString body(20480, 'a');
+ std::string body(20480, 'a');
SpdyHeaderBlock headers;
headers[":method"] = "POST";
headers[":path"] = "/foo";
@@ -1187,7 +1187,7 @@
// a 0-RTT handshake for the next request.
ASSERT_TRUE(Initialize());
- QuicString body(20480, 'a');
+ std::string body(20480, 'a');
SpdyHeaderBlock headers;
headers[":method"] = "POST";
headers[":path"] = "/foo";
@@ -1302,7 +1302,7 @@
EXPECT_TRUE(client_->client()->WaitForCryptoHandshakeConfirmed());
// 1 MB body.
- QuicString body(1024 * 1024, 'a');
+ std::string body(1024 * 1024, 'a');
SpdyHeaderBlock headers;
headers[":method"] = "POST";
headers[":path"] = "/foo";
@@ -1363,7 +1363,7 @@
ASSERT_TRUE(Initialize());
EXPECT_TRUE(client_->client()->WaitForCryptoHandshakeConfirmed());
- QuicString body(kMaxPacketSize, 'a');
+ std::string body(kMaxPacketSize, 'a');
SpdyHeaderBlock headers;
headers[":method"] = "POST";
headers[":path"] = "/foo";
@@ -1387,15 +1387,15 @@
ASSERT_TRUE(Initialize());
EXPECT_TRUE(client_->client()->WaitForCryptoHandshakeConfirmed());
- QuicString body(kMaxPacketSize, 'a');
+ std::string body(kMaxPacketSize, 'a');
SpdyHeaderBlock headers;
headers[":method"] = "POST";
headers[":path"] = "/foo";
headers[":scheme"] = "https";
headers[":authority"] = server_hostname_;
- headers["key1"] = QuicString(15 * 1024, 'a');
- headers["key2"] = QuicString(15 * 1024, 'a');
- headers["key3"] = QuicString(15 * 1024, 'a');
+ headers["key1"] = std::string(15 * 1024, 'a');
+ headers["key2"] = std::string(15 * 1024, 'a');
+ headers["key3"] = std::string(15 * 1024, 'a');
client_->SendCustomSynchronousRequest(headers, body);
EXPECT_EQ(QUIC_HEADERS_TOO_LARGE, client_->stream_error());
@@ -1406,7 +1406,7 @@
ASSERT_TRUE(Initialize());
EXPECT_TRUE(client_->client()->WaitForCryptoHandshakeConfirmed());
- QuicString large_body(1024 * 1024, 'a');
+ std::string large_body(1024 * 1024, 'a');
SpdyHeaderBlock headers;
headers[":method"] = "POST";
headers[":path"] = "/foo";
@@ -1765,7 +1765,7 @@
SetPacketLossPercentage(1);
}
ASSERT_TRUE(Initialize());
- QuicString large_body(10240, 'a');
+ std::string large_body(10240, 'a');
int max_streams = 100;
AddToCache("/large_response", 200, large_body);
@@ -1785,7 +1785,7 @@
TEST_P(EndToEndTestWithTls, StreamCancelErrorTest) {
ASSERT_TRUE(Initialize());
- QuicString small_body(256, 'a');
+ std::string small_body(256, 'a');
AddToCache("/small_response", 200, small_body);
@@ -2166,7 +2166,7 @@
public:
void OnCompleteResponse(QuicStreamId id,
const SpdyHeaderBlock& response_headers,
- const QuicString& response_body) override {
+ const std::string& response_body) override {
QUIC_DVLOG(1) << "response for stream " << id << " "
<< response_headers.DebugString() << "\n"
<< response_body;
@@ -2201,8 +2201,8 @@
// Test the AckNotifier's ability to track multiple packets by making the
// request body exceed the size of a single packet.
- QuicString request_string =
- "a request body bigger than one packet" + QuicString(kMaxPacketSize, '.');
+ std::string request_string = "a request body bigger than one packet" +
+ std::string(kMaxPacketSize, '.');
// The TestAckListener will cause a failure if not notified.
QuicReferenceCountedPointer<TestAckListener> ack_listener(
@@ -2492,7 +2492,7 @@
EmptyQuicConnectionId(), false, false, 1, "At least 20 characters.",
CONNECTION_ID_PRESENT, CONNECTION_ID_ABSENT, PACKET_4BYTE_PACKET_NUMBER));
// Damage the encrypted data.
- QuicString damaged_packet(packet->data(), packet->length());
+ std::string damaged_packet(packet->data(), packet->length());
damaged_packet[30] ^= 0x01;
QUIC_DLOG(INFO) << "Sending bad packet.";
client_writer_->WritePacket(
@@ -2544,7 +2544,7 @@
QuicStreamId id,
QuicSpdySession* session,
QuicSimpleServerBackend* quic_simple_server_backend,
- QuicString response_body)
+ std::string response_body)
: QuicSimpleServerStream(id,
session,
BIDIRECTIONAL,
@@ -2566,12 +2566,12 @@
SendHeadersAndBody(std::move(headers), response_body_);
}
- QuicString response_body_;
+ std::string response_body_;
};
class StreamWithErrorFactory : public QuicTestServer::StreamFactory {
public:
- explicit StreamWithErrorFactory(QuicString response_body)
+ explicit StreamWithErrorFactory(std::string response_body)
: response_body_(std::move(response_body)) {}
~StreamWithErrorFactory() override = default;
@@ -2585,7 +2585,7 @@
}
private:
- QuicString response_body_;
+ std::string response_body_;
};
// A test server stream that drops all received body.
@@ -2665,7 +2665,7 @@
protected:
void SendResponse() override {
QuicBackendResponse response;
- QuicString body(body_bytes_, 'a');
+ std::string body(body_bytes_, 'a');
response.set_body(body);
SendHeadersAndBodyAndTrailers(response.headers().Clone(), response.body(),
response.trailers().Clone());
@@ -2712,7 +2712,7 @@
// it.
uint32_t response_body_size =
2 * client_config_.GetInitialStreamFlowControlWindowToSend();
- QuicString response_body(response_body_size, 'a');
+ std::string response_body(response_body_size, 'a');
StreamWithErrorFactory stream_factory(response_body);
SetSpdyStreamFactory(&stream_factory);
@@ -2738,7 +2738,7 @@
// before the request FIN is processed but receive the request FIN before the
// response is sent completely.
const uint32_t kRequestBodySize = kMaxPacketSize + 10;
- QuicString request_body(kRequestBodySize, 'a');
+ std::string request_body(kRequestBodySize, 'a');
// Send the request.
client_->SendMessage(headers, request_body);
@@ -2774,7 +2774,7 @@
SetReorderPercentage(30);
// Add a response with headers, body, and trailers.
- const QuicString kBody = "body content";
+ const std::string kBody = "body content";
SpdyHeaderBlock headers;
headers[":status"] = "200";
@@ -2808,24 +2808,24 @@
// If |resource_size| == 0, response body of push resources use default string
// concatenating with resource url. Otherwise, generate a string of
// |resource_size| as body.
- void AddRequestAndResponseWithServerPush(QuicString host,
- QuicString path,
- QuicString response_body,
- QuicString* push_urls,
+ void AddRequestAndResponseWithServerPush(std::string host,
+ std::string path,
+ std::string response_body,
+ std::string* push_urls,
const size_t num_resources,
const size_t resource_size) {
bool use_large_response = resource_size != 0;
- QuicString large_resource;
+ std::string large_resource;
if (use_large_response) {
// Generate a response common body larger than flow control window for
// push response.
- large_resource = QuicString(resource_size, 'a');
+ large_resource = std::string(resource_size, 'a');
}
std::list<QuicBackendResponse::ServerPushInfo> push_resources;
for (size_t i = 0; i < num_resources; ++i) {
- QuicString url = push_urls[i];
+ std::string url = push_urls[i];
QuicUrl resource_url(url);
- QuicString body =
+ std::string body =
use_large_response
? large_resource
: QuicStrCat("This is server push response body for ", url);
@@ -2857,12 +2857,12 @@
SetReorderPercentage(30);
// Add a response with headers, body, and push resources.
- const QuicString kBody = "body content";
+ const std::string kBody = "body content";
size_t kNumResources = 4;
- QuicString push_urls[] = {"https://example.com/font.woff",
- "https://example.com/script.js",
- "https://fonts.example.com/font.woff",
- "https://example.com/logo-hires.jpg"};
+ std::string push_urls[] = {"https://example.com/font.woff",
+ "https://example.com/script.js",
+ "https://fonts.example.com/font.woff",
+ "https://example.com/logo-hires.jpg"};
AddRequestAndResponseWithServerPush("example.com", "/push_example", kBody,
push_urls, kNumResources, 0);
@@ -2880,11 +2880,11 @@
// hasn't finished yet.
EXPECT_TRUE(QuicStreamSequencerPeer::IsUnderlyingBufferAllocated(sequencer));
- for (const QuicString& url : push_urls) {
+ for (const std::string& url : push_urls) {
QUIC_DVLOG(1) << "send request for pushed stream on url " << url;
- QuicString expected_body =
+ std::string expected_body =
QuicStrCat("This is server push response body for ", url);
- QuicString response_body = client_->SendSynchronousRequest(url);
+ std::string response_body = client_->SendSynchronousRequest(url);
QUIC_DVLOG(1) << "response body " << response_body;
EXPECT_EQ(expected_body, response_body);
}
@@ -2904,9 +2904,9 @@
SetReorderPercentage(30);
// Add a response with headers, body, and push resources.
- const QuicString kBody = "body content";
+ const std::string kBody = "body content";
size_t const kNumResources = 4;
- QuicString push_urls[] = {
+ std::string push_urls[] = {
"https://example.com/font.woff",
"https://example.com/script.js",
"https://fonts.example.com/font.woff",
@@ -2924,13 +2924,13 @@
EXPECT_EQ(kBody, client_->SendSynchronousRequest(
"https://example.com/push_example"));
- for (const QuicString& url : push_urls) {
+ for (const std::string& url : push_urls) {
// Sending subsequent requesets will not actually send anything on the wire,
// as the responses are already in the client's cache.
QUIC_DVLOG(1) << "send request for pushed stream on url " << url;
- QuicString expected_body =
+ std::string expected_body =
QuicStrCat("This is server push response body for ", url);
- QuicString response_body = client_->SendSynchronousRequest(url);
+ std::string response_body = client_->SendSynchronousRequest(url);
QUIC_DVLOG(1) << "response body " << response_body;
EXPECT_EQ(expected_body, response_body);
}
@@ -2953,11 +2953,11 @@
SetReorderPercentage(30);
// Add a response with headers, body, and push resources.
- const QuicString kBody = "body content";
+ const std::string kBody = "body content";
// One more resource than max number of outgoing stream of this session.
const size_t kNumResources = 1 + kNumMaxStreams; // 11.
- QuicString push_urls[11];
+ std::string push_urls[11];
for (size_t i = 0; i < kNumResources; ++i) {
push_urls[i] = QuicStrCat("https://example.com/push_resources", i);
}
@@ -2973,7 +2973,7 @@
EXPECT_EQ(kBody, client_->SendSynchronousRequest(
"https://example.com/push_example"));
- for (const QuicString& url : push_urls) {
+ for (const std::string& url : push_urls) {
// Sending subsequent requesets will not actually send anything on the wire,
// as the responses are already in the client's cache.
EXPECT_EQ(QuicStrCat("This is server push response body for ", url),
@@ -3011,10 +3011,10 @@
SetReorderPercentage(30);
// Add a response with headers, body, and push resources.
- const QuicString kBody = "body content";
+ const std::string kBody = "body content";
const size_t kNumResources = kNumMaxStreams + 1;
- QuicString push_urls[11];
+ std::string push_urls[11];
for (size_t i = 0; i < kNumResources; ++i) {
push_urls[i] = QuicStrCat("http://example.com/push_resources", i);
}
@@ -3085,7 +3085,7 @@
// Request body size is 4G plus one more kSizeBytes.
int64_t request_body_size_bytes = pow(2, 32) + kSizeBytes;
ASSERT_LT(INT64_C(4294967296), request_body_size_bytes);
- QuicString body(kSizeBytes, 'a');
+ std::string body(kSizeBytes, 'a');
SpdyHeaderBlock headers;
headers[":method"] = "POST";
@@ -3099,7 +3099,7 @@
for (int i = 0; i < request_body_size_bytes / kSizeBytes; ++i) {
bool fin = (i == request_body_size_bytes - 1);
- client_->SendData(QuicString(body.data(), kSizeBytes), fin);
+ client_->SendData(std::string(body.data(), kSizeBytes), fin);
client_->client()->WaitForEvents();
}
VerifyCleanConnection(true);
@@ -3200,7 +3200,7 @@
headers[":path"] = "/foo";
headers[":scheme"] = "https";
headers[":authority"] = server_hostname_;
- headers["key"] = QuicString(64 * 1024, 'a');
+ headers["key"] = std::string(64 * 1024, 'a');
client_->SendMessage(headers, "");
client_->WaitForResponse();
@@ -3236,7 +3236,7 @@
client_->client()->client_session()->connection();
client_connection->set_debug_visitor(&observer);
// 100KB body.
- QuicString body(100 * 1024, 'a');
+ std::string body(100 * 1024, 'a');
SpdyHeaderBlock headers;
headers[":method"] = "POST";
headers[":path"] = "/foo";
@@ -3336,7 +3336,7 @@
std::unique_ptr<QuicTestClient> client(CreateQuicClient(bad_writer));
// 1 MB body.
- QuicString body(1024 * 1024, 'a');
+ std::string body(1024 * 1024, 'a');
SpdyHeaderBlock headers;
headers[":method"] = "POST";
headers[":path"] = "/foo";
@@ -3429,7 +3429,7 @@
// INCOMPLETE_RESPONSE will cause the server to not to send the trailer
// (and the FIN) after the response body.
- QuicString response_body(1305, 'a');
+ std::string response_body(1305, 'a');
SpdyHeaderBlock response_headers;
response_headers[":status"] = QuicTextUtils::Uint64ToString(200);
response_headers["content-length"] =
@@ -3471,7 +3471,7 @@
stream->MaybeSetTtl(QuicTime::Delta::FromMicroseconds(1));
// 1 MB body.
- QuicString body(1024 * 1024, 'a');
+ std::string body(1024 * 1024, 'a');
stream->WriteOrBufferBody(body, true);
client_->WaitForResponse();
EXPECT_EQ(QUIC_STREAM_TTL_EXPIRED, client_->stream_error());
@@ -3490,7 +3490,7 @@
ASSERT_GT(kMaxPacketSize, client_session->GetLargestMessagePayload());
ASSERT_LT(0, client_session->GetLargestMessagePayload());
- QuicString message_string(kMaxPacketSize, 'a');
+ std::string message_string(kMaxPacketSize, 'a');
QuicStringPiece message_buffer(message_string);
QuicRandom* random =
QuicConnectionPeer::GetHelper(client_connection)->GetRandomGenerator();
@@ -3662,7 +3662,7 @@
// STOP_SENDING will cause the server to not to send the trailer
// (and the FIN) after the response body. Instead, it sends a STOP_SENDING
// frame for the stream.
- QuicString response_body(1305, 'a');
+ std::string response_body(1305, 'a');
SpdyHeaderBlock response_headers;
response_headers[":status"] = QuicTextUtils::Uint64ToString(200);
response_headers["content-length"] =
diff --git a/quic/core/http/http_decoder.cc b/quic/core/http/http_decoder.cc
index e697821..55879d0 100644
--- a/quic/core/http/http_decoder.cc
+++ b/quic/core/http/http_decoder.cc
@@ -355,7 +355,7 @@
remaining_length_field_length_ -= bytes_to_read;
}
-void HttpDecoder::RaiseError(QuicErrorCode error, QuicString error_detail) {
+void HttpDecoder::RaiseError(QuicErrorCode error, std::string error_detail) {
state_ = STATE_ERROR;
error_ = error;
error_detail_ = std::move(error_detail);
diff --git a/quic/core/http/http_decoder.h b/quic/core/http/http_decoder.h
index 910d189..d6b1cc1 100644
--- a/quic/core/http/http_decoder.h
+++ b/quic/core/http/http_decoder.h
@@ -111,7 +111,7 @@
bool has_payload() { return has_payload_; }
QuicErrorCode error() const { return error_; }
- const QuicString& error_detail() const { return error_detail_; }
+ const std::string& error_detail() const { return error_detail_; }
private:
// Represents the current state of the parsing state machine.
@@ -145,7 +145,7 @@
void BufferFrameLength(QuicDataReader* reader);
// Sets |error_| and |error_detail_| accordingly.
- void RaiseError(QuicErrorCode error, QuicString error_detail);
+ void RaiseError(QuicErrorCode error, std::string error_detail);
// Parses the payload of a PRIORITY frame from |reader| into |frame|.
bool ParsePriorityFrame(QuicDataReader* reader, PriorityFrame* frame);
@@ -170,14 +170,14 @@
// Last error.
QuicErrorCode error_;
// The issue which caused |error_|
- QuicString error_detail_;
+ std::string error_detail_;
// True if the call to ProcessInput() generates any payload. Flushed every
// time ProcessInput() is called.
bool has_payload_;
// Remaining unparsed data.
- QuicString buffer_;
+ std::string buffer_;
// Remaining unparsed length field data.
- QuicString length_buffer_;
+ std::string length_buffer_;
};
} // namespace quic
diff --git a/quic/core/http/http_decoder_test.cc b/quic/core/http/http_decoder_test.cc
index c6d7d9f..cfabe70 100644
--- a/quic/core/http/http_decoder_test.cc
+++ b/quic/core/http/http_decoder_test.cc
@@ -321,12 +321,12 @@
TEST_F(HttpDecoderTest, FrameHeaderPartialDelivery) {
// A large input that will occupy more than 1 byte in the length field.
- QuicString input(2048, 'x');
+ std::string input(2048, 'x');
HttpEncoder encoder;
std::unique_ptr<char[]> buffer;
QuicByteCount header_length =
encoder.SerializeDataFrameHeader(input.length(), &buffer);
- QuicString header = QuicString(buffer.get(), header_length);
+ std::string header = std::string(buffer.get(), header_length);
// Partially send only 1 byte of the header to process.
EXPECT_EQ(1u, decoder_.ProcessInput(header.data(), 1));
EXPECT_EQ(QUIC_NO_ERROR, decoder_.error());
diff --git a/quic/core/http/quic_client_promised_info.cc b/quic/core/http/quic_client_promised_info.cc
index abfc4b4..3cebc1e 100644
--- a/quic/core/http/quic_client_promised_info.cc
+++ b/quic/core/http/quic_client_promised_info.cc
@@ -19,7 +19,7 @@
QuicClientPromisedInfo::QuicClientPromisedInfo(
QuicSpdyClientSessionBase* session,
QuicStreamId id,
- QuicString url)
+ std::string url)
: session_(session),
id_(id),
url_(std::move(url)),
diff --git a/quic/core/http/quic_client_promised_info.h b/quic/core/http/quic_client_promised_info.h
index 917c9f7..64ee09e 100644
--- a/quic/core/http/quic_client_promised_info.h
+++ b/quic/core/http/quic_client_promised_info.h
@@ -7,11 +7,11 @@
#include <cstddef>
-#include "net/third_party/quiche/src/quic/core/quic_alarm.h"
#include "net/third_party/quiche/src/quic/core/http/quic_client_push_promise_index.h"
-#include "net/third_party/quiche/src/quic/core/quic_packets.h"
#include "net/third_party/quiche/src/quic/core/http/quic_spdy_client_session_base.h"
#include "net/third_party/quiche/src/quic/core/http/quic_spdy_stream.h"
+#include "net/third_party/quiche/src/quic/core/quic_alarm.h"
+#include "net/third_party/quiche/src/quic/core/quic_packets.h"
#include "net/third_party/quiche/src/quic/platform/api/quic_export.h"
#include "net/third_party/quiche/src/quic/platform/api/quic_string.h"
#include "net/third_party/quiche/src/spdy/core/spdy_framer.h"
@@ -32,7 +32,7 @@
// Interface to QuicSpdyClientStream
QuicClientPromisedInfo(QuicSpdyClientSessionBase* session,
QuicStreamId id,
- QuicString url);
+ std::string url);
QuicClientPromisedInfo(const QuicClientPromisedInfo&) = delete;
QuicClientPromisedInfo& operator=(const QuicClientPromisedInfo&) = delete;
virtual ~QuicClientPromisedInfo();
@@ -76,7 +76,7 @@
QuicStreamId id() const { return id_; }
- const QuicString url() const { return url_; }
+ const std::string url() const { return url_; }
// Return true if there's a request pending matching this push promise.
bool is_validating() const { return client_request_delegate_ != nullptr; }
@@ -98,7 +98,7 @@
QuicSpdyClientSessionBase* session_;
QuicStreamId id_;
- QuicString url_;
+ std::string url_;
spdy::SpdyHeaderBlock request_headers_;
std::unique_ptr<spdy::SpdyHeaderBlock> response_headers_;
spdy::SpdyHeaderBlock client_request_headers_;
diff --git a/quic/core/http/quic_client_promised_info_test.cc b/quic/core/http/quic_client_promised_info_test.cc
index 2a7b1b0..43346d9 100644
--- a/quic/core/http/quic_client_promised_info_test.cc
+++ b/quic/core/http/quic_client_promised_info_test.cc
@@ -49,7 +49,7 @@
delete;
~MockQuicSpdyClientSession() override {}
- bool IsAuthorized(const QuicString& authority) override {
+ bool IsAuthorized(const std::string& authority) override {
return authorized_;
}
@@ -125,10 +125,10 @@
std::unique_ptr<StreamVisitor> stream_visitor_;
std::unique_ptr<QuicSpdyClientStream> promised_stream_;
SpdyHeaderBlock headers_;
- QuicString body_;
+ std::string body_;
SpdyHeaderBlock push_promise_;
QuicStreamId promise_id_;
- QuicString promise_url_;
+ std::string promise_url_;
SpdyHeaderBlock client_request_;
};
diff --git a/quic/core/http/quic_client_push_promise_index.cc b/quic/core/http/quic_client_push_promise_index.cc
index 2ba5951..08a4477 100644
--- a/quic/core/http/quic_client_push_promise_index.cc
+++ b/quic/core/http/quic_client_push_promise_index.cc
@@ -19,7 +19,7 @@
QuicClientPushPromiseIndex::TryHandle::~TryHandle() {}
QuicClientPromisedInfo* QuicClientPushPromiseIndex::GetPromised(
- const QuicString& url) {
+ const std::string& url) {
auto it = promised_by_url_.find(url);
if (it == promised_by_url_.end()) {
return nullptr;
@@ -31,7 +31,7 @@
const spdy::SpdyHeaderBlock& request,
QuicClientPushPromiseIndex::Delegate* delegate,
TryHandle** handle) {
- QuicString url(SpdyUtils::GetPromisedUrlFromHeaders(request));
+ std::string url(SpdyUtils::GetPromisedUrlFromHeaders(request));
auto it = promised_by_url_.find(url);
if (it != promised_by_url_.end()) {
QuicClientPromisedInfo* promised = it->second;
diff --git a/quic/core/http/quic_client_push_promise_index.h b/quic/core/http/quic_client_push_promise_index.h
index 5dd29b4..2647924 100644
--- a/quic/core/http/quic_client_push_promise_index.h
+++ b/quic/core/http/quic_client_push_promise_index.h
@@ -66,7 +66,7 @@
// Called by client code, used to enforce affinity between requests
// for promised streams and the session the promise came from.
- QuicClientPromisedInfo* GetPromised(const QuicString& url);
+ QuicClientPromisedInfo* GetPromised(const std::string& url);
// Called by client code, to initiate rendezvous between a request
// and a server push stream. If |request|'s url is in the index,
diff --git a/quic/core/http/quic_client_push_promise_index_test.cc b/quic/core/http/quic_client_push_promise_index_test.cc
index b68b41f..a4a0ee6 100644
--- a/quic/core/http/quic_client_push_promise_index_test.cc
+++ b/quic/core/http/quic_client_push_promise_index_test.cc
@@ -73,7 +73,7 @@
MockQuicSpdyClientSession session_;
QuicClientPushPromiseIndex index_;
spdy::SpdyHeaderBlock request_;
- QuicString url_;
+ std::string url_;
MockQuicClientPromisedInfo promised_;
QuicClientPushPromiseIndex::TryHandle* handle_;
};
diff --git a/quic/core/http/quic_header_list.cc b/quic/core/http/quic_header_list.cc
index cb10248..e937cf2 100644
--- a/quic/core/http/quic_header_list.cc
+++ b/quic/core/http/quic_header_list.cc
@@ -40,7 +40,7 @@
current_header_list_size_ += name.size();
current_header_list_size_ += value.size();
current_header_list_size_ += spdy::kPerHeaderOverhead;
- header_list_.emplace_back(QuicString(name), QuicString(value));
+ header_list_.emplace_back(std::string(name), std::string(value));
}
}
@@ -60,8 +60,8 @@
compressed_header_bytes_ = 0;
}
-QuicString QuicHeaderList::DebugString() const {
- QuicString s = "{ ";
+std::string QuicHeaderList::DebugString() const {
+ std::string s = "{ ";
for (const auto& p : *this) {
s.append(p.first + "=" + p.second + ", ");
}
diff --git a/quic/core/http/quic_header_list.h b/quic/core/http/quic_header_list.h
index c7b4c80..b62cba4 100644
--- a/quic/core/http/quic_header_list.h
+++ b/quic/core/http/quic_header_list.h
@@ -23,7 +23,7 @@
class QUIC_EXPORT_PRIVATE QuicHeaderList
: public spdy::SpdyHeadersHandlerInterface {
public:
- typedef QuicDeque<std::pair<QuicString, QuicString>> ListType;
+ typedef QuicDeque<std::pair<std::string, std::string>> ListType;
typedef ListType::const_iterator const_iterator;
QuicHeaderList();
@@ -56,10 +56,10 @@
size_t max_header_list_size() const { return max_header_list_size_; }
- QuicString DebugString() const;
+ std::string DebugString() const;
private:
- QuicDeque<std::pair<QuicString, QuicString>> header_list_;
+ QuicDeque<std::pair<std::string, std::string>> header_list_;
// The limit on the size of the header list (defined by spec as name + value +
// overhead for each header field). Headers over this limit will not be
@@ -76,8 +76,8 @@
};
inline bool operator==(const QuicHeaderList& l1, const QuicHeaderList& l2) {
- auto pred = [](const std::pair<QuicString, QuicString>& p1,
- const std::pair<QuicString, QuicString>& p2) {
+ auto pred = [](const std::pair<std::string, std::string>& p1,
+ const std::pair<std::string, std::string>& p2) {
return p1.first == p2.first && p1.second == p2.second;
};
return std::equal(l1.begin(), l1.end(), l2.begin(), pred);
diff --git a/quic/core/http/quic_header_list_test.cc b/quic/core/http/quic_header_list_test.cc
index 1b2a394..c098715 100644
--- a/quic/core/http/quic_header_list_test.cc
+++ b/quic/core/http/quic_header_list_test.cc
@@ -24,8 +24,8 @@
TEST_F(QuicHeaderListTest, TooLarge) {
QuicHeaderList headers;
- QuicString key = "key";
- QuicString value(1 << 18, '1');
+ std::string key = "key";
+ std::string value(1 << 18, '1');
// Send a header that exceeds max_header_list_size.
headers.OnHeader(key, value);
// Send a second header exceeding max_header_list_size.
@@ -42,8 +42,8 @@
TEST_F(QuicHeaderListTest, NotTooLarge) {
QuicHeaderList headers;
headers.set_max_header_list_size(1 << 20);
- QuicString key = "key";
- QuicString value(1 << 18, '1');
+ std::string key = "key";
+ std::string value(1 << 18, '1');
headers.OnHeader(key, value);
size_t total_bytes = key.size() + value.size();
headers.OnHeaderBlockEnd(total_bytes, total_bytes);
diff --git a/quic/core/http/quic_headers_stream_test.cc b/quic/core/http/quic_headers_stream_test.cc
index b6409b1..7059b72 100644
--- a/quic/core/http/quic_headers_stream_test.cc
+++ b/quic/core/http/quic_headers_stream_test.cc
@@ -344,10 +344,10 @@
QuicHeadersStream* headers_stream_;
SpdyHeaderBlock headers_;
std::unique_ptr<TestHeadersHandler> headers_handler_;
- QuicString body_;
- QuicString saved_data_;
- QuicString saved_header_data_;
- QuicString saved_payloads_;
+ std::string body_;
+ std::string saved_data_;
+ std::string saved_header_data_;
+ std::string saved_payloads_;
std::unique_ptr<SpdyFramer> framer_;
std::unique_ptr<http2::Http2DecoderAdapter> deframer_;
StrictMock<MockVisitor> visitor_;
@@ -360,7 +360,8 @@
};
// Run all tests with each version and perspective (client or server).
-INSTANTIATE_TEST_SUITE_P(Tests, QuicHeadersStreamTest,
+INSTANTIATE_TEST_SUITE_P(Tests,
+ QuicHeadersStreamTest,
::testing::ValuesIn(GetTestParams()));
TEST_P(QuicHeadersStreamTest, StreamId) {
@@ -539,9 +540,9 @@
// We want to create a frame that is more than the SPDY Framer's max control
// frame size, which is 16K, but less than the HPACK decoders max decode
// buffer size, which is 32K.
- headers_["key0"] = QuicString(1 << 13, '.');
- headers_["key1"] = QuicString(1 << 13, '.');
- headers_["key2"] = QuicString(1 << 13, '.');
+ headers_["key0"] = std::string(1 << 13, '.');
+ headers_["key1"] = std::string(1 << 13, '.');
+ headers_["key2"] = std::string(1 << 13, '.');
for (QuicStreamId stream_id = client_id_1_; stream_id < client_id_3_;
stream_id += next_stream_id_) {
for (bool fin : {false, true}) {
@@ -725,9 +726,9 @@
// Create some headers we expect to generate entries in HPACK's
// dynamic table, in addition to content-length.
- headers_["key0"] = QuicString(1 << 1, '.');
- headers_["key1"] = QuicString(1 << 2, '.');
- headers_["key2"] = QuicString(1 << 3, '.');
+ headers_["key0"] = std::string(1 << 1, '.');
+ headers_["key1"] = std::string(1 << 2, '.');
+ headers_["key2"] = std::string(1 << 3, '.');
for (QuicStreamId stream_id = client_id_1_; stream_id < client_id_3_;
stream_id += next_stream_id_) {
for (bool fin : {false, true}) {
diff --git a/quic/core/http/quic_server_session_base.cc b/quic/core/http/quic_server_session_base.cc
index f240ece..6c6acdf 100644
--- a/quic/core/http/quic_server_session_base.cc
+++ b/quic/core/http/quic_server_session_base.cc
@@ -80,7 +80,7 @@
}
void QuicServerSessionBase::OnConnectionClosed(QuicErrorCode error,
- const QuicString& error_details,
+ const std::string& error_details,
ConnectionCloseSource source) {
QuicSession::OnConnectionClosed(error, error_details, source);
// In the unlikely event we get a connection close while doing an asynchronous
diff --git a/quic/core/http/quic_server_session_base.h b/quic/core/http/quic_server_session_base.h
index 55a8d60..7332640 100644
--- a/quic/core/http/quic_server_session_base.h
+++ b/quic/core/http/quic_server_session_base.h
@@ -47,7 +47,7 @@
// Override the base class to cancel any ongoing asychronous crypto.
void OnConnectionClosed(QuicErrorCode error,
- const QuicString& error_details,
+ const std::string& error_details,
ConnectionCloseSource source) override;
// Sends a server config update to the client, containing new bandwidth
@@ -66,7 +66,7 @@
// client.
void OnConfigNegotiated() override;
- void set_serving_region(const QuicString& serving_region) {
+ void set_serving_region(const std::string& serving_region) {
serving_region_ = serving_region;
}
@@ -120,7 +120,7 @@
// Text describing server location. Sent to the client as part of the bandwith
// estimate in the source-address token. Optional, can be left empty.
- QuicString serving_region_;
+ std::string serving_region_;
// Time at which we send the last SCUP to the client.
QuicTime last_scup_time_;
diff --git a/quic/core/http/quic_server_session_base_test.cc b/quic/core/http/quic_server_session_base_test.cc
index efc2388..5678b26 100644
--- a/quic/core/http/quic_server_session_base_test.cc
+++ b/quic/core/http/quic_server_session_base_test.cc
@@ -492,7 +492,7 @@
int32_t bandwidth_estimate_kbytes_per_second = 123;
int32_t max_bandwidth_estimate_kbytes_per_second = 134;
int32_t max_bandwidth_estimate_timestamp = 1122334455;
- const QuicString serving_region = "not a real region";
+ const std::string serving_region = "not a real region";
session_->set_serving_region(serving_region);
session_->UnregisterStreamPriority(
@@ -601,7 +601,7 @@
copt.push_back(kBWRE);
QuicConfigPeer::SetReceivedConnectionOptions(session_->config(), copt);
- const QuicString kTestServingRegion = "a serving region";
+ const std::string kTestServingRegion = "a serving region";
session_->set_serving_region(kTestServingRegion);
// Set the time to be one hour + one second from the 0 baseline.
@@ -703,7 +703,7 @@
std::vector<ParsedQuicVersion> packet_version_list = {GetParam()};
std::unique_ptr<QuicEncryptedPacket> packet(ConstructEncryptedPacket(
TestConnectionId(1), EmptyQuicConnectionId(), true, false, 1,
- QuicString(chlo.GetSerialized().AsStringPiece()), CONNECTION_ID_PRESENT,
+ std::string(chlo.GetSerialized().AsStringPiece()), CONNECTION_ID_PRESENT,
CONNECTION_ID_ABSENT, PACKET_4BYTE_PACKET_NUMBER, &packet_version_list));
EXPECT_CALL(stream_helper_, CanAcceptClientHello(_, _, _, _, _))
diff --git a/quic/core/http/quic_spdy_client_session.cc b/quic/core/http/quic_spdy_client_session.cc
index 9e8170b..45eb0ae 100644
--- a/quic/core/http/quic_spdy_client_session.cc
+++ b/quic/core/http/quic_spdy_client_session.cc
@@ -175,7 +175,7 @@
this);
}
-bool QuicSpdyClientSession::IsAuthorized(const QuicString& authority) {
+bool QuicSpdyClientSession::IsAuthorized(const std::string& authority) {
return true;
}
diff --git a/quic/core/http/quic_spdy_client_session.h b/quic/core/http/quic_spdy_client_session.h
index c92753b..3bb8168 100644
--- a/quic/core/http/quic_spdy_client_session.h
+++ b/quic/core/http/quic_spdy_client_session.h
@@ -43,7 +43,7 @@
QuicCryptoClientStreamBase* GetMutableCryptoStream() override;
const QuicCryptoClientStreamBase* GetCryptoStream() const override;
- bool IsAuthorized(const QuicString& authority) override;
+ bool IsAuthorized(const std::string& authority) override;
// QuicSpdyClientSessionBase methods:
void OnProofValid(const QuicCryptoClientConfig::CachedState& cached) override;
diff --git a/quic/core/http/quic_spdy_client_session_base.cc b/quic/core/http/quic_spdy_client_session_base.cc
index 924ab36..b0dfc01 100644
--- a/quic/core/http/quic_spdy_client_session_base.cc
+++ b/quic/core/http/quic_spdy_client_session_base.cc
@@ -118,7 +118,7 @@
return false;
}
- const QuicString url = SpdyUtils::GetPromisedUrlFromHeaders(headers);
+ const std::string url = SpdyUtils::GetPromisedUrlFromHeaders(headers);
QuicClientPromisedInfo* old_promised = GetPromisedByUrl(url);
if (old_promised) {
QUIC_DVLOG(1) << "Promise for stream " << promised_id
@@ -150,7 +150,7 @@
}
QuicClientPromisedInfo* QuicSpdyClientSessionBase::GetPromisedByUrl(
- const QuicString& url) {
+ const std::string& url) {
auto it = push_promise_index_->promised_by_url()->find(url);
if (it != push_promise_index_->promised_by_url()->end()) {
return it->second;
diff --git a/quic/core/http/quic_spdy_client_session_base.h b/quic/core/http/quic_spdy_client_session_base.h
index f27708c..a47bdd0 100644
--- a/quic/core/http/quic_spdy_client_session_base.h
+++ b/quic/core/http/quic_spdy_client_session_base.h
@@ -6,8 +6,8 @@
#define QUICHE_QUIC_CORE_HTTP_QUIC_SPDY_CLIENT_SESSION_BASE_H_
#include "base/macros.h"
-#include "net/third_party/quiche/src/quic/core/quic_crypto_client_stream.h"
#include "net/third_party/quiche/src/quic/core/http/quic_spdy_session.h"
+#include "net/third_party/quiche/src/quic/core/quic_crypto_client_stream.h"
#include "net/third_party/quiche/src/quic/platform/api/quic_containers.h"
#include "net/third_party/quiche/src/quic/platform/api/quic_export.h"
#include "net/third_party/quiche/src/quic/platform/api/quic_string.h"
@@ -25,7 +25,7 @@
// session affinity for requests corresponding to cross-origin push
// promised streams.
using QuicPromisedByUrlMap =
- QuicUnorderedMap<QuicString, QuicClientPromisedInfo*>;
+ QuicUnorderedMap<std::string, QuicClientPromisedInfo*>;
// The maximum time a promises stream can be reserved without being
// claimed by a client request.
@@ -80,10 +80,10 @@
// list in the certificate should contain a matching DNS name, or IP
// address. |hostname| is derived from the ":authority" header field of
// the PUSH_PROMISE frame, port if present there will be dropped.
- virtual bool IsAuthorized(const QuicString& hostname) = 0;
+ virtual bool IsAuthorized(const std::string& hostname) = 0;
// Session retains ownership.
- QuicClientPromisedInfo* GetPromisedByUrl(const QuicString& url);
+ QuicClientPromisedInfo* GetPromisedByUrl(const std::string& url);
// Session retains ownership.
QuicClientPromisedInfo* GetPromisedById(const QuicStreamId id);
diff --git a/quic/core/http/quic_spdy_client_session_test.cc b/quic/core/http/quic_spdy_client_session_test.cc
index 3a40043..6b80196 100644
--- a/quic/core/http/quic_spdy_client_session_test.cc
+++ b/quic/core/http/quic_spdy_client_session_test.cc
@@ -165,7 +165,7 @@
std::unique_ptr<TestQuicSpdyClientSession> session_;
QuicClientPushPromiseIndex push_promise_index_;
SpdyHeaderBlock push_promise_;
- QuicString promise_url_;
+ std::string promise_url_;
QuicStreamId promised_stream_id_;
QuicStreamId associated_stream_id_;
};
@@ -636,7 +636,8 @@
session_->HandlePromised(associated_stream_id_, id, push_promise_));
// Verify that the promise is in the unclaimed streams map.
- QuicString promise_url(SpdyUtils::GetPromisedUrlFromHeaders(push_promise_));
+ std::string promise_url(
+ SpdyUtils::GetPromisedUrlFromHeaders(push_promise_));
EXPECT_NE(session_->GetPromisedByUrl(promise_url), nullptr);
EXPECT_NE(session_->GetPromisedById(id), nullptr);
}
@@ -654,7 +655,7 @@
session_->HandlePromised(associated_stream_id_, id, push_promise_));
// Verify that the promise was not created.
- QuicString promise_url(SpdyUtils::GetPromisedUrlFromHeaders(push_promise_));
+ std::string promise_url(SpdyUtils::GetPromisedUrlFromHeaders(push_promise_));
EXPECT_EQ(session_->GetPromisedById(id), nullptr);
EXPECT_EQ(session_->GetPromisedByUrl(promise_url), nullptr);
}
diff --git a/quic/core/http/quic_spdy_client_stream.h b/quic/core/http/quic_spdy_client_stream.h
index 8a66740..521914a 100644
--- a/quic/core/http/quic_spdy_client_stream.h
+++ b/quic/core/http/quic_spdy_client_stream.h
@@ -57,7 +57,7 @@
bool fin);
// Returns the response data.
- const QuicString& data() { return data_; }
+ const std::string& data() { return data_; }
// Returns whatever headers have been received for this stream.
const spdy::SpdyHeaderBlock& response_headers() { return response_headers_; }
@@ -83,7 +83,7 @@
// The parsed content-length, or -1 if none is specified.
int64_t content_length_;
int response_code_;
- QuicString data_;
+ std::string data_;
size_t header_bytes_read_;
size_t header_bytes_written_;
diff --git a/quic/core/http/quic_spdy_client_stream_test.cc b/quic/core/http/quic_spdy_client_stream_test.cc
index 0b2c157..3c56630 100644
--- a/quic/core/http/quic_spdy_client_stream_test.cc
+++ b/quic/core/http/quic_spdy_client_stream_test.cc
@@ -97,7 +97,7 @@
std::unique_ptr<QuicSpdyClientStream> stream_;
std::unique_ptr<StreamVisitor> stream_visitor_;
SpdyHeaderBlock headers_;
- QuicString body_;
+ std::string body_;
HttpEncoder encoder_;
};
@@ -124,10 +124,10 @@
std::unique_ptr<char[]> buffer;
QuicByteCount header_length =
encoder_.SerializeDataFrameHeader(body_.length(), &buffer);
- QuicString header = QuicString(buffer.get(), header_length);
- QuicString data = VersionHasDataFrameHeader(connection_->transport_version())
- ? header + body_
- : body_;
+ std::string header = std::string(buffer.get(), header_length);
+ std::string data = VersionHasDataFrameHeader(connection_->transport_version())
+ ? header + body_
+ : body_;
stream_->OnStreamFrame(
QuicStreamFrame(stream_->id(), /*fin=*/false, /*offset=*/0, data));
EXPECT_EQ("200", stream_->response_headers().find(":status")->second);
@@ -155,10 +155,10 @@
std::unique_ptr<char[]> buffer;
QuicByteCount header_length =
encoder_.SerializeDataFrameHeader(body_.length(), &buffer);
- QuicString header = QuicString(buffer.get(), header_length);
- QuicString data = VersionHasDataFrameHeader(connection_->transport_version())
- ? header + body_
- : body_;
+ std::string header = std::string(buffer.get(), header_length);
+ std::string data = VersionHasDataFrameHeader(connection_->transport_version())
+ ? header + body_
+ : body_;
stream_->OnStreamFrame(
QuicStreamFrame(stream_->id(), /*fin=*/false, /*offset=*/0, data));
EXPECT_EQ("200", stream_->response_headers().find(":status")->second);
@@ -168,7 +168,7 @@
TEST_P(QuicSpdyClientStreamTest,
QUIC_TEST_DISABLED_IN_CHROME(TestFramingExtraData)) {
- QuicString large_body = "hello world!!!!!!";
+ std::string large_body = "hello world!!!!!!";
auto headers = AsHeaderList(headers_);
stream_->OnStreamHeaderList(false, headers.uncompressed_header_bytes(),
@@ -180,10 +180,10 @@
std::unique_ptr<char[]> buffer;
QuicByteCount header_length =
encoder_.SerializeDataFrameHeader(large_body.length(), &buffer);
- QuicString header = QuicString(buffer.get(), header_length);
- QuicString data = VersionHasDataFrameHeader(connection_->transport_version())
- ? header + large_body
- : large_body;
+ std::string header = std::string(buffer.get(), header_length);
+ std::string data = VersionHasDataFrameHeader(connection_->transport_version())
+ ? header + large_body
+ : large_body;
EXPECT_CALL(*connection_, SendControlFrame(_));
EXPECT_CALL(*connection_,
OnStreamReset(stream_->id(), QUIC_BAD_APPLICATION_PAYLOAD));
@@ -219,10 +219,10 @@
std::unique_ptr<char[]> buffer;
QuicByteCount header_length =
encoder_.SerializeDataFrameHeader(body_.length(), &buffer);
- QuicString header = QuicString(buffer.get(), header_length);
- QuicString data = VersionHasDataFrameHeader(connection_->transport_version())
- ? header + body_
- : body_;
+ std::string header = std::string(buffer.get(), header_length);
+ std::string data = VersionHasDataFrameHeader(connection_->transport_version())
+ ? header + body_
+ : body_;
stream_->OnStreamFrame(
QuicStreamFrame(stream_->id(), /*fin=*/false, /*offset=*/0, data));
EXPECT_TRUE(stream_->reading_stopped());
diff --git a/quic/core/http/quic_spdy_session.cc b/quic/core/http/quic_spdy_session.cc
index ddae51a..415129e 100644
--- a/quic/core/http/quic_spdy_session.cc
+++ b/quic/core/http/quic_spdy_session.cc
@@ -283,7 +283,7 @@
}
private:
- void CloseConnection(const QuicString& details, QuicErrorCode code) {
+ void CloseConnection(const std::string& details, QuicErrorCode code) {
if (session_->IsConnected()) {
session_->CloseConnectionWithDetails(code, details);
}
@@ -419,8 +419,8 @@
// byte offset necessary for flow control and open stream accounting.
size_t final_byte_offset = 0;
for (const auto& header : header_list) {
- const QuicString& header_key = header.first;
- const QuicString& header_value = header.second;
+ const std::string& header_key = header.first;
+ const std::string& header_value = header.second;
if (header_key == kFinalOffsetHeaderKey) {
if (!QuicTextUtils::StringToSizeT(header_value, &final_byte_offset)) {
connection()->CloseConnection(
@@ -577,7 +577,8 @@
QuicStreamId promised_stream_id,
size_t frame_len,
const QuicHeaderList& header_list) {
- QuicString error = "OnPromiseHeaderList should be overridden in client code.";
+ std::string error =
+ "OnPromiseHeaderList should be overridden in client code.";
QUIC_BUG << error;
connection()->CloseConnection(QUIC_INTERNAL_ERROR, error,
ConnectionCloseBehavior::SILENT_CLOSE);
@@ -688,7 +689,7 @@
}
void QuicSpdySession::CloseConnectionWithDetails(QuicErrorCode error,
- const QuicString& details) {
+ const std::string& details) {
connection()->CloseConnection(
error, details, ConnectionCloseBehavior::SEND_CONNECTION_CLOSE_PACKET);
}
diff --git a/quic/core/http/quic_spdy_session.h b/quic/core/http/quic_spdy_session.h
index 93067fa..c13daeb 100644
--- a/quic/core/http/quic_spdy_session.h
+++ b/quic/core/http/quic_spdy_session.h
@@ -153,7 +153,7 @@
virtual bool ShouldReleaseHeadersStreamSequencerBuffer();
void CloseConnectionWithDetails(QuicErrorCode error,
- const QuicString& details);
+ const std::string& details);
void set_max_inbound_header_list_size(size_t max_inbound_header_list_size) {
max_inbound_header_list_size_ = max_inbound_header_list_size;
diff --git a/quic/core/http/quic_spdy_session_test.cc b/quic/core/http/quic_spdy_session_test.cc
index 1c53472..1087493 100644
--- a/quic/core/http/quic_spdy_session_test.cc
+++ b/quic/core/http/quic_spdy_session_test.cc
@@ -64,7 +64,7 @@
encryption_established_ = true;
handshake_confirmed_ = true;
CryptoHandshakeMessage msg;
- QuicString error_details;
+ std::string error_details;
session()->config()->SetInitialStreamFlowControlWindowToSend(
kInitialStreamFlowControlWindowForTest);
session()->config()->SetInitialSessionFlowControlWindowToSend(
@@ -569,7 +569,7 @@
EXPECT_CALL(*connection_, SendControlFrame(_));
EXPECT_CALL(*connection_, OnStreamReset(closed_stream_id, _));
stream2->Reset(QUIC_BAD_APPLICATION_PAYLOAD);
- QuicString msg =
+ std::string msg =
QuicStrCat("Marking unknown stream ", closed_stream_id, " blocked.");
EXPECT_QUIC_BUG(session_.MarkConnectionLevelWriteBlocked(closed_stream_id),
msg);
@@ -1086,7 +1086,7 @@
// Create a stream, and send enough data to make it flow control blocked.
TestStream* stream2 = session_.CreateOutgoingBidirectionalStream();
- QuicString body(kMinimumFlowControlSendWindow, '.');
+ std::string body(kMinimumFlowControlSendWindow, '.');
EXPECT_FALSE(stream2->flow_controller()->IsBlocked());
EXPECT_FALSE(session_.IsConnectionFlowControlBlocked());
EXPECT_FALSE(session_.IsStreamFlowControlBlocked());
@@ -1321,7 +1321,7 @@
// adjusting the connection level flow control receive window to take into
// account the total number of bytes sent by the peer.
const QuicStreamOffset kByteOffset = 5678;
- QuicString body = "hello";
+ std::string body = "hello";
QuicStreamFrame frame(stream->id(), true, kByteOffset, QuicStringPiece(body));
session_.OnStreamFrame(frame);
diff --git a/quic/core/http/quic_spdy_stream.cc b/quic/core/http/quic_spdy_stream.cc
index 9e9f1b7..cdd61c4 100644
--- a/quic/core/http/quic_spdy_stream.cc
+++ b/quic/core/http/quic_spdy_stream.cc
@@ -98,7 +98,7 @@
}
private:
- void CloseConnectionOnWrongFrame(QuicString frame_type) {
+ void CloseConnectionOnWrongFrame(std::string frame_type) {
stream_->session()->connection()->CloseConnection(
QUIC_HTTP_DECODER_ERROR, frame_type + " frame received on data stream",
ConnectionCloseBehavior::SEND_CONNECTION_CLOSE_PACKET);
diff --git a/quic/core/http/quic_spdy_stream_body_buffer_test.cc b/quic/core/http/quic_spdy_stream_body_buffer_test.cc
index 7ea776f..deaf54a 100644
--- a/quic/core/http/quic_spdy_stream_body_buffer_test.cc
+++ b/quic/core/http/quic_spdy_stream_body_buffer_test.cc
@@ -25,7 +25,7 @@
MOCK_METHOD0(OnFinRead, void());
MOCK_METHOD0(OnDataAvailable, void());
MOCK_METHOD2(CloseConnectionWithDetails,
- void(QuicErrorCode error, const QuicString& details));
+ void(QuicErrorCode error, const std::string& details));
MOCK_METHOD1(Reset, void(QuicRstStreamErrorCode error));
MOCK_METHOD0(OnCanWrite, void());
MOCK_METHOD1(AddBytesConsumed, void(QuicByteCount bytes));
@@ -61,7 +61,7 @@
};
TEST_F(QuicSpdyStreamBodyBufferTest, ReceiveBodies) {
- QuicString body(1024, 'a');
+ std::string body(1024, 'a');
EXPECT_FALSE(body_buffer_.HasBytesToRead());
body_buffer_.OnDataHeader(Http3FrameLengths(3, 1024));
body_buffer_.OnDataPayload(QuicStringPiece(body));
@@ -70,7 +70,7 @@
}
TEST_F(QuicSpdyStreamBodyBufferTest, PeekBody) {
- QuicString body(1024, 'a');
+ std::string body(1024, 'a');
body_buffer_.OnDataHeader(Http3FrameLengths(3, 1024));
body_buffer_.OnDataPayload(QuicStringPiece(body));
EXPECT_EQ(1024u, body_buffer_.total_body_bytes_received());
@@ -84,13 +84,13 @@
// Buffer only receives 1 frame. Stream consumes less or equal than a frame.
TEST_F(QuicSpdyStreamBodyBufferTest, MarkConsumedPartialSingleFrame) {
testing::InSequence seq;
- QuicString body(1024, 'a');
+ std::string body(1024, 'a');
std::unique_ptr<char[]> buffer;
QuicByteCount header_length =
encoder_.SerializeDataFrameHeader(body.length(), &buffer);
- QuicString header = QuicString(buffer.get(), header_length);
+ std::string header = std::string(buffer.get(), header_length);
Http3FrameLengths lengths(header_length, 1024);
- QuicString data = header + body;
+ std::string data = header + body;
QuicStreamFrame frame(1, false, 0, data);
sequencer_.OnStreamFrame(frame);
body_buffer_.OnDataHeader(lengths);
@@ -104,25 +104,25 @@
TEST_F(QuicSpdyStreamBodyBufferTest, MarkConsumedMultipleFrames) {
testing::InSequence seq;
// 1st frame.
- QuicString body1(1024, 'a');
+ std::string body1(1024, 'a');
std::unique_ptr<char[]> buffer;
QuicByteCount header_length1 =
encoder_.SerializeDataFrameHeader(body1.length(), &buffer);
- QuicString header1 = QuicString(buffer.get(), header_length1);
+ std::string header1 = std::string(buffer.get(), header_length1);
Http3FrameLengths lengths1(header_length1, 1024);
- QuicString data1 = header1 + body1;
+ std::string data1 = header1 + body1;
QuicStreamFrame frame1(1, false, 0, data1);
sequencer_.OnStreamFrame(frame1);
body_buffer_.OnDataHeader(lengths1);
body_buffer_.OnDataPayload(QuicStringPiece(body1));
// 2nd frame.
- QuicString body2(2048, 'b');
+ std::string body2(2048, 'b');
QuicByteCount header_length2 =
encoder_.SerializeDataFrameHeader(body2.length(), &buffer);
- QuicString header2 = QuicString(buffer.get(), header_length2);
+ std::string header2 = std::string(buffer.get(), header_length2);
Http3FrameLengths lengths2(header_length2, 2048);
- QuicString data2 = header2 + body2;
+ std::string data2 = header2 + body2;
QuicStreamFrame frame2(1, false, data1.length(), data2);
sequencer_.OnStreamFrame(frame2);
body_buffer_.OnDataHeader(lengths2);
@@ -139,7 +139,7 @@
}
TEST_F(QuicSpdyStreamBodyBufferTest, MarkConsumedMoreThanBuffered) {
- QuicString body(1024, 'a');
+ std::string body(1024, 'a');
Http3FrameLengths lengths(3, 1024);
body_buffer_.OnDataHeader(lengths);
body_buffer_.OnDataPayload(body);
@@ -152,13 +152,13 @@
// Buffer receives 1 frame. Stream read from the buffer.
TEST_F(QuicSpdyStreamBodyBufferTest, ReadSingleBody) {
testing::InSequence seq;
- QuicString body(1024, 'a');
+ std::string body(1024, 'a');
std::unique_ptr<char[]> buffer;
QuicByteCount header_length =
encoder_.SerializeDataFrameHeader(body.length(), &buffer);
- QuicString header = QuicString(buffer.get(), header_length);
+ std::string header = std::string(buffer.get(), header_length);
Http3FrameLengths lengths(header_length, 1024);
- QuicString data = header + body;
+ std::string data = header + body;
QuicStreamFrame frame(1, false, 0, data);
sequencer_.OnStreamFrame(frame);
body_buffer_.OnDataHeader(lengths);
@@ -179,25 +179,25 @@
TEST_F(QuicSpdyStreamBodyBufferTest, ReadMultipleBody) {
testing::InSequence seq;
// 1st frame.
- QuicString body1(1024, 'a');
+ std::string body1(1024, 'a');
std::unique_ptr<char[]> buffer;
QuicByteCount header_length1 =
encoder_.SerializeDataFrameHeader(body1.length(), &buffer);
- QuicString header1 = QuicString(buffer.get(), header_length1);
+ std::string header1 = std::string(buffer.get(), header_length1);
Http3FrameLengths lengths1(header_length1, 1024);
- QuicString data1 = header1 + body1;
+ std::string data1 = header1 + body1;
QuicStreamFrame frame1(1, false, 0, data1);
sequencer_.OnStreamFrame(frame1);
body_buffer_.OnDataHeader(lengths1);
body_buffer_.OnDataPayload(QuicStringPiece(body1));
// 2nd frame.
- QuicString body2(2048, 'b');
+ std::string body2(2048, 'b');
QuicByteCount header_length2 =
encoder_.SerializeDataFrameHeader(body2.length(), &buffer);
- QuicString header2 = QuicString(buffer.get(), header_length2);
+ std::string header2 = std::string(buffer.get(), header_length2);
Http3FrameLengths lengths2(header_length2, 2048);
- QuicString data2 = header2 + body2;
+ std::string data2 = header2 + body2;
QuicStreamFrame frame2(1, false, data1.length(), data2);
sequencer_.OnStreamFrame(frame2);
body_buffer_.OnDataHeader(lengths2);
diff --git a/quic/core/http/quic_spdy_stream_test.cc b/quic/core/http/quic_spdy_stream_test.cc
index 1aabe0e..d61d197 100644
--- a/quic/core/http/quic_spdy_stream_test.cc
+++ b/quic/core/http/quic_spdy_stream_test.cc
@@ -67,7 +67,7 @@
vec.iov_base = buffer;
vec.iov_len = QUIC_ARRAYSIZE(buffer);
size_t bytes_read = Readv(&vec, 1);
- data_ += QuicString(buffer, bytes_read);
+ data_ += std::string(buffer, bytes_read);
}
MOCK_METHOD1(WriteHeadersMock, void(bool fin));
@@ -81,13 +81,13 @@
return 0;
}
- const QuicString& data() const { return data_; }
+ const std::string& data() const { return data_; }
const spdy::SpdyHeaderBlock& saved_headers() const { return saved_headers_; }
private:
bool should_process_data_;
spdy::SpdyHeaderBlock saved_headers_;
- QuicString data_;
+ std::string data_;
};
class TestMockUpdateStreamSession : public MockQuicSpdySession {
@@ -192,7 +192,8 @@
HttpEncoder encoder_;
};
-INSTANTIATE_TEST_SUITE_P(Tests, QuicSpdyStreamTest,
+INSTANTIATE_TEST_SUITE_P(Tests,
+ QuicSpdyStreamTest,
::testing::ValuesIn(AllSupportedVersions()));
TEST_P(QuicSpdyStreamTest, ProcessHeaderList) {
@@ -295,7 +296,7 @@
TEST_P(QuicSpdyStreamTest, MarkHeadersConsumed) {
Initialize(kShouldProcessData);
- QuicString body = "this is the body";
+ std::string body = "this is the body";
QuicHeaderList headers = ProcessHeaders(false, headers_);
EXPECT_EQ(headers, stream_->header_list());
@@ -306,12 +307,12 @@
TEST_P(QuicSpdyStreamTest, ProcessHeadersAndBody) {
Initialize(kShouldProcessData);
- QuicString body = "this is the body";
+ std::string body = "this is the body";
std::unique_ptr<char[]> buffer;
QuicByteCount header_length =
encoder_.SerializeDataFrameHeader(body.length(), &buffer);
- QuicString header = QuicString(buffer.get(), header_length);
- QuicString data = HasFrameHeader() ? header + body : body;
+ std::string header = std::string(buffer.get(), header_length);
+ std::string data = HasFrameHeader() ? header + body : body;
EXPECT_EQ("", stream_->data());
QuicHeaderList headers = ProcessHeaders(false, headers_);
@@ -326,12 +327,12 @@
TEST_P(QuicSpdyStreamTest, ProcessHeadersAndBodyFragments) {
Initialize(kShouldProcessData);
- QuicString body = "this is the body";
+ std::string body = "this is the body";
std::unique_ptr<char[]> buffer;
QuicByteCount header_length =
encoder_.SerializeDataFrameHeader(body.length(), &buffer);
- QuicString header = QuicString(buffer.get(), header_length);
- QuicString data = HasFrameHeader() ? header + body : body;
+ std::string header = std::string(buffer.get(), header_length);
+ std::string data = HasFrameHeader() ? header + body : body;
for (size_t fragment_size = 1; fragment_size < data.size(); ++fragment_size) {
Initialize(kShouldProcessData);
@@ -352,12 +353,12 @@
TEST_P(QuicSpdyStreamTest, ProcessHeadersAndBodyFragmentsSplit) {
Initialize(kShouldProcessData);
- QuicString body = "this is the body";
+ std::string body = "this is the body";
std::unique_ptr<char[]> buffer;
QuicByteCount header_length =
encoder_.SerializeDataFrameHeader(body.length(), &buffer);
- QuicString header = QuicString(buffer.get(), header_length);
- QuicString data = HasFrameHeader() ? header + body : body;
+ std::string header = std::string(buffer.get(), header_length);
+ std::string data = HasFrameHeader() ? header + body : body;
for (size_t split_point = 1; split_point < data.size() - 1; ++split_point) {
Initialize(kShouldProcessData);
@@ -383,12 +384,12 @@
TEST_P(QuicSpdyStreamTest, ProcessHeadersAndBodyReadv) {
Initialize(!kShouldProcessData);
- QuicString body = "this is the body";
+ std::string body = "this is the body";
std::unique_ptr<char[]> buf;
QuicByteCount header_length =
encoder_.SerializeDataFrameHeader(body.length(), &buf);
- QuicString header = QuicString(buf.get(), header_length);
- QuicString data = HasFrameHeader() ? header + body : body;
+ std::string header = std::string(buf.get(), header_length);
+ std::string data = HasFrameHeader() ? header + body : body;
ProcessHeaders(false, headers_);
QuicStreamFrame frame(GetNthClientInitiatedBidirectionalId(0), false, 0,
@@ -404,17 +405,17 @@
size_t bytes_read = stream_->Readv(&vec, 1);
EXPECT_EQ(body.length(), bytes_read);
- EXPECT_EQ(body, QuicString(buffer, bytes_read));
+ EXPECT_EQ(body, std::string(buffer, bytes_read));
}
TEST_P(QuicSpdyStreamTest, ProcessHeadersAndLargeBodySmallReadv) {
Initialize(kShouldProcessData);
- QuicString body(12 * 1024, 'a');
+ std::string body(12 * 1024, 'a');
std::unique_ptr<char[]> buf;
QuicByteCount header_length =
encoder_.SerializeDataFrameHeader(body.length(), &buf);
- QuicString header = QuicString(buf.get(), header_length);
- QuicString data = HasFrameHeader() ? header + body : body;
+ std::string header = std::string(buf.get(), header_length);
+ std::string data = HasFrameHeader() ? header + body : body;
ProcessHeaders(false, headers_);
QuicStreamFrame frame(GetNthClientInitiatedBidirectionalId(0), false, 0,
QuicStringPiece(data));
@@ -429,19 +430,19 @@
vec[1].iov_len = QUIC_ARRAYSIZE(buffer2);
size_t bytes_read = stream_->Readv(vec, 2);
EXPECT_EQ(2048u * 2, bytes_read);
- EXPECT_EQ(body.substr(0, 2048), QuicString(buffer, 2048));
- EXPECT_EQ(body.substr(2048, 2048), QuicString(buffer2, 2048));
+ EXPECT_EQ(body.substr(0, 2048), std::string(buffer, 2048));
+ EXPECT_EQ(body.substr(2048, 2048), std::string(buffer2, 2048));
}
TEST_P(QuicSpdyStreamTest, ProcessHeadersAndBodyMarkConsumed) {
Initialize(!kShouldProcessData);
- QuicString body = "this is the body";
+ std::string body = "this is the body";
std::unique_ptr<char[]> buf;
QuicByteCount header_length =
encoder_.SerializeDataFrameHeader(body.length(), &buf);
- QuicString header = QuicString(buf.get(), header_length);
- QuicString data = HasFrameHeader() ? header + body : body;
+ std::string header = std::string(buf.get(), header_length);
+ std::string data = HasFrameHeader() ? header + body : body;
ProcessHeaders(false, headers_);
QuicStreamFrame frame(GetNthClientInitiatedBidirectionalId(0), false, 0,
@@ -453,7 +454,7 @@
EXPECT_EQ(1, stream_->GetReadableRegions(&vec, 1));
EXPECT_EQ(body.length(), vec.iov_len);
- EXPECT_EQ(body, QuicString(static_cast<char*>(vec.iov_base), vec.iov_len));
+ EXPECT_EQ(body, std::string(static_cast<char*>(vec.iov_base), vec.iov_len));
stream_->MarkConsumed(body.length());
EXPECT_EQ(data.length(), stream_->flow_controller()->bytes_consumed());
@@ -461,15 +462,15 @@
TEST_P(QuicSpdyStreamTest, ProcessHeadersAndConsumeMultipleBody) {
Initialize(!kShouldProcessData);
- QuicString body1 = "this is body 1";
- QuicString body2 = "body 2";
+ std::string body1 = "this is body 1";
+ std::string body2 = "body 2";
std::unique_ptr<char[]> buf;
QuicByteCount header_length =
encoder_.SerializeDataFrameHeader(body1.length(), &buf);
- QuicString header = QuicString(buf.get(), header_length);
- QuicString data1 = HasFrameHeader() ? header + body1 : body1;
+ std::string header = std::string(buf.get(), header_length);
+ std::string data1 = HasFrameHeader() ? header + body1 : body1;
header_length = encoder_.SerializeDataFrameHeader(body2.length(), &buf);
- QuicString data2 = HasFrameHeader() ? header + body2 : body2;
+ std::string data2 = HasFrameHeader() ? header + body2 : body2;
ProcessHeaders(false, headers_);
QuicStreamFrame frame1(GetNthClientInitiatedBidirectionalId(0), false, 0,
@@ -488,12 +489,12 @@
TEST_P(QuicSpdyStreamTest, ProcessHeadersAndBodyIncrementalReadv) {
Initialize(!kShouldProcessData);
- QuicString body = "this is the body";
+ std::string body = "this is the body";
std::unique_ptr<char[]> buf;
QuicByteCount header_length =
encoder_.SerializeDataFrameHeader(body.length(), &buf);
- QuicString header = QuicString(buf.get(), header_length);
- QuicString data = HasFrameHeader() ? header + body : body;
+ std::string header = std::string(buf.get(), header_length);
+ std::string data = HasFrameHeader() ? header + body : body;
ProcessHeaders(false, headers_);
QuicStreamFrame frame(GetNthClientInitiatedBidirectionalId(0), false, 0,
@@ -516,12 +517,12 @@
TEST_P(QuicSpdyStreamTest, ProcessHeadersUsingReadvWithMultipleIovecs) {
Initialize(!kShouldProcessData);
- QuicString body = "this is the body";
+ std::string body = "this is the body";
std::unique_ptr<char[]> buf;
QuicByteCount header_length =
encoder_.SerializeDataFrameHeader(body.length(), &buf);
- QuicString header = QuicString(buf.get(), header_length);
- QuicString data = HasFrameHeader() ? header + body : body;
+ std::string header = std::string(buf.get(), header_length);
+ std::string data = HasFrameHeader() ? header + body : body;
ProcessHeaders(false, headers_);
QuicStreamFrame frame(GetNthClientInitiatedBidirectionalId(0), false, 0,
@@ -560,7 +561,7 @@
// Try to send more data than the flow control limit allows.
const uint64_t kOverflow = 15;
- QuicString body(kWindow + kOverflow, 'a');
+ std::string body(kWindow + kOverflow, 'a');
const uint64_t kHeaderLength = HasFrameHeader() ? 2 : 0;
if (HasFrameHeader()) {
@@ -602,14 +603,14 @@
stream_->flow_controller()));
// Stream receives enough data to fill a fraction of the receive window.
- QuicString body(kWindow / 3, 'a');
+ std::string body(kWindow / 3, 'a');
QuicByteCount header_length = 0;
- QuicString data;
+ std::string data;
if (HasFrameHeader()) {
std::unique_ptr<char[]> buffer;
header_length = encoder_.SerializeDataFrameHeader(body.length(), &buffer);
- QuicString header = QuicString(buffer.get(), header_length);
+ std::string header = std::string(buffer.get(), header_length);
data = header + body;
} else {
data = body;
@@ -651,14 +652,14 @@
stream_->flow_controller()));
// Stream receives enough data to fill a fraction of the receive window.
- QuicString body(kWindow / 3, 'a');
+ std::string body(kWindow / 3, 'a');
QuicByteCount header_length = 0;
- QuicString data;
+ std::string data;
if (HasFrameHeader()) {
std::unique_ptr<char[]> buffer;
header_length = encoder_.SerializeDataFrameHeader(body.length(), &buffer);
- QuicString header = QuicString(buffer.get(), header_length);
+ std::string header = std::string(buffer.get(), header_length);
data = header + body;
} else {
data = body;
@@ -719,24 +720,24 @@
// Each stream gets a quarter window of data. This should not trigger a
// WINDOW_UPDATE for either stream, nor for the connection.
QuicByteCount header_length = 0;
- QuicString body;
- QuicString data;
- QuicString data2;
- QuicString body2(1, 'a');
+ std::string body;
+ std::string data;
+ std::string data2;
+ std::string body2(1, 'a');
if (HasFrameHeader()) {
- body = QuicString(kWindow / 4 - 2, 'a');
+ body = std::string(kWindow / 4 - 2, 'a');
std::unique_ptr<char[]> buffer;
header_length = encoder_.SerializeDataFrameHeader(body.length(), &buffer);
- QuicString header = QuicString(buffer.get(), header_length);
+ std::string header = std::string(buffer.get(), header_length);
data = header + body;
std::unique_ptr<char[]> buffer2;
QuicByteCount header_length2 =
encoder_.SerializeDataFrameHeader(body2.length(), &buffer2);
- QuicString header2 = QuicString(buffer2.get(), header_length2);
+ std::string header2 = std::string(buffer2.get(), header_length2);
data2 = header2 + body2;
} else {
- body = QuicString(kWindow / 4, 'a');
+ body = std::string(kWindow / 4, 'a');
data = body;
data2 = body2;
}
@@ -773,12 +774,12 @@
ProcessHeaders(false, headers_);
// Receive data to overflow the window, violating flow control.
- QuicString body(kWindow + 1, 'a');
+ std::string body(kWindow + 1, 'a');
std::unique_ptr<char[]> buf;
QuicByteCount header_length =
encoder_.SerializeDataFrameHeader(body.length(), &buf);
- QuicString header = QuicString(buf.get(), header_length);
- QuicString data = HasFrameHeader() ? header + body : body;
+ std::string header = std::string(buf.get(), header_length);
+ std::string data = HasFrameHeader() ? header + body : body;
QuicStreamFrame frame(GetNthClientInitiatedBidirectionalId(0), false, 0,
QuicStringPiece(data));
EXPECT_CALL(*connection_,
@@ -816,12 +817,12 @@
ProcessHeaders(false, headers_);
// Send enough data to overflow the connection level flow control window.
- QuicString body(kConnectionWindow + 1, 'a');
+ std::string body(kConnectionWindow + 1, 'a');
std::unique_ptr<char[]> buf;
QuicByteCount header_length =
encoder_.SerializeDataFrameHeader(body.length(), &buf);
- QuicString header = QuicString(buf.get(), header_length);
- QuicString data = HasFrameHeader() ? header + body : body;
+ std::string header = std::string(buf.get(), header_length);
+ std::string data = HasFrameHeader() ? header + body : body;
EXPECT_LT(data.size(), kStreamWindow);
QuicStreamFrame frame(GetNthClientInitiatedBidirectionalId(0), false, 0,
@@ -844,7 +845,7 @@
stream_->flow_controller()));
// Send a frame with a FIN but no data. This should not be blocked.
- QuicString body = "";
+ std::string body = "";
bool fin = true;
EXPECT_CALL(*connection_,
@@ -906,12 +907,12 @@
QuicHeaderList headers = ProcessHeaders(false, headers_);
stream_->ConsumeHeaderList();
- const QuicString body = "this is the body";
+ const std::string body = "this is the body";
std::unique_ptr<char[]> buf;
QuicByteCount header_length =
encoder_.SerializeDataFrameHeader(body.length(), &buf);
- QuicString header = QuicString(buf.get(), header_length);
- QuicString data = HasFrameHeader() ? header + body : body;
+ std::string header = std::string(buf.get(), header_length);
+ std::string data = HasFrameHeader() ? header + body : body;
// Receive trailing headers.
SpdyHeaderBlock trailers_block;
@@ -1041,12 +1042,12 @@
stream_->ConsumeHeaderList();
// Receive and consume body with FIN set, and no trailers.
- QuicString body(1024, 'x');
+ std::string body(1024, 'x');
std::unique_ptr<char[]> buf;
QuicByteCount header_length =
encoder_.SerializeDataFrameHeader(body.length(), &buf);
- QuicString header = QuicString(buf.get(), header_length);
- QuicString data = HasFrameHeader() ? header + body : body;
+ std::string header = std::string(buf.get(), header_length);
+ std::string data = HasFrameHeader() ? header + body : body;
QuicStreamFrame frame(GetNthClientInitiatedBidirectionalId(0), /*fin=*/true,
0, data);
@@ -1083,7 +1084,7 @@
// Write non-zero body data to force a non-zero final offset.
EXPECT_CALL(*session_, WritevData(_, _, _, _, _)).Times(AtLeast(1));
- QuicString body(1024, 'x'); // 1 kB
+ std::string body(1024, 'x'); // 1 kB
QuicByteCount header_length = 0;
if (HasFrameHeader()) {
std::unique_ptr<char[]> buf;
@@ -1116,7 +1117,7 @@
// Write non-zero body data.
EXPECT_CALL(*session_, WritevData(_, _, _, _, _)).Times(AtLeast(1));
const int kBodySize = 1 * 1024; // 1 kB
- stream_->WriteOrBufferBody(QuicString(kBodySize, 'x'), false);
+ stream_->WriteOrBufferBody(std::string(kBodySize, 'x'), false);
EXPECT_EQ(0u, stream_->BufferedDataBytes());
// Headers and body have been fully written, there is no queued data. Writing
@@ -1143,7 +1144,7 @@
}
EXPECT_CALL(*session_, WritevData(_, _, kBodySize, _, NO_FIN))
.WillOnce(Return(QuicConsumedData(kBodySize - 1, false)));
- stream_->WriteOrBufferBody(QuicString(kBodySize, 'x'), false);
+ stream_->WriteOrBufferBody(std::string(kBodySize, 'x'), false);
EXPECT_EQ(1u, stream_->BufferedDataBytes());
// Writing trailers will send a FIN, but not close the write side of the
@@ -1201,11 +1202,11 @@
QuicStreamFrame frame1(
QuicUtils::GetHeadersStreamId(connection_->transport_version()), false, 0,
"Header1");
- QuicString header = "";
+ std::string header = "";
if (HasFrameHeader()) {
std::unique_ptr<char[]> buffer;
QuicByteCount header_length = encoder_.SerializeDataFrameHeader(5, &buffer);
- header = QuicString(buffer.get(), header_length);
+ header = std::string(buffer.get(), header_length);
}
QuicStreamFrame frame2(stream_->id(), true, 0, header + "Test1");
QuicStreamFrame frame3(
@@ -1400,8 +1401,8 @@
QuicReferenceCountedPointer<MockAckListener> mock_ack_listener(
new StrictMock<MockAckListener>);
stream_->set_ack_listener(mock_ack_listener);
- QuicString body = "Test1";
- QuicString body2(100, 'x');
+ std::string body = "Test1";
+ std::string body2(100, 'x');
EXPECT_CALL(*session_, WritevData(_, _, _, _, _)).Times(AtLeast(1));
stream_->WriteOrBufferBody(body, false);
@@ -1410,10 +1411,10 @@
std::unique_ptr<char[]> buffer;
QuicByteCount header_length =
encoder_.SerializeDataFrameHeader(body.length(), &buffer);
- QuicString header = QuicString(buffer.get(), header_length);
+ std::string header = std::string(buffer.get(), header_length);
header_length = encoder_.SerializeDataFrameHeader(body2.length(), &buffer);
- QuicString header2 = QuicString(buffer.get(), header_length);
+ std::string header2 = std::string(buffer.get(), header_length);
EXPECT_CALL(*mock_ack_listener, OnPacketAcked(body.length(), _));
QuicStreamFrame frame(stream_->id(), false, 0, header + body);
@@ -1445,8 +1446,8 @@
QuicReferenceCountedPointer<MockAckListener> mock_ack_listener(
new StrictMock<MockAckListener>);
stream_->set_ack_listener(mock_ack_listener);
- QuicString body = "Test1";
- QuicString body2(100, 'x');
+ std::string body = "Test1";
+ std::string body2(100, 'x');
struct iovec body1_iov = {const_cast<char*>(body.data()), body.length()};
struct iovec body2_iov = {const_cast<char*>(body2.data()), body2.length()};
QuicMemSliceStorage storage(&body1_iov, 1,
@@ -1460,10 +1461,10 @@
std::unique_ptr<char[]> buffer;
QuicByteCount header_length =
encoder_.SerializeDataFrameHeader(body.length(), &buffer);
- QuicString header = QuicString(buffer.get(), header_length);
+ std::string header = std::string(buffer.get(), header_length);
header_length = encoder_.SerializeDataFrameHeader(body2.length(), &buffer);
- QuicString header2 = QuicString(buffer.get(), header_length);
+ std::string header2 = std::string(buffer.get(), header_length);
EXPECT_CALL(*mock_ack_listener,
OnPacketAcked(body.length() + body2.length(), _));
@@ -1485,8 +1486,8 @@
QuicReferenceCountedPointer<MockAckListener> mock_ack_listener(
new StrictMock<MockAckListener>);
stream_->set_ack_listener(mock_ack_listener);
- QuicString body = "Test1";
- QuicString body2(100, 'x');
+ std::string body = "Test1";
+ std::string body2(100, 'x');
EXPECT_CALL(*session_, WritevData(_, _, _, _, _)).Times(AtLeast(1));
stream_->WriteOrBufferBody(body, false);
@@ -1495,10 +1496,10 @@
std::unique_ptr<char[]> buffer;
QuicByteCount header_length =
encoder_.SerializeDataFrameHeader(body.length(), &buffer);
- QuicString header = QuicString(buffer.get(), header_length);
+ std::string header = std::string(buffer.get(), header_length);
header_length = encoder_.SerializeDataFrameHeader(body2.length(), &buffer);
- QuicString header2 = QuicString(buffer.get(), header_length);
+ std::string header2 = std::string(buffer.get(), header_length);
EXPECT_CALL(*mock_ack_listener, OnPacketRetransmitted(body.length()));
QuicStreamFrame frame(stream_->id(), false, 0, header + body);
diff --git a/quic/core/http/spdy_utils.cc b/quic/core/http/spdy_utils.cc
index 7022ae2..c3f312b 100644
--- a/quic/core/http/spdy_utils.cc
+++ b/quic/core/http/spdy_utils.cc
@@ -61,7 +61,7 @@
int64_t* content_length,
SpdyHeaderBlock* headers) {
for (const auto& p : header_list) {
- const QuicString& name = p.first;
+ const std::string& name = p.first;
if (name.empty()) {
QUIC_DLOG(ERROR) << "Header name must not be empty.";
return false;
@@ -90,7 +90,7 @@
SpdyHeaderBlock* trailers) {
bool found_final_byte_offset = false;
for (const auto& p : header_list) {
- const QuicString& name = p.first;
+ const std::string& name = p.first;
// Pull out the final offset pseudo header which indicates the number of
// response body bytes expected.
@@ -129,7 +129,7 @@
}
// static
-QuicString SpdyUtils::GetPromisedUrlFromHeaders(
+std::string SpdyUtils::GetPromisedUrlFromHeaders(
const SpdyHeaderBlock& headers) {
// RFC 7540, Section 8.1.2.3: All HTTP/2 requests MUST include exactly
// one valid value for the ":method", ":scheme", and ":path" pseudo-header
@@ -150,12 +150,12 @@
// So the only methods allowed in a PUSH_PROMISE are GET and HEAD.
SpdyHeaderBlock::const_iterator it = headers.find(":method");
if (it == headers.end() || (it->second != "GET" && it->second != "HEAD")) {
- return QuicString();
+ return std::string();
}
it = headers.find(":scheme");
if (it == headers.end() || it->second.empty()) {
- return QuicString();
+ return std::string();
}
QuicStringPiece scheme = it->second;
@@ -164,7 +164,7 @@
// (see Section 10.1).
it = headers.find(":authority");
if (it == headers.end() || it->second.empty()) {
- return QuicString();
+ return std::string();
}
QuicStringPiece authority = it->second;
@@ -175,7 +175,7 @@
// is deferred to implementations in QuicUrlUtils::GetPushPromiseUrl().
it = headers.find(":path");
if (it == headers.end()) {
- return QuicString();
+ return std::string();
}
QuicStringPiece path = it->second;
@@ -183,7 +183,7 @@
}
// static
-QuicString SpdyUtils::GetPromisedHostNameFromHeaders(
+std::string SpdyUtils::GetPromisedHostNameFromHeaders(
const SpdyHeaderBlock& headers) {
// TODO(fayang): Consider just checking out the value of the ":authority" key
// in headers.
@@ -192,22 +192,22 @@
// static
bool SpdyUtils::PromisedUrlIsValid(const SpdyHeaderBlock& headers) {
- QuicString url(GetPromisedUrlFromHeaders(headers));
+ std::string url(GetPromisedUrlFromHeaders(headers));
return !url.empty() && GURL(url).is_valid();
}
// static
-bool SpdyUtils::PopulateHeaderBlockFromUrl(const QuicString url,
+bool SpdyUtils::PopulateHeaderBlockFromUrl(const std::string url,
SpdyHeaderBlock* headers) {
(*headers)[":method"] = "GET";
size_t pos = url.find("://");
- if (pos == QuicString::npos) {
+ if (pos == std::string::npos) {
return false;
}
(*headers)[":scheme"] = url.substr(0, pos);
size_t start = pos + 3;
pos = url.find("/", start);
- if (pos == QuicString::npos) {
+ if (pos == std::string::npos) {
(*headers)[":authority"] = url.substr(start);
(*headers)[":path"] = "/";
return true;
@@ -218,9 +218,9 @@
}
// static
-QuicString SpdyUtils::GetPushPromiseUrl(QuicStringPiece scheme,
- QuicStringPiece authority,
- QuicStringPiece path) {
+std::string SpdyUtils::GetPushPromiseUrl(QuicStringPiece scheme,
+ QuicStringPiece authority,
+ QuicStringPiece path) {
// RFC 7540, Section 8.1.2.3: The ":path" pseudo-header field includes the
// path and query parts of the target URI (the "path-absolute" production
// and optionally a '?' character followed by the "query" production (see
@@ -249,7 +249,7 @@
// 8.1.2.3 about OPTIONS requests does not apply here (i.e. ":path" cannot be
// "*").
if (path.empty() || path[0] != '/' || (path.size() >= 2 && path[1] == '/')) {
- return QuicString();
+ return std::string();
}
// Validate the scheme; this is to ensure a scheme of "foo://bar" is not
@@ -262,7 +262,7 @@
if (!url::CanonicalizeScheme(scheme.data(), scheme_component,
&canon_scheme_output, &canon_component) ||
!canon_component.is_nonempty() || canon_component.begin != 0) {
- return QuicString();
+ return std::string();
}
canonical_scheme.resize(canon_component.len + 1);
@@ -285,14 +285,14 @@
// it is performed later in processing, only "http" and "https" schemed
// URIs are supported for PUSH.
if (username_component.is_valid() || password_component.is_valid()) {
- return QuicString();
+ return std::string();
}
// Failed parsing or no host present. ParseAuthority() will ensure that
// host_component + port_component cover the entire string, if
// username_component and password_component are not present.
if (!host_component.is_nonempty()) {
- return QuicString();
+ return std::string();
}
// Validate the port (if present; it's optional).
@@ -300,7 +300,7 @@
if (port_component.is_nonempty()) {
parsed_port_number = url::ParsePort(authority.data(), port_component);
if (parsed_port_number < 0 && parsed_port_number != url::PORT_UNSPECIFIED) {
- return QuicString();
+ return std::string();
}
}
@@ -312,7 +312,7 @@
if (!url::CanonicalizeHost(authority.data(), host_component,
&canon_host_output, &canon_component) ||
!canon_component.is_nonempty() || canon_component.begin != 0) {
- return QuicString();
+ return std::string();
}
// At this point, "authority" has been validated to either be of the form
@@ -332,7 +332,7 @@
origin_url.has_username() || origin_url.has_password() ||
(origin_url.has_path() && origin_url.path_piece() != "/") ||
origin_url.has_query() || origin_url.has_ref()) {
- return QuicString();
+ return std::string();
}
// Attempt to parse the path.
@@ -344,7 +344,7 @@
// fragment to the query.
GURL full_url(spec);
if (!full_url.is_valid() || full_url.has_ref()) {
- return QuicString();
+ return std::string();
}
return full_url.spec();
diff --git a/quic/core/http/spdy_utils.h b/quic/core/http/spdy_utils.h
index 073eeeb..f356767 100644
--- a/quic/core/http/spdy_utils.h
+++ b/quic/core/http/spdy_utils.h
@@ -41,11 +41,11 @@
// :path headers of a PUSH_PROMISE. Returns empty string if the headers do not
// conform to HTTP/2 spec or if the ":method" header contains a forbidden
// method for PUSH_PROMISE.
- static QuicString GetPromisedUrlFromHeaders(
+ static std::string GetPromisedUrlFromHeaders(
const spdy::SpdyHeaderBlock& headers);
// Returns hostname, or empty string if missing.
- static QuicString GetPromisedHostNameFromHeaders(
+ static std::string GetPromisedHostNameFromHeaders(
const spdy::SpdyHeaderBlock& headers);
// Returns true if result of |GetPromisedUrlFromHeaders()| is non-empty
@@ -54,15 +54,15 @@
// Populates the fields of |headers| to make a GET request of |url|,
// which must be fully-qualified.
- static bool PopulateHeaderBlockFromUrl(const QuicString url,
+ static bool PopulateHeaderBlockFromUrl(const std::string url,
spdy::SpdyHeaderBlock* headers);
// Returns a canonical, valid URL for a PUSH_PROMISE with the specified
// ":scheme", ":authority", and ":path" header fields, or an empty
// string if the resulting URL is not valid or supported.
- static QuicString GetPushPromiseUrl(QuicStringPiece scheme,
- QuicStringPiece authority,
- QuicStringPiece path);
+ static std::string GetPushPromiseUrl(QuicStringPiece scheme,
+ QuicStringPiece authority,
+ QuicStringPiece path);
};
} // namespace quic
diff --git a/quic/core/http/spdy_utils_test.cc b/quic/core/http/spdy_utils_test.cc
index 6cd2f1d..5e6fbbf 100644
--- a/quic/core/http/spdy_utils_test.cc
+++ b/quic/core/http/spdy_utils_test.cc
@@ -39,7 +39,7 @@
{"cookie", "part3"},
// Already-delimited headers are passed through.
- {"passed-through", QuicString("foo\0baz", 7)},
+ {"passed-through", std::string("foo\0baz", 7)},
// Other headers are joined on \0.
{"joined", "value 1"},
@@ -374,7 +374,7 @@
using PopulateHeaderBlockFromUrl = QuicTest;
TEST_F(PopulateHeaderBlockFromUrl, NormalUsage) {
- QuicString url = "https://www.google.com/index.html";
+ std::string url = "https://www.google.com/index.html";
SpdyHeaderBlock headers;
EXPECT_TRUE(SpdyUtils::PopulateHeaderBlockFromUrl(url, &headers));
EXPECT_EQ("https", headers[":scheme"].as_string());
@@ -383,7 +383,7 @@
}
TEST_F(PopulateHeaderBlockFromUrl, UrlWithNoPath) {
- QuicString url = "https://www.google.com";
+ std::string url = "https://www.google.com";
SpdyHeaderBlock headers;
EXPECT_TRUE(SpdyUtils::PopulateHeaderBlockFromUrl(url, &headers));
EXPECT_EQ("https", headers[":scheme"].as_string());