summaryrefslogtreecommitdiff
path: root/chromium/net/tools/quic
diff options
context:
space:
mode:
authorAllan Sandfeld Jensen <allan.jensen@qt.io>2017-04-05 17:15:33 +0200
committerAllan Sandfeld Jensen <allan.jensen@qt.io>2017-04-11 07:47:18 +0000
commit7324afb043a0b1e623d8e8eb906cdc53bdeb4685 (patch)
treea3fe2d74ea9c9e142c390dac4ca0e219382ace46 /chromium/net/tools/quic
parent6a4cabb866f66d4128a97cdc6d9d08ce074f1247 (diff)
downloadqtwebengine-chromium-7324afb043a0b1e623d8e8eb906cdc53bdeb4685.tar.gz
BASELINE: Update Chromium to 58.0.3029.54
Change-Id: I67f57065a7afdc8e4614adb5c0230281428df4d1 Reviewed-by: Peter Varga <pvarga@inf.u-szeged.hu>
Diffstat (limited to 'chromium/net/tools/quic')
-rw-r--r--chromium/net/tools/quic/chlo_extractor_test.cc6
-rw-r--r--chromium/net/tools/quic/end_to_end_test.cc22
-rw-r--r--chromium/net/tools/quic/quic_client.cc2
-rw-r--r--chromium/net/tools/quic/quic_client.h8
-rw-r--r--chromium/net/tools/quic/quic_client_base.cc10
-rw-r--r--chromium/net/tools/quic/quic_client_base.h58
-rw-r--r--chromium/net/tools/quic/quic_client_bin.cc61
-rw-r--r--chromium/net/tools/quic/quic_client_session_test.cc19
-rw-r--r--chromium/net/tools/quic/quic_client_test.cc11
-rw-r--r--chromium/net/tools/quic/quic_dispatcher.cc71
-rw-r--r--chromium/net/tools/quic/quic_dispatcher.h7
-rw-r--r--chromium/net/tools/quic/quic_dispatcher_test.cc54
-rw-r--r--chromium/net/tools/quic/quic_epoll_connection_helper.cc1
-rw-r--r--chromium/net/tools/quic/quic_http_response_cache.cc40
-rw-r--r--chromium/net/tools/quic/quic_http_response_cache.h12
-rw-r--r--chromium/net/tools/quic/quic_http_response_cache_test.cc45
-rw-r--r--chromium/net/tools/quic/quic_packet_printer_bin.cc61
-rw-r--r--chromium/net/tools/quic/quic_reject_reason_decoder_bin.cc11
-rw-r--r--chromium/net/tools/quic/quic_server.cc17
-rw-r--r--chromium/net/tools/quic/quic_server.h10
-rw-r--r--chromium/net/tools/quic/quic_server_test.cc9
-rw-r--r--chromium/net/tools/quic/quic_simple_client_bin.cc5
-rw-r--r--chromium/net/tools/quic/quic_simple_client_test.cc2
-rw-r--r--chromium/net/tools/quic/quic_simple_crypto_server_stream_helper.cc4
-rw-r--r--chromium/net/tools/quic/quic_simple_server_session.cc10
-rw-r--r--chromium/net/tools/quic/quic_simple_server_session.h4
-rw-r--r--chromium/net/tools/quic/quic_simple_server_session_test.cc8
-rw-r--r--chromium/net/tools/quic/quic_simple_server_stream.cc34
-rw-r--r--chromium/net/tools/quic/quic_simple_server_stream.h3
-rw-r--r--chromium/net/tools/quic/quic_simple_server_stream_test.cc83
-rw-r--r--chromium/net/tools/quic/quic_simple_server_test.cc2
-rw-r--r--chromium/net/tools/quic/quic_spdy_client_stream.cc1
-rw-r--r--chromium/net/tools/quic/quic_spdy_client_stream_test.cc12
-rw-r--r--chromium/net/tools/quic/quic_time_wait_list_manager.cc4
-rw-r--r--chromium/net/tools/quic/quic_time_wait_list_manager.h6
-rw-r--r--chromium/net/tools/quic/quic_time_wait_list_manager_test.cc2
-rw-r--r--chromium/net/tools/quic/stateless_rejector_test.cc82
-rw-r--r--chromium/net/tools/quic/test_tools/limited_mtu_test_writer.h2
-rw-r--r--chromium/net/tools/quic/test_tools/mock_quic_session_visitor.cc (renamed from chromium/net/tools/quic/test_tools/mock_quic_server_session_visitor.cc)2
-rw-r--r--chromium/net/tools/quic/test_tools/mock_quic_session_visitor.h (renamed from chromium/net/tools/quic/test_tools/mock_quic_server_session_visitor.h)6
-rw-r--r--chromium/net/tools/quic/test_tools/mock_quic_time_wait_list_manager.h2
-rw-r--r--chromium/net/tools/quic/test_tools/quic_client_peer.h4
-rw-r--r--chromium/net/tools/quic/test_tools/quic_dispatcher_peer.h4
-rw-r--r--chromium/net/tools/quic/test_tools/quic_server_peer.h1
-rw-r--r--chromium/net/tools/quic/test_tools/quic_test_client.cc33
-rw-r--r--chromium/net/tools/quic/test_tools/quic_test_client.h14
-rw-r--r--chromium/net/tools/quic/test_tools/quic_test_server.cc16
-rw-r--r--chromium/net/tools/quic/test_tools/quic_test_server.h6
-rw-r--r--chromium/net/tools/quic/test_tools/server_thread.cc6
-rw-r--r--chromium/net/tools/quic/test_tools/server_thread.h8
50 files changed, 413 insertions, 488 deletions
diff --git a/chromium/net/tools/quic/chlo_extractor_test.cc b/chromium/net/tools/quic/chlo_extractor_test.cc
index bdce1b81c3a..299e05d9b0c 100644
--- a/chromium/net/tools/quic/chlo_extractor_test.cc
+++ b/chromium/net/tools/quic/chlo_extractor_test.cc
@@ -63,9 +63,9 @@ class ChloExtractorTest : public ::testing::Test {
std::unique_ptr<QuicPacket> packet(
BuildUnsizedDataPacket(&framer, header_, frames));
EXPECT_TRUE(packet != nullptr);
- size_t encrypted_length = framer.EncryptPayload(
- ENCRYPTION_NONE, header_.path_id, header_.packet_number, *packet,
- buffer_, arraysize(buffer_));
+ size_t encrypted_length =
+ framer.EncryptPayload(ENCRYPTION_NONE, header_.packet_number, *packet,
+ buffer_, arraysize(buffer_));
ASSERT_NE(0u, encrypted_length);
packet_.reset(new QuicEncryptedPacket(buffer_, encrypted_length));
EXPECT_TRUE(packet_ != nullptr);
diff --git a/chromium/net/tools/quic/end_to_end_test.cc b/chromium/net/tools/quic/end_to_end_test.cc
index 93e499d9754..93ed6953dbf 100644
--- a/chromium/net/tools/quic/end_to_end_test.cc
+++ b/chromium/net/tools/quic/end_to_end_test.cc
@@ -318,9 +318,10 @@ class EndToEndTest : public ::testing::TestWithParam<TestParams> {
}
QuicTestClient* CreateQuicClient(QuicPacketWriterWrapper* writer) {
- QuicTestClient* client = new QuicTestClient(
- server_address_, server_hostname_, client_config_,
- client_supported_versions_, CryptoTestUtils::ProofVerifierForTesting());
+ QuicTestClient* client =
+ new QuicTestClient(server_address_, server_hostname_, client_config_,
+ client_supported_versions_,
+ crypto_test_utils::ProofVerifierForTesting());
client->UseWriter(writer);
client->Connect();
return client;
@@ -438,8 +439,8 @@ class EndToEndTest : public ::testing::TestWithParam<TestParams> {
FLAGS_quic_reloadable_flag_quic_use_cheap_stateless_rejects =
GetParam().use_cheap_stateless_reject;
- auto test_server = new QuicTestServer(
- CryptoTestUtils::ProofSourceForTesting(), server_config_,
+ auto* test_server = new QuicTestServer(
+ crypto_test_utils::ProofSourceForTesting(), server_config_,
server_supported_versions_, &response_cache_);
server_thread_.reset(new ServerThread(test_server, server_address_));
if (chlo_multiplier_ != 0) {
@@ -1823,7 +1824,7 @@ TEST_P(EndToEndTest, FlowControlsSynced) {
QuicSpdySession* const client_session = client_->client()->session();
QuicDispatcher* dispatcher =
QuicServerPeer::GetDispatcher(server_thread_->server());
- auto server_session = static_cast<QuicSpdySession*>(
+ auto* server_session = static_cast<QuicSpdySession*>(
dispatcher->session_map().begin()->second.get());
ExpectFlowControlsSynced(client_session->flow_controller(),
server_session->flow_controller());
@@ -2548,6 +2549,13 @@ TEST_P(EndToEndTest, LargePostEarlyResponse) {
set_server_initial_session_flow_control_receive_window(kWindowSize);
ASSERT_TRUE(Initialize());
+ if (FLAGS_quic_reloadable_flag_quic_always_enable_bidi_streaming) {
+ // This test is testing the same behavior as
+ // EarlyResponseWithQuicStreamNoError, except for the additional final check
+ // that the stream is reset on early response. Once this flag is deprecated
+ // the tests will be the same and this one can be removed.
+ return;
+ }
EXPECT_TRUE(client_->client()->WaitForCryptoHandshakeConfirmed());
@@ -2637,7 +2645,7 @@ class EndToEndTestServerPush : public EndToEndTest {
std::list<QuicHttpResponseCache::ServerPushInfo> push_resources;
for (size_t i = 0; i < num_resources; ++i) {
string url = push_urls[i];
- GURL resource_url(url);
+ QuicUrl resource_url(url);
string body =
use_large_response
? large_resource
diff --git a/chromium/net/tools/quic/quic_client.cc b/chromium/net/tools/quic/quic_client.cc
index bfd2442cd25..5151c8931e6 100644
--- a/chromium/net/tools/quic/quic_client.cc
+++ b/chromium/net/tools/quic/quic_client.cc
@@ -12,11 +12,9 @@
#include <unistd.h>
#include "base/run_loop.h"
-#include "net/base/sockaddr_storage.h"
#include "net/quic/core/crypto/quic_random.h"
#include "net/quic/core/quic_connection.h"
#include "net/quic/core/quic_data_reader.h"
-#include "net/quic/core/quic_flags.h"
#include "net/quic/core/quic_packets.h"
#include "net/quic/core/quic_server_id.h"
#include "net/quic/core/spdy_utils.h"
diff --git a/chromium/net/tools/quic/quic_client.h b/chromium/net/tools/quic/quic_client.h
index 7a479f637d1..4c0e67363f6 100644
--- a/chromium/net/tools/quic/quic_client.h
+++ b/chromium/net/tools/quic/quic_client.h
@@ -14,10 +14,10 @@
#include "base/command_line.h"
#include "base/macros.h"
-#include "base/strings/string_piece.h"
#include "net/quic/core/quic_client_push_promise_index.h"
#include "net/quic/core/quic_config.h"
#include "net/quic/core/quic_spdy_stream.h"
+#include "net/quic/platform/api/quic_containers.h"
#include "net/tools/epoll_server/epoll_server.h"
#include "net/tools/quic/quic_client_base.h"
#include "net/tools/quic/quic_client_session.h"
@@ -90,12 +90,12 @@ class QuicClient : public QuicClientBase,
EpollServer* epoll_server() { return epoll_server_; }
- const linked_hash_map<int, QuicSocketAddress>& fd_address_map() const {
+ const QuicLinkedHashMap<int, QuicSocketAddress>& fd_address_map() const {
return fd_address_map_;
}
private:
- friend class net::test::QuicClientPeer;
+ friend class test::QuicClientPeer;
// Actually clean up |fd|.
void CleanUpUDPSocketImpl(int fd);
@@ -105,7 +105,7 @@ class QuicClient : public QuicClientBase,
// Map mapping created UDP sockets to their addresses. By using linked hash
// map, the order of socket creation can be recorded.
- linked_hash_map<int, QuicSocketAddress> fd_address_map_;
+ QuicLinkedHashMap<int, QuicSocketAddress> fd_address_map_;
// If overflow_supported_ is true, this will be the number of packets dropped
// during the lifetime of the server.
diff --git a/chromium/net/tools/quic/quic_client_base.cc b/chromium/net/tools/quic/quic_client_base.cc
index dc07949d359..a8d43977f76 100644
--- a/chromium/net/tools/quic/quic_client_base.cc
+++ b/chromium/net/tools/quic/quic_client_base.cc
@@ -5,6 +5,7 @@
#include "net/tools/quic/quic_client_base.h"
#include "net/quic/core/crypto/quic_random.h"
+#include "net/quic/core/quic_flags.h"
#include "net/quic/core/quic_server_id.h"
#include "net/quic/core/spdy_utils.h"
#include "net/quic/platform/api/quic_logging.h"
@@ -68,10 +69,12 @@ void QuicClientBase::OnClose(QuicSpdyStream* stream) {
if (store_response_) {
auto status = response_headers.find(":status");
if (status == response_headers.end() ||
- !StringToInt(status->second, &latest_response_code_)) {
+ !QuicTextUtils::StringToInt(status->second, &latest_response_code_)) {
QUIC_LOG(ERROR) << "Invalid response headers";
}
latest_response_headers_ = response_headers.DebugString();
+ preliminary_response_headers_ =
+ client_stream->preliminary_headers().DebugString();
latest_response_header_block_ = response_headers.Clone();
latest_response_body_ = client_stream->data();
latest_response_trailers_ =
@@ -469,6 +472,11 @@ const string& QuicClientBase::latest_response_headers() const {
return latest_response_headers_;
}
+const string& QuicClientBase::preliminary_response_headers() const {
+ QUIC_BUG_IF(!store_response_) << "Response not stored!";
+ return preliminary_response_headers_;
+}
+
const SpdyHeaderBlock& QuicClientBase::latest_response_header_block() const {
QUIC_BUG_IF(!store_response_) << "Response not stored!";
return latest_response_header_block_;
diff --git a/chromium/net/tools/quic/quic_client_base.h b/chromium/net/tools/quic/quic_client_base.h
index 66472837f7b..e65b5cd267b 100644
--- a/chromium/net/tools/quic/quic_client_base.h
+++ b/chromium/net/tools/quic/quic_client_base.h
@@ -8,19 +8,12 @@
#ifndef NET_TOOLS_QUIC_QUIC_CLIENT_BASE_H_
#define NET_TOOLS_QUIC_QUIC_CLIENT_BASE_H_
-#include <memory>
#include <string>
#include "base/macros.h"
#include "net/quic/core/crypto/crypto_handshake.h"
-#include "net/quic/core/crypto/quic_crypto_client_config.h"
-#include "net/quic/core/quic_alarm_factory.h"
-#include "net/quic/core/quic_bandwidth.h"
#include "net/quic/core/quic_client_push_promise_index.h"
#include "net/quic/core/quic_config.h"
-#include "net/quic/core/quic_connection.h"
-#include "net/quic/core/quic_packet_writer.h"
-#include "net/quic/core/quic_packets.h"
#include "net/quic/platform/api/quic_socket_address.h"
#include "net/tools/quic/quic_client_session.h"
#include "net/tools/quic/quic_spdy_client_stream.h"
@@ -45,17 +38,14 @@ class QuicClientBase : public QuicClientPushPromiseIndex::Delegate,
// The client uses these objects to keep track of any data to resend upon
// receipt of a stateless reject. Recall that the client API allows callers
- // to optimistically send data to the server prior to
- // handshake-confirmation.
+ // to optimistically send data to the server prior to handshake-confirmation.
// If the client subsequently receives a stateless reject, it must tear down
- // its existing session, create a new session, and resend all previously
- // sent
+ // its existing session, create a new session, and resend all previously sent
// data. It uses these objects to keep track of all the sent data, and to
// resend the data upon a subsequent connection.
class QuicDataToResend {
public:
- // |headers| may be null, since it's possible to send data without
- // headers.
+ // |headers| may be null, since it's possible to send data without headers.
QuicDataToResend(std::unique_ptr<SpdyHeaderBlock> headers,
base::StringPiece body,
bool fin);
@@ -97,8 +87,7 @@ class QuicClientBase : public QuicClientPushPromiseIndex::Delegate,
bool Connect();
// Start the crypto handshake. This can be done in place of the synchronous
- // Connect(), but callers are responsible for making sure the crypto
- // handshake
+ // Connect(), but callers are responsible for making sure the crypto handshake
// completes.
void StartConnect();
@@ -106,8 +95,7 @@ class QuicClientBase : public QuicClientPushPromiseIndex::Delegate,
void Disconnect();
// Returns true if the crypto handshake has yet to establish encryption.
- // Returns false if encryption is active (even if the server hasn't
- // confirmed
+ // Returns false if encryption is active (even if the server hasn't confirmed
// the handshake) or if the connection has been closed.
bool EncryptionBeingEstablished();
@@ -166,12 +154,10 @@ class QuicClientBase : public QuicClientPushPromiseIndex::Delegate,
}
// UseTokenBinding enables token binding negotiation in the client. This
- // should only be called before the initial Connect(). The client will
- // still
+ // should only be called before the initial Connect(). The client will still
// need to check that token binding is negotiated with the server, and add
// token binding headers to requests if so. server, and add token binding
- // headers to requests if so. The negotiated token binding parameters can
- // be
+ // headers to requests if so. The negotiated token binding parameters can be
// found on the QuicCryptoNegotiatedParameters object in
// token_binding_key_param.
void UseTokenBinding() {
@@ -190,8 +176,7 @@ class QuicClientBase : public QuicClientPushPromiseIndex::Delegate,
QuicCryptoClientConfig* crypto_config() { return &crypto_config_; }
- // Change the initial maximum packet size of the connection. Has to be
- // called
+ // Change the initial maximum packet size of the connection. Has to be called
// before Connect()/StartConnect() in order to have any effect.
void set_initial_max_packet_length(QuicByteCount initial_max_packet_length) {
initial_max_packet_length_ = initial_max_packet_length;
@@ -209,8 +194,7 @@ class QuicClientBase : public QuicClientPushPromiseIndex::Delegate,
// instead.
int GetNumSentClientHellos();
- // Gather the stats for the last session and update the stats for the
- // overall
+ // Gather the stats for the last session and update the stats for the overall
// connection.
void UpdateStats();
@@ -271,6 +255,7 @@ class QuicClientBase : public QuicClientPushPromiseIndex::Delegate,
size_t latest_response_code() const;
const std::string& latest_response_headers() const;
+ const std::string& preliminary_response_headers() const;
const SpdyHeaderBlock& latest_response_header_block() const;
const std::string& latest_response_body() const;
const std::string& latest_response_trailers() const;
@@ -306,8 +291,7 @@ class QuicClientBase : public QuicClientPushPromiseIndex::Delegate,
// Runs one iteration of the event loop.
virtual void RunEventLoop() = 0;
- // Used during initialization: creates the UDP socket FD, sets socket
- // options,
+ // Used during initialization: creates the UDP socket FD, sets socket options,
// and binds the socket to our address.
virtual bool CreateUDPSocketAndBind(QuicSocketAddress server_address,
QuicIpAddress bind_to_address,
@@ -325,8 +309,7 @@ class QuicClientBase : public QuicClientPushPromiseIndex::Delegate,
// returned. Otherwise, the next random ID will be returned.
QuicConnectionId GetNextConnectionId();
- // Returns the next server-designated ConnectionId from the cached config
- // for
+ // Returns the next server-designated ConnectionId from the cached config for
// |server_id_|, if it exists. Otherwise, returns 0.
QuicConnectionId GetNextServerDesignatedConnectionId();
@@ -410,8 +393,7 @@ class QuicClientBase : public QuicClientPushPromiseIndex::Delegate,
// Alarm factory to be used by created connections. Must outlive |session_|.
std::unique_ptr<QuicAlarmFactory> alarm_factory_;
- // Writer used to actually send packets to the wire. Must outlive
- // |session_|.
+ // Writer used to actually send packets to the wire. Must outlive |session_|.
std::unique_ptr<QuicPacketWriter> writer_;
// Index of pending promised streams. Must outlive |session_|.
@@ -421,8 +403,7 @@ class QuicClientBase : public QuicClientPushPromiseIndex::Delegate,
std::unique_ptr<QuicClientSession> session_;
// This vector contains QUIC versions which we currently support.
- // This should be ordered such that the highest supported version is the
- // first
+ // This should be ordered such that the highest supported version is the first
// element, with subsequent elements in descending order (versions can be
// skipped as necessary). We will always pick supported_versions_[0] as the
// initial version to use.
@@ -434,10 +415,8 @@ class QuicClientBase : public QuicClientPushPromiseIndex::Delegate,
// The number of stateless rejects received during the current/latest
// connection.
- // TODO(jokulik): Consider some consistent naming scheme (or other) for
- // member
- // variables that are kept per-request, per-connection, and over the
- // client's
+ // TODO(jokulik): Consider some consistent naming scheme (or other) for member
+ // variables that are kept per-request, per-connection, and over the client's
// lifetime.
int num_stateless_rejects_received_;
@@ -448,8 +427,7 @@ class QuicClientBase : public QuicClientPushPromiseIndex::Delegate,
// opposed to that associated with the last session object).
QuicErrorCode connection_error_;
- // True when the client is attempting to connect or re-connect the session
- // (in
+ // True when the client is attempting to connect or re-connect the session (in
// the case of a stateless reject). Set to false between a call to
// Disconnect() and the subsequent call to StartConnect(). When
// connected_or_attempting_connect_ is false, the session object corresponds
@@ -462,6 +440,8 @@ class QuicClientBase : public QuicClientPushPromiseIndex::Delegate,
int latest_response_code_;
// HTTP/2 headers from most recent response.
std::string latest_response_headers_;
+ // preliminary 100 Continue HTTP/2 headers from most recent response, if any.
+ std::string preliminary_response_headers_;
// HTTP/2 headers from most recent response.
SpdyHeaderBlock latest_response_header_block_;
// Body of most recent response.
diff --git a/chromium/net/tools/quic/quic_client_bin.cc b/chromium/net/tools/quic/quic_client_bin.cc
index c221a55a145..07d13e1952a 100644
--- a/chromium/net/tools/quic/quic_client_bin.cc
+++ b/chromium/net/tools/quic/quic_client_bin.cc
@@ -46,6 +46,8 @@
#include "net/base/net_errors.h"
#include "net/base/privacy_mode.h"
#include "net/cert/cert_verifier.h"
+#include "net/cert/ct_known_logs.h"
+#include "net/cert/ct_log_verifier.h"
#include "net/cert/multi_log_ct_verifier.h"
#include "net/http/transport_security_state.h"
#include "net/quic/chromium/crypto/proof_verifier_chromium.h"
@@ -55,11 +57,11 @@
#include "net/quic/platform/api/quic_socket_address.h"
#include "net/quic/platform/api/quic_str_cat.h"
#include "net/quic/platform/api/quic_text_utils.h"
+#include "net/quic/platform/api/quic_url.h"
#include "net/spdy/spdy_header_block.h"
#include "net/tools/epoll_server/epoll_server.h"
#include "net/tools/quic/quic_client.h"
#include "net/tools/quic/synchronous_host_resolver.h"
-#include "url/gurl.h"
using base::StringPiece;
using net::CertVerifier;
@@ -69,6 +71,7 @@ using net::MultiLogCTVerifier;
using net::ProofVerifier;
using net::ProofVerifierChromium;
using net::QuicTextUtils;
+using net::QuicUrl;
using net::SpdyHeaderBlock;
using net::TransportSecurityState;
using std::cout;
@@ -104,28 +107,28 @@ int32_t FLAGS_initial_mtu = 0;
class FakeProofVerifier : public ProofVerifier {
public:
net::QuicAsyncStatus VerifyProof(
- const string& hostname,
- const uint16_t port,
- const string& server_config,
- net::QuicVersion quic_version,
- StringPiece chlo_hash,
- const std::vector<string>& certs,
- const string& cert_sct,
- const string& signature,
- const net::ProofVerifyContext* context,
- string* error_details,
- std::unique_ptr<net::ProofVerifyDetails>* details,
- std::unique_ptr<net::ProofVerifierCallback> callback) override {
+ const string& /*hostname*/,
+ const uint16_t /*port*/,
+ const string& /*server_config*/,
+ net::QuicVersion /*quic_version*/,
+ StringPiece /*chlo_hash*/,
+ const std::vector<string>& /*certs*/,
+ const string& /*cert_sct*/,
+ const string& /*signature*/,
+ const net::ProofVerifyContext* /*context*/,
+ string* /*error_details*/,
+ std::unique_ptr<net::ProofVerifyDetails>* /*details*/,
+ std::unique_ptr<net::ProofVerifierCallback> /*callback*/) override {
return net::QUIC_SUCCESS;
}
net::QuicAsyncStatus VerifyCertChain(
- const std::string& hostname,
- const std::vector<std::string>& certs,
- const net::ProofVerifyContext* verify_context,
- std::string* error_details,
- std::unique_ptr<net::ProofVerifyDetails>* verify_details,
- std::unique_ptr<net::ProofVerifierCallback> callback) override {
+ const std::string& /*hostname*/,
+ const std::vector<std::string>& /*certs*/,
+ const net::ProofVerifyContext* /*verify_context*/,
+ std::string* /*error_details*/,
+ std::unique_ptr<net::ProofVerifyDetails>* /*verify_details*/,
+ std::unique_ptr<net::ProofVerifierCallback> /*callback*/) override {
return net::QUIC_SUCCESS;
}
};
@@ -221,14 +224,14 @@ int main(int argc, char* argv[]) {
// Determine IP address to connect to from supplied hostname.
net::QuicIpAddress ip_addr;
- GURL url(urls[0]);
+ QuicUrl url(urls[0], "https");
string host = FLAGS_host;
if (host.empty()) {
host = url.host();
}
int port = FLAGS_port;
if (port == 0) {
- port = url.EffectiveIntPort();
+ port = url.port();
}
if (!ip_addr.FromString(host)) {
net::AddressList addresses;
@@ -247,7 +250,7 @@ int main(int argc, char* argv[]) {
// Build the client, and try to connect.
net::EpollServer epoll_server;
- net::QuicServerId server_id(url.host(), url.EffectiveIntPort(),
+ net::QuicServerId server_id(url.host(), url.port(),
net::PRIVACY_MODE_DISABLED);
net::QuicVersionVector versions = net::AllSupportedVersions();
if (FLAGS_quic_version != -1) {
@@ -258,7 +261,8 @@ int main(int argc, char* argv[]) {
std::unique_ptr<CertVerifier> cert_verifier(CertVerifier::CreateDefault());
std::unique_ptr<TransportSecurityState> transport_security_state(
new TransportSecurityState);
- std::unique_ptr<CTVerifier> ct_verifier(new MultiLogCTVerifier());
+ std::unique_ptr<MultiLogCTVerifier> ct_verifier(new MultiLogCTVerifier());
+ ct_verifier->AddLogs(net::ct::CreateLogVerifiersForKnownLogs());
std::unique_ptr<CTPolicyEnforcer> ct_policy_enforcer(new CTPolicyEnforcer());
std::unique_ptr<ProofVerifier> proof_verifier;
if (line->HasSwitch("disable-certificate-verification")) {
@@ -301,8 +305,8 @@ int main(int argc, char* argv[]) {
SpdyHeaderBlock header_block;
header_block[":method"] = body.empty() ? "GET" : "POST";
header_block[":scheme"] = url.scheme();
- header_block[":authority"] = url.host();
- header_block[":path"] = url.path();
+ header_block[":authority"] = url.HostPort();
+ header_block[":path"] = url.PathParamsQuery();
// Append any additional headers supplied on the command line.
for (StringPiece sp : QuicTextUtils::Split(FLAGS_headers, ';')) {
@@ -335,6 +339,13 @@ int main(int argc, char* argv[]) {
cout << "body: " << body << endl;
}
cout << endl;
+
+ if (!client.preliminary_response_headers().empty()) {
+ cout << "Preliminary response headers: "
+ << client.preliminary_response_headers() << endl;
+ cout << endl;
+ }
+
cout << "Response:" << endl;
cout << "headers: " << client.latest_response_headers() << endl;
string response_body = client.latest_response_body();
diff --git a/chromium/net/tools/quic/quic_client_session_test.cc b/chromium/net/tools/quic/quic_client_session_test.cc
index 25eaa193853..b0cbb521b99 100644
--- a/chromium/net/tools/quic/quic_client_session_test.cc
+++ b/chromium/net/tools/quic/quic_client_session_test.cc
@@ -6,12 +6,12 @@
#include <vector>
-#include "base/strings/stringprintf.h"
#include "net/quic/core/crypto/aes_128_gcm_12_encrypter.h"
#include "net/quic/core/quic_flags.h"
#include "net/quic/core/spdy_utils.h"
#include "net/quic/platform/api/quic_ptr_util.h"
#include "net/quic/platform/api/quic_socket_address.h"
+#include "net/quic/platform/api/quic_str_cat.h"
#include "net/quic/test_tools/crypto_test_utils.h"
#include "net/quic/test_tools/mock_quic_spdy_client_stream.h"
#include "net/quic/test_tools/quic_config_peer.h"
@@ -23,7 +23,6 @@
#include "testing/gtest/include/gtest/gtest.h"
using google::protobuf::implicit_cast;
-using base::StringPrintf;
using std::string;
using testing::AnyNumber;
using testing::Invoke;
@@ -66,7 +65,7 @@ class TestQuicClientSession : public QuicClientSession {
class QuicClientSessionTest : public ::testing::TestWithParam<QuicVersion> {
protected:
QuicClientSessionTest()
- : crypto_config_(CryptoTestUtils::ProofVerifierForTesting()),
+ : crypto_config_(crypto_test_utils::ProofVerifierForTesting()),
promised_stream_id_(kServerDataStreamId1),
associated_stream_id_(kClientDataStreamId1) {
Initialize();
@@ -105,11 +104,11 @@ class QuicClientSessionTest : public ::testing::TestWithParam<QuicVersion> {
session_->CryptoConnect();
QuicCryptoClientStream* stream =
static_cast<QuicCryptoClientStream*>(session_->GetCryptoStream());
- CryptoTestUtils::FakeServerOptions options;
+ crypto_test_utils::FakeServerOptions options;
QuicConfig config = DefaultQuicConfig();
config.SetMaxIncomingDynamicStreamsToSend(server_max_incoming_streams);
- CryptoTestUtils::HandshakeWithFakeServer(&config, &helper_, &alarm_factory_,
- connection_, stream, options);
+ crypto_test_utils::HandshakeWithFakeServer(
+ &config, &helper_, &alarm_factory_, connection_, stream, options);
}
QuicCryptoClientConfig crypto_config_;
@@ -152,7 +151,7 @@ TEST_P(QuicClientSessionTest, NoEncryptionAfterInitialEncryption) {
// an inchoate CHLO to be sent and will leave the encryption level
// at NONE.
CryptoHandshakeMessage rej;
- CryptoTestUtils::FillInDummyReject(&rej, /* stateless */ false);
+ crypto_test_utils::FillInDummyReject(&rej, /* stateless */ false);
EXPECT_TRUE(session_->IsEncryptionEstablished());
session_->GetCryptoStream()->OnHandshakeMessage(rej);
EXPECT_FALSE(session_->IsEncryptionEstablished());
@@ -294,7 +293,7 @@ TEST_P(QuicClientSessionTest, InvalidFramedPacketReceived) {
QuicConnectionId connection_id = session_->connection()->connection_id();
QuicVersionVector versions = {GetParam()};
std::unique_ptr<QuicEncryptedPacket> packet(ConstructMisFramedEncryptedPacket(
- connection_id, false, false, false, kDefaultPathId, 100, "data",
+ connection_id, false, false, kDefaultPathId, 100, "data",
PACKET_8BYTE_CONNECTION_ID, PACKET_6BYTE_PACKET_NUMBER, &versions,
Perspective::IS_SERVER));
std::unique_ptr<QuicReceivedPacket> received(
@@ -407,7 +406,7 @@ TEST_P(QuicClientSessionTest, PushPromiseDuplicateUrl) {
TEST_P(QuicClientSessionTest, ReceivingPromiseEnhanceYourCalm) {
for (size_t i = 0u; i < session_->get_max_promises(); i++) {
- push_promise_[":path"] = StringPrintf("/bar%zu", i);
+ push_promise_[":path"] = QuicStringPrintf("/bar%zu", i);
QuicStreamId id = promised_stream_id_ + i * 2;
@@ -421,7 +420,7 @@ TEST_P(QuicClientSessionTest, ReceivingPromiseEnhanceYourCalm) {
// One more promise, this should be refused.
int i = session_->get_max_promises();
- push_promise_[":path"] = StringPrintf("/bar%d", i);
+ push_promise_[":path"] = QuicStringPrintf("/bar%d", i);
QuicStreamId id = promised_stream_id_ + i * 2;
EXPECT_CALL(*connection_, SendRstStream(id, QUIC_REFUSED_STREAM, 0));
diff --git a/chromium/net/tools/quic/quic_client_test.cc b/chromium/net/tools/quic/quic_client_test.cc
index 1037aedc62f..8f3ff967fef 100644
--- a/chromium/net/tools/quic/quic_client_test.cc
+++ b/chromium/net/tools/quic/quic_client_test.cc
@@ -55,21 +55,18 @@ QuicClient* CreateAndInitializeQuicClient(EpollServer* eps, uint16_t port) {
QuicVersionVector versions = AllSupportedVersions();
QuicClient* client =
new QuicClient(server_address, server_id, versions, eps,
- CryptoTestUtils::ProofVerifierForTesting());
+ crypto_test_utils::ProofVerifierForTesting());
EXPECT_TRUE(client->Initialize());
return client;
}
-TEST(QuicClientTest, DoNotLeakFDs) {
+TEST(QuicClientTest, DoNotLeakSocketFDs) {
// Make sure that the QuicClient doesn't leak socket FDs. Doing so could cause
// port exhaustion in long running processes which repeatedly create clients.
// Create a ProofVerifier before counting the number of open FDs to work
// around some ASAN weirdness.
- CryptoTestUtils::ProofVerifierForTesting().reset();
-
- // Make sure that the QuicClient doesn't leak FDs. Doing so could cause port
- // exhaustion in long running processes which repeatedly create clients.
+ crypto_test_utils::ProofVerifierForTesting().reset();
// Record initial number of FDs, after creation of EpollServer.
EpollServer eps;
@@ -93,7 +90,7 @@ TEST(QuicClientTest, DoNotLeakFDs) {
TEST(QuicClientTest, CreateAndCleanUpUDPSockets) {
// Create a ProofVerifier before counting the number of open FDs to work
// around some ASAN weirdness.
- CryptoTestUtils::ProofVerifierForTesting().reset();
+ crypto_test_utils::ProofVerifierForTesting().reset();
EpollServer eps;
size_t number_of_open_fds = NumOpenSocketFDs();
diff --git a/chromium/net/tools/quic/quic_dispatcher.cc b/chromium/net/tools/quic/quic_dispatcher.cc
index 18f79ac373d..c99ea930dc8 100644
--- a/chromium/net/tools/quic/quic_dispatcher.cc
+++ b/chromium/net/tools/quic/quic_dispatcher.cc
@@ -6,7 +6,6 @@
#include <utility>
-#include "base/debug/stack_trace.h"
#include "base/macros.h"
#include "net/quic/core/crypto/quic_random.h"
#include "net/quic/core/quic_flags.h"
@@ -14,6 +13,7 @@
#include "net/quic/platform/api/quic_bug_tracker.h"
#include "net/quic/platform/api/quic_logging.h"
#include "net/quic/platform/api/quic_ptr_util.h"
+#include "net/quic/platform/api/quic_stack_trace.h"
#include "net/tools/quic/chlo_extractor.h"
#include "net/tools/quic/quic_per_connection_packet_writer.h"
#include "net/tools/quic/quic_simple_server_session.h"
@@ -276,9 +276,8 @@ bool QuicDispatcher::OnUnauthenticatedPublicHeader(
}
// Check if we are buffering packets for this connection ID
- if (FLAGS_quic_reloadable_flag_enable_async_get_proof &&
- (temporarily_buffered_connections_.find(connection_id) !=
- temporarily_buffered_connections_.end())) {
+ if (temporarily_buffered_connections_.find(connection_id) !=
+ temporarily_buffered_connections_.end()) {
// This packet was received while the a CHLO for the same connection ID was
// being processed. Buffer it.
BufferEarlyPacket(connection_id);
@@ -308,8 +307,7 @@ bool QuicDispatcher::OnUnauthenticatedPublicHeader(
QuicVersion version = GetSupportedVersions().front();
if (header.version_flag) {
QuicVersion packet_version = header.versions.front();
- if (FLAGS_quic_reloadable_flag_quic_fix_version_manager &&
- framer_.supported_versions() != GetSupportedVersions()) {
+ if (framer_.supported_versions() != GetSupportedVersions()) {
// Reset framer's version if version flags change in flight.
framer_.SetSupportedVersions(GetSupportedVersions());
}
@@ -386,14 +384,11 @@ void QuicDispatcher::ProcessUnauthenticatedHeaderFate(
current_server_address_, current_client_address_, connection_id,
packet_number, *current_packet_);
- if (FLAGS_quic_reloadable_flag_enable_async_get_proof) {
- // Any packets which were buffered while the stateless rejector logic
- // was running should be discarded. Do not inform the time wait list
- // manager, which should already have a made a decision about sending a
- // reject based on the CHLO alone.
- buffered_packets_.DiscardPackets(connection_id);
- }
-
+ // Any packets which were buffered while the stateless rejector logic was
+ // running should be discarded. Do not inform the time wait list manager,
+ // which should already have a made a decision about sending a reject
+ // based on the CHLO alone.
+ buffered_packets_.DiscardPackets(connection_id);
break;
case kFateBuffer:
// This packet is a non-CHLO packet which has arrived before the
@@ -497,11 +492,11 @@ void QuicDispatcher::OnConnectionClosed(QuicConnectionId connection_id,
QUIC_BUG << "ConnectionId " << connection_id
<< " does not exist in the session map. Error: "
<< QuicErrorCodeToString(error);
- QUIC_BUG << base::debug::StackTrace().ToString();
+ QUIC_BUG << QuicStackTrace();
return;
}
- DVLOG_IF(1, error != QUIC_NO_ERROR)
+ QUIC_DLOG_IF(INFO, error != QUIC_NO_ERROR)
<< "Closing connection (" << connection_id
<< ") due to error: " << QuicErrorCodeToString(error)
<< ", with details: " << error_details;
@@ -888,13 +883,11 @@ void QuicDispatcher::MaybeRejectStatelessly(QuicConnectionId connection_id,
}
// Insert into set of connection IDs to buffer
- if (FLAGS_quic_reloadable_flag_enable_async_get_proof) {
- const bool ok =
- temporarily_buffered_connections_.insert(connection_id).second;
- QUIC_BUG_IF(!ok)
- << "Processing multiple stateless rejections for connection ID "
- << connection_id;
- }
+ const bool ok =
+ temporarily_buffered_connections_.insert(connection_id).second;
+ QUIC_BUG_IF(!ok)
+ << "Processing multiple stateless rejections for connection ID "
+ << connection_id;
// Continue stateless rejector processing
std::unique_ptr<StatelessRejectorProcessDoneCallback> cb(
@@ -910,23 +903,21 @@ void QuicDispatcher::OnStatelessRejectorProcessDone(
std::unique_ptr<QuicReceivedPacket> current_packet,
QuicPacketNumber packet_number,
QuicVersion first_version) {
- if (FLAGS_quic_reloadable_flag_enable_async_get_proof) {
- // Stop buffering packets on this connection
- const auto num_erased =
- temporarily_buffered_connections_.erase(rejector->connection_id());
- QUIC_BUG_IF(num_erased != 1) << "Completing stateless rejection logic for "
- "non-buffered connection ID "
- << rejector->connection_id();
-
- // If this connection has gone into time-wait during the async processing,
- // don't proceed.
- if (time_wait_list_manager_->IsConnectionIdInTimeWait(
- rejector->connection_id())) {
- time_wait_list_manager_->ProcessPacket(
- current_server_address, current_client_address,
- rejector->connection_id(), packet_number, *current_packet);
- return;
- }
+ // Stop buffering packets on this connection
+ const auto num_erased =
+ temporarily_buffered_connections_.erase(rejector->connection_id());
+ QUIC_BUG_IF(num_erased != 1) << "Completing stateless rejection logic for "
+ "non-buffered connection ID "
+ << rejector->connection_id();
+
+ // If this connection has gone into time-wait during the async processing,
+ // don't proceed.
+ if (time_wait_list_manager_->IsConnectionIdInTimeWait(
+ rejector->connection_id())) {
+ time_wait_list_manager_->ProcessPacket(
+ current_server_address, current_client_address,
+ rejector->connection_id(), packet_number, *current_packet);
+ return;
}
// Reset current_* to correspond to the packet which initiated the stateless
diff --git a/chromium/net/tools/quic/quic_dispatcher.h b/chromium/net/tools/quic/quic_dispatcher.h
index 527eaa5bc10..266e3e458b7 100644
--- a/chromium/net/tools/quic/quic_dispatcher.h
+++ b/chromium/net/tools/quic/quic_dispatcher.h
@@ -13,7 +13,6 @@
#include <vector>
#include "base/macros.h"
-#include "net/base/linked_hash_map.h"
#include "net/quic/core/crypto/quic_compressed_certs_cache.h"
#include "net/quic/core/crypto/quic_random.h"
#include "net/quic/core/quic_blocked_writer_interface.h"
@@ -23,6 +22,7 @@
#include "net/quic/core/quic_packets.h"
#include "net/quic/core/quic_session.h"
#include "net/quic/core/quic_version_manager.h"
+#include "net/quic/platform/api/quic_containers.h"
#include "net/quic/platform/api/quic_socket_address.h"
#include "net/tools/quic/quic_process_packet_interface.h"
@@ -44,10 +44,7 @@ class QuicDispatcher : public QuicTimeWaitListManager::Visitor,
public QuicBufferedPacketStore::VisitorInterface {
public:
// Ideally we'd have a linked_hash_set: the boolean is unused.
- typedef linked_hash_map<QuicBlockedWriterInterface*,
- bool,
- QuicBlockedWriterInterfacePtrHash>
- WriteBlockedList;
+ typedef QuicLinkedHashMap<QuicBlockedWriterInterface*, bool> WriteBlockedList;
QuicDispatcher(const QuicConfig& config,
const QuicCryptoServerConfig* crypto_config,
diff --git a/chromium/net/tools/quic/quic_dispatcher_test.cc b/chromium/net/tools/quic/quic_dispatcher_test.cc
index e2d7c1b0016..84705754ec1 100644
--- a/chromium/net/tools/quic/quic_dispatcher_test.cc
+++ b/chromium/net/tools/quic/quic_dispatcher_test.cc
@@ -166,7 +166,7 @@ class MockServerConnection : public MockQuicConnection {
class QuicDispatcherTest : public ::testing::Test {
public:
QuicDispatcherTest()
- : QuicDispatcherTest(CryptoTestUtils::ProofSourceForTesting()) {}
+ : QuicDispatcherTest(crypto_test_utils::ProofSourceForTesting()) {}
explicit QuicDispatcherTest(std::unique_ptr<ProofSource> proof_source)
: helper_(&eps_, QuicAllocator::BUFFER_POOL),
@@ -533,12 +533,12 @@ TEST_F(QuicDispatcherTest, TooBigSeqNoPacketToTimeWaitListManager) {
}
TEST_F(QuicDispatcherTest, SupportedVersionsChangeInFlight) {
- static_assert(arraysize(kSupportedQuicVersions) == 4u,
+ static_assert(arraysize(kSupportedQuicVersions) == 5u,
"Supported versions out of sync");
- FLAGS_quic_reloadable_flag_quic_fix_version_manager = true;
FLAGS_quic_reloadable_flag_quic_disable_version_34 = false;
FLAGS_quic_reloadable_flag_quic_enable_version_36_v3 = true;
FLAGS_quic_reloadable_flag_quic_enable_version_37 = true;
+ FLAGS_quic_enable_version_38 = true;
QuicSocketAddress client_address(QuicIpAddress::Loopback4(), 1);
server_address_ = QuicSocketAddress(QuicIpAddress::Any4(), 5);
QuicConnectionId connection_id = 1;
@@ -818,17 +818,13 @@ TEST_P(QuicDispatcherStatelessRejectTest, CheapRejects) {
QUIC_LOG(INFO) << "ExpectStatelessReject: " << ExpectStatelessReject();
QUIC_LOG(INFO) << "Params: " << GetParam();
// Process the first packet for the connection.
- // clang-format off
- CryptoHandshakeMessage client_hello = CryptoTestUtils::Message(
- "CHLO",
- "AEAD", "AESG",
- "KEXS", "C255",
- "COPT", "SREJ",
- "NONC", "1234567890123456789012",
- "VER\0", "Q025",
- "$padding", static_cast<int>(kClientHelloMinimumSize),
- nullptr);
- // clang-format on
+ CryptoHandshakeMessage client_hello =
+ crypto_test_utils::CreateCHLO({{"AEAD", "AESG"},
+ {"KEXS", "C255"},
+ {"COPT", "SREJ"},
+ {"NONC", "1234567890123456789012"},
+ {"VER\0", "Q025"}},
+ kClientHelloMinimumSize);
ProcessPacket(client_address, connection_id, true, false,
client_hello.GetSerialized().AsStringPiece().as_string());
@@ -850,16 +846,12 @@ TEST_P(QuicDispatcherStatelessRejectTest, BufferNonChlo) {
"NOT DATA FOR A CHLO");
// Process the first packet for the connection.
- // clang-format off
- CryptoHandshakeMessage client_hello = CryptoTestUtils::Message(
- "CHLO",
- "AEAD", "AESG",
- "KEXS", "C255",
- "NONC", "1234567890123456789012",
- "VER\0", "Q025",
- "$padding", static_cast<int>(kClientHelloMinimumSize),
- nullptr);
- // clang-format on
+ CryptoHandshakeMessage client_hello =
+ crypto_test_utils::CreateCHLO({{"AEAD", "AESG"},
+ {"KEXS", "C255"},
+ {"NONC", "1234567890123456789012"},
+ {"VER\0", "Q025"}},
+ kClientHelloMinimumSize);
// If stateless rejects are enabled then a connection will be created now
// and the buffered packet will be processed
@@ -1169,11 +1161,12 @@ class BufferedPacketStoreTest
clock_ = QuicDispatcherPeer::GetHelper(dispatcher_.get())->GetClock();
QuicVersion version = AllSupportedVersions().front();
- CryptoHandshakeMessage chlo = CryptoTestUtils::GenerateDefaultInchoateCHLO(
- clock_, version, &crypto_config_);
+ CryptoHandshakeMessage chlo =
+ crypto_test_utils::GenerateDefaultInchoateCHLO(clock_, version,
+ &crypto_config_);
chlo.SetVector(net::kCOPT, net::QuicTagVector{net::kSREJ});
// Pass an inchoate CHLO.
- CryptoTestUtils::GenerateFullCHLO(
+ crypto_test_utils::GenerateFullCHLO(
chlo, &crypto_config_, server_addr_, client_addr_, version, clock_,
signed_config_, QuicDispatcherPeer::GetCache(dispatcher_.get()),
&full_chlo_);
@@ -1609,7 +1602,6 @@ class AsyncGetProofTest : public QuicDispatcherTest {
client_addr_(QuicIpAddress::Loopback4(), 1234),
crypto_config_peer_(&crypto_config_),
signed_config_(new QuicSignedServerConfig) {
- FLAGS_quic_reloadable_flag_enable_async_get_proof = true;
FLAGS_quic_reloadable_flag_enable_quic_stateless_reject_support = true;
FLAGS_quic_reloadable_flag_quic_use_cheap_stateless_rejects = true;
FLAGS_quic_reloadable_flag_quic_create_session_after_insertion = true;
@@ -1620,11 +1612,11 @@ class AsyncGetProofTest : public QuicDispatcherTest {
clock_ = QuicDispatcherPeer::GetHelper(dispatcher_.get())->GetClock();
QuicVersion version = AllSupportedVersions().front();
- chlo_ = CryptoTestUtils::GenerateDefaultInchoateCHLO(clock_, version,
- &crypto_config_);
+ chlo_ = crypto_test_utils::GenerateDefaultInchoateCHLO(clock_, version,
+ &crypto_config_);
chlo_.SetVector(net::kCOPT, net::QuicTagVector{net::kSREJ});
// Pass an inchoate CHLO.
- CryptoTestUtils::GenerateFullCHLO(
+ crypto_test_utils::GenerateFullCHLO(
chlo_, &crypto_config_, server_addr_, client_addr_, version, clock_,
signed_config_, QuicDispatcherPeer::GetCache(dispatcher_.get()),
&full_chlo_);
diff --git a/chromium/net/tools/quic/quic_epoll_connection_helper.cc b/chromium/net/tools/quic/quic_epoll_connection_helper.cc
index 2e687163e47..6629a2937e2 100644
--- a/chromium/net/tools/quic/quic_epoll_connection_helper.cc
+++ b/chromium/net/tools/quic/quic_epoll_connection_helper.cc
@@ -7,7 +7,6 @@
#include <errno.h>
#include <sys/socket.h>
-#include "base/stl_util.h"
#include "net/quic/core/crypto/quic_random.h"
#include "net/tools/epoll_server/epoll_server.h"
#include "net/tools/quic/platform/impl/quic_socket_utils.h"
diff --git a/chromium/net/tools/quic/quic_http_response_cache.cc b/chromium/net/tools/quic/quic_http_response_cache.cc
index 65ff6390e92..68c57defa65 100644
--- a/chromium/net/tools/quic/quic_http_response_cache.cc
+++ b/chromium/net/tools/quic/quic_http_response_cache.cc
@@ -8,10 +8,10 @@
#include "base/files/file_enumerator.h"
#include "base/files/file_util.h"
-#include "base/stl_util.h"
#include "net/http/http_util.h"
#include "net/quic/platform/api/quic_bug_tracker.h"
#include "net/quic/platform/api/quic_logging.h"
+#include "net/quic/platform/api/quic_map_util.h"
#include "net/quic/platform/api/quic_ptr_util.h"
#include "net/quic/platform/api/quic_text_utils.h"
#include "net/spdy/spdy_http_utils.h"
@@ -23,11 +23,10 @@ using std::string;
namespace net {
-QuicHttpResponseCache::ServerPushInfo::ServerPushInfo(
- GURL request_url,
- SpdyHeaderBlock headers,
- net::SpdyPriority priority,
- string body)
+QuicHttpResponseCache::ServerPushInfo::ServerPushInfo(QuicUrl request_url,
+ SpdyHeaderBlock headers,
+ SpdyPriority priority,
+ string body)
: request_url(request_url),
headers(std::move(headers)),
priority(priority),
@@ -45,6 +44,12 @@ QuicHttpResponseCache::Response::Response()
QuicHttpResponseCache::Response::~Response() {}
+QuicHttpResponseCache::ResourceFile::ResourceFile(
+ const base::FilePath& file_name)
+ : file_name_(file_name), file_name_string_(file_name.AsUTF8Unsafe()) {}
+
+QuicHttpResponseCache::ResourceFile::~ResourceFile() {}
+
void QuicHttpResponseCache::ResourceFile::Read() {
base::ReadFileToString(FilePath(file_name_), &file_contents_);
@@ -123,12 +128,6 @@ void QuicHttpResponseCache::ResourceFile::Read() {
StringPiece(file_contents_.data() + start, file_contents_.size() - start);
}
-QuicHttpResponseCache::ResourceFile::ResourceFile(
- const base::FilePath& file_name)
- : file_name_(file_name), file_name_string_(file_name.AsUTF8Unsafe()) {}
-
-QuicHttpResponseCache::ResourceFile::~ResourceFile() {}
-
void QuicHttpResponseCache::ResourceFile::SetHostPathFromBase(
StringPiece base) {
size_t path_start = base.find_first_of('/');
@@ -270,14 +269,14 @@ void QuicHttpResponseCache::InitializeFromDirectory(
for (const auto& resource_file : resource_files) {
std::list<ServerPushInfo> push_resources;
for (const auto& push_url : resource_file->push_urls()) {
- GURL url(push_url);
+ QuicUrl url(push_url);
const Response* response = GetResponse(url.host(), url.path());
if (!response) {
QUIC_BUG << "Push URL '" << push_url << "' not found.";
return;
}
push_resources.push_back(ServerPushInfo(url, response->headers().Clone(),
- net::kV3LowestPriority,
+ kV3LowestPriority,
response->body().as_string()));
}
MaybeAddServerPushResources(resource_file->host(), resource_file->path(),
@@ -316,11 +315,11 @@ void QuicHttpResponseCache::AddResponseImpl(StringPiece host,
DCHECK(!host.empty()) << "Host must be populated, e.g. \"www.google.com\"";
string key = GetKey(host, path);
- if (base::ContainsKey(responses_, key)) {
+ if (QuicContainsKey(responses_, key)) {
QUIC_BUG << "Response for '" << key << "' already exists!";
return;
}
- std::unique_ptr<Response> new_response = QuicMakeUnique<Response>();
+ auto new_response = QuicMakeUnique<Response>();
new_response->set_response_type(response_type);
new_response->set_headers(std::move(response_headers));
new_response->set_body(response_body);
@@ -345,7 +344,8 @@ void QuicHttpResponseCache::MaybeAddServerPushResources(
}
QUIC_DVLOG(1) << "Add request-resource association: request url "
- << request_url << " push url " << push_resource.request_url
+ << request_url << " push url "
+ << push_resource.request_url.ToString()
<< " response headers "
<< push_resource.headers.DebugString();
{
@@ -360,8 +360,7 @@ void QuicHttpResponseCache::MaybeAddServerPushResources(
bool found_existing_response = false;
{
QuicWriterMutexLock lock(&response_mutex_);
- found_existing_response =
- base::ContainsKey(responses_, GetKey(host, path));
+ found_existing_response = QuicContainsKey(responses_, GetKey(host, path));
}
if (!found_existing_response) {
// Add a server push response to responses map, if it is not in the map.
@@ -381,7 +380,8 @@ bool QuicHttpResponseCache::PushResourceExistsInCache(
server_push_resources_.equal_range(original_request_url);
for (auto it = resource_range.first; it != resource_range.second; ++it) {
ServerPushInfo push_resource = it->second;
- if (push_resource.request_url.spec() == resource.request_url.spec()) {
+ if (push_resource.request_url.ToString() ==
+ resource.request_url.ToString()) {
return true;
}
}
diff --git a/chromium/net/tools/quic/quic_http_response_cache.h b/chromium/net/tools/quic/quic_http_response_cache.h
index ad274bf05f7..695987ce0bc 100644
--- a/chromium/net/tools/quic/quic_http_response_cache.h
+++ b/chromium/net/tools/quic/quic_http_response_cache.h
@@ -15,11 +15,10 @@
#include "base/files/file_path.h"
#include "base/macros.h"
#include "base/strings/string_piece.h"
-#include "net/http/http_response_headers.h"
#include "net/quic/core/spdy_utils.h"
#include "net/quic/platform/api/quic_mutex.h"
+#include "net/quic/platform/api/quic_url.h"
#include "net/spdy/spdy_framer.h"
-#include "url/gurl.h"
namespace net {
@@ -31,12 +30,12 @@ class QuicHttpResponseCache {
// A ServerPushInfo contains path of the push request and everything needed in
// comprising a response for the push request.
struct ServerPushInfo {
- ServerPushInfo(GURL request_url,
+ ServerPushInfo(QuicUrl request_url,
SpdyHeaderBlock headers,
SpdyPriority priority,
std::string body);
ServerPushInfo(const ServerPushInfo& other);
- GURL request_url;
+ QuicUrl request_url;
SpdyHeaderBlock headers;
SpdyPriority priority;
std::string body;
@@ -88,8 +87,11 @@ class QuicHttpResponseCache {
void Read();
+ // |base| is |file_name_| with |cache_directory| prefix stripped.
void SetHostPathFromBase(base::StringPiece base);
+ const std::string& file_name() { return file_name_string_; }
+
base::StringPiece host() { return host_; }
void set_host(base::StringPiece host) { host_ = host; }
@@ -102,8 +104,6 @@ class QuicHttpResponseCache {
const std::vector<base::StringPiece>& push_urls() { return push_urls_; }
- const std::string& file_name() { return file_name_string_; }
-
protected:
void HandleXOriginalUrl();
void HandlePushUrls(const std::vector<base::StringPiece>& push_urls);
diff --git a/chromium/net/tools/quic/quic_http_response_cache_test.cc b/chromium/net/tools/quic/quic_http_response_cache_test.cc
index fa2fce6da94..fbd8175f2c0 100644
--- a/chromium/net/tools/quic/quic_http_response_cache_test.cc
+++ b/chromium/net/tools/quic/quic_http_response_cache_test.cc
@@ -2,21 +2,16 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include <string>
+#include "net/tools/quic/quic_http_response_cache.h"
#include "base/files/file_path.h"
-#include "base/memory/singleton.h"
#include "base/path_service.h"
-#include "base/stl_util.h"
+#include "net/quic/platform/api/quic_map_util.h"
#include "net/quic/platform/api/quic_str_cat.h"
#include "net/quic/platform/api/quic_text_utils.h"
-#include "net/spdy/spdy_framer.h"
-#include "net/tools/quic/quic_http_response_cache.h"
#include "testing/gtest/include/gtest/gtest.h"
-using base::ContainsKey;
using base::StringPiece;
-using net::SpdyHeaderBlock;
using std::string;
namespace net {
@@ -63,7 +58,7 @@ TEST_F(QuicHttpResponseCacheTest, AddSimpleResponseGetResponse) {
const QuicHttpResponseCache::Response* response =
cache_.GetResponse("www.google.com", "/");
ASSERT_TRUE(response);
- ASSERT_TRUE(ContainsKey(response->headers(), ":status"));
+ ASSERT_TRUE(QuicContainsKey(response->headers(), ":status"));
EXPECT_EQ("200", response->headers().find(":status")->second);
EXPECT_EQ(response_body.size(), response->body().length());
}
@@ -97,38 +92,38 @@ TEST_F(QuicHttpResponseCacheTest, AddResponse) {
TEST_F(QuicHttpResponseCacheTest, ReadsCacheDir) {
cache_.InitializeFromDirectory(CacheDirectory());
const QuicHttpResponseCache::Response* response =
- cache_.GetResponse("www.example.com", "/index.html");
+ cache_.GetResponse("test.example.com", "/index.html");
ASSERT_TRUE(response);
- ASSERT_TRUE(ContainsKey(response->headers(), ":status"));
+ ASSERT_TRUE(QuicContainsKey(response->headers(), ":status"));
EXPECT_EQ("200", response->headers().find(":status")->second);
// Connection headers are not valid in HTTP/2.
- EXPECT_FALSE(ContainsKey(response->headers(), "connection"));
+ EXPECT_FALSE(QuicContainsKey(response->headers(), "connection"));
EXPECT_LT(0U, response->body().length());
}
TEST_F(QuicHttpResponseCacheTest, ReadsCacheDirWithServerPushResource) {
cache_.InitializeFromDirectory(CacheDirectory() + "_with_push");
std::list<ServerPushInfo> resources =
- cache_.GetServerPushResources("www.example.com/");
+ cache_.GetServerPushResources("test.example.com/");
ASSERT_EQ(1UL, resources.size());
}
TEST_F(QuicHttpResponseCacheTest, ReadsCacheDirWithServerPushResources) {
cache_.InitializeFromDirectory(CacheDirectory() + "_with_push");
std::list<ServerPushInfo> resources =
- cache_.GetServerPushResources("www.example.com/index2.html");
+ cache_.GetServerPushResources("test.example.com/index2.html");
ASSERT_EQ(2UL, resources.size());
}
TEST_F(QuicHttpResponseCacheTest, UsesOriginalUrl) {
cache_.InitializeFromDirectory(CacheDirectory());
const QuicHttpResponseCache::Response* response =
- cache_.GetResponse("www.example.com", "/site_map.html");
+ cache_.GetResponse("test.example.com", "/site_map.html");
ASSERT_TRUE(response);
- ASSERT_TRUE(ContainsKey(response->headers(), ":status"));
+ ASSERT_TRUE(QuicContainsKey(response->headers(), ":status"));
EXPECT_EQ("200", response->headers().find(":status")->second);
// Connection headers are not valid in HTTP/2.
- EXPECT_FALSE(ContainsKey(response->headers(), "connection"));
+ EXPECT_FALSE(QuicContainsKey(response->headers(), "connection"));
EXPECT_LT(0U, response->body().length());
}
@@ -151,20 +146,20 @@ TEST_F(QuicHttpResponseCacheTest, DefaultResponse) {
// Now we should get the default response for the original request.
response = cache_.GetResponse("www.google.com", "/");
ASSERT_TRUE(response);
- ASSERT_TRUE(ContainsKey(response->headers(), ":status"));
+ ASSERT_TRUE(QuicContainsKey(response->headers(), ":status"));
EXPECT_EQ("200", response->headers().find(":status")->second);
// Now add a set response for / and make sure it is returned
cache_.AddSimpleResponse("www.google.com", "/", 302, "");
response = cache_.GetResponse("www.google.com", "/");
ASSERT_TRUE(response);
- ASSERT_TRUE(ContainsKey(response->headers(), ":status"));
+ ASSERT_TRUE(QuicContainsKey(response->headers(), ":status"));
EXPECT_EQ("302", response->headers().find(":status")->second);
// We should get the default response for other requests.
response = cache_.GetResponse("www.google.com", "/asd");
ASSERT_TRUE(response);
- ASSERT_TRUE(ContainsKey(response->headers(), ":status"));
+ ASSERT_TRUE(QuicContainsKey(response->headers(), ":status"));
EXPECT_EQ("200", response->headers().find(":status")->second);
}
@@ -178,7 +173,7 @@ TEST_F(QuicHttpResponseCacheTest, AddSimpleResponseWithServerPushResources) {
for (int i = 0; i < NumResources; ++i) {
string path = "/server_push_src" + QuicTextUtils::Uint64ToString(i);
string url = scheme + "://" + request_host + path;
- GURL resource_url(url);
+ QuicUrl resource_url(url);
string body = QuicStrCat("This is server push response body for ", path);
SpdyHeaderBlock response_headers;
response_headers[":version"] = "HTTP/1.1";
@@ -191,13 +186,15 @@ TEST_F(QuicHttpResponseCacheTest, AddSimpleResponseWithServerPushResources) {
cache_.AddSimpleResponseWithServerPushResources(
request_host, "/", 200, response_body, push_resources);
+
string request_url = request_host + "/";
std::list<ServerPushInfo> resources =
cache_.GetServerPushResources(request_url);
ASSERT_EQ(kNumResources, resources.size());
for (const auto& push_resource : push_resources) {
ServerPushInfo resource = resources.front();
- EXPECT_EQ(resource.request_url.spec(), push_resource.request_url.spec());
+ EXPECT_EQ(resource.request_url.ToString(),
+ push_resource.request_url.ToString());
EXPECT_EQ(resource.priority, push_resource.priority);
resources.pop_front();
}
@@ -214,7 +211,7 @@ TEST_F(QuicHttpResponseCacheTest, GetServerPushResourcesAndPushResponses) {
for (int i = 0; i < NumResources; ++i) {
string path = "/server_push_src" + QuicTextUtils::Uint64ToString(i);
string url = scheme + "://" + request_host + path;
- GURL resource_url(url);
+ QuicUrl resource_url(url);
string body = "This is server push response body for " + path;
SpdyHeaderBlock response_headers;
response_headers[":version"] = "HTTP/1.1";
@@ -232,13 +229,13 @@ TEST_F(QuicHttpResponseCacheTest, GetServerPushResourcesAndPushResponses) {
ASSERT_EQ(kNumResources, resources.size());
int i = 0;
for (const auto& push_resource : push_resources) {
- GURL url = resources.front().request_url;
+ QuicUrl url = resources.front().request_url;
string host = url.host();
string path = url.path();
const QuicHttpResponseCache::Response* response =
cache_.GetResponse(host, path);
ASSERT_TRUE(response);
- ASSERT_TRUE(ContainsKey(response->headers(), ":status"));
+ ASSERT_TRUE(QuicContainsKey(response->headers(), ":status"));
EXPECT_EQ(push_response_status[i++],
response->headers().find(":status")->second);
EXPECT_EQ(push_resource.body, response->body());
diff --git a/chromium/net/tools/quic/quic_packet_printer_bin.cc b/chromium/net/tools/quic/quic_packet_printer_bin.cc
index 2ba19b93a04..ccac643744e 100644
--- a/chromium/net/tools/quic/quic_packet_printer_bin.cc
+++ b/chromium/net/tools/quic/quic_packet_printer_bin.cc
@@ -41,7 +41,6 @@
#include "net/quic/core/quic_utils.h"
#include "net/quic/platform/api/quic_text_utils.h"
-using std::cerr;
using std::string;
// If set, specify the QUIC version to use.
@@ -65,89 +64,89 @@ class QuicPacketPrinter : public QuicFramerVisitorInterface {
explicit QuicPacketPrinter(QuicFramer* framer) : framer_(framer) {}
void OnError(QuicFramer* framer) override {
- cerr << "OnError: " << QuicErrorCodeToString(framer->error())
- << " detail: " << framer->detailed_error() << "\n";
+ std::cerr << "OnError: " << QuicErrorCodeToString(framer->error())
+ << " detail: " << framer->detailed_error() << "\n";
}
bool OnProtocolVersionMismatch(QuicVersion received_version) override {
framer_->set_version(received_version);
- cerr << "OnProtocolVersionMismatch: "
- << QuicVersionToString(received_version) << "\n";
+ std::cerr << "OnProtocolVersionMismatch: "
+ << QuicVersionToString(received_version) << "\n";
return true;
}
- void OnPacket() override { cerr << "OnPacket\n"; }
+ void OnPacket() override { std::cerr << "OnPacket\n"; }
void OnPublicResetPacket(const QuicPublicResetPacket& packet) override {
- cerr << "OnPublicResetPacket\n";
+ std::cerr << "OnPublicResetPacket\n";
}
void OnVersionNegotiationPacket(
const QuicVersionNegotiationPacket& packet) override {
- cerr << "OnVersionNegotiationPacket\n";
+ std::cerr << "OnVersionNegotiationPacket\n";
}
bool OnUnauthenticatedPublicHeader(
const QuicPacketPublicHeader& header) override {
- cerr << "OnUnauthenticatedPublicHeader\n";
+ std::cerr << "OnUnauthenticatedPublicHeader\n";
return true;
}
bool OnUnauthenticatedHeader(const QuicPacketHeader& header) override {
- cerr << "OnUnauthenticatedHeader: " << header;
+ std::cerr << "OnUnauthenticatedHeader: " << header;
return true;
}
void OnDecryptedPacket(EncryptionLevel level) override {
// This only currently supports "decrypting" null encrypted packets.
DCHECK_EQ(ENCRYPTION_NONE, level);
- cerr << "OnDecryptedPacket\n";
+ std::cerr << "OnDecryptedPacket\n";
}
bool OnPacketHeader(const QuicPacketHeader& header) override {
- cerr << "OnPacketHeader\n";
+ std::cerr << "OnPacketHeader\n";
return true;
}
bool OnStreamFrame(const QuicStreamFrame& frame) override {
- cerr << "OnStreamFrame: " << frame;
- cerr << " data: { "
- << QuicTextUtils::HexEncode(frame.data_buffer, frame.data_length)
- << " }\n";
+ std::cerr << "OnStreamFrame: " << frame;
+ std::cerr << " data: { "
+ << QuicTextUtils::HexEncode(frame.data_buffer, frame.data_length)
+ << " }\n";
return true;
}
bool OnAckFrame(const QuicAckFrame& frame) override {
- cerr << "OnAckFrame: " << frame;
+ std::cerr << "OnAckFrame: " << frame;
return true;
}
bool OnStopWaitingFrame(const QuicStopWaitingFrame& frame) override {
- cerr << "OnStopWaitingFrame: " << frame;
+ std::cerr << "OnStopWaitingFrame: " << frame;
return true;
}
bool OnPaddingFrame(const QuicPaddingFrame& frame) override {
- cerr << "OnPaddingFrame: " << frame;
+ std::cerr << "OnPaddingFrame: " << frame;
return true;
}
bool OnPingFrame(const QuicPingFrame& frame) override {
- cerr << "OnPingFrame\n";
+ std::cerr << "OnPingFrame\n";
return true;
}
bool OnRstStreamFrame(const QuicRstStreamFrame& frame) override {
- cerr << "OnRstStreamFrame: " << frame;
+ std::cerr << "OnRstStreamFrame: " << frame;
return true;
}
bool OnConnectionCloseFrame(const QuicConnectionCloseFrame& frame) override {
- cerr << "OnConnectionCloseFrame: " << frame;
+ std::cerr << "OnConnectionCloseFrame: " << frame;
return true;
}
bool OnGoAwayFrame(const QuicGoAwayFrame& frame) override {
- cerr << "OnGoAwayFrame: " << frame;
+ std::cerr << "OnGoAwayFrame: " << frame;
return true;
}
bool OnWindowUpdateFrame(const QuicWindowUpdateFrame& frame) override {
- cerr << "OnWindowUpdateFrame: " << frame;
+ std::cerr << "OnWindowUpdateFrame: " << frame;
return true;
}
bool OnBlockedFrame(const QuicBlockedFrame& frame) override {
- cerr << "OnBlockedFrame: " << frame;
+ std::cerr << "OnBlockedFrame: " << frame;
return true;
}
bool OnPathCloseFrame(const QuicPathCloseFrame& frame) override {
- cerr << "OnPathCloseFrame:" << frame;
+ std::cerr << "OnPathCloseFrame:" << frame;
return true;
}
- void OnPacketComplete() override { cerr << "OnPacketComplete\n"; }
+ void OnPacketComplete() override { std::cerr << "OnPacketComplete\n"; }
private:
QuicFramer* framer_; // Unowned.
@@ -161,8 +160,8 @@ int main(int argc, char* argv[]) {
const base::CommandLine::StringVector& args = line->GetArgs();
if (args.size() != 3) {
- cerr << "Missing argument " << argc << ". (Usage: " << argv[0]
- << " client|server <hex>\n";
+ std::cerr << "Missing argument " << argc << ". (Usage: " << argv[0]
+ << " client|server <hex>\n";
return 1;
}
@@ -177,8 +176,8 @@ int main(int argc, char* argv[]) {
} else if (perspective_string == "server") {
perspective = net::Perspective::IS_SERVER;
} else {
- cerr << "Invalid perspective. " << perspective_string
- << " Usage: " << args[0] << " client|server <hex>\n";
+ std::cerr << "Invalid perspective. " << perspective_string
+ << " Usage: " << args[0] << " client|server <hex>\n";
return 1;
}
string hex = net::QuicTextUtils::HexDecode(argv[2]);
diff --git a/chromium/net/tools/quic/quic_reject_reason_decoder_bin.cc b/chromium/net/tools/quic/quic_reject_reason_decoder_bin.cc
index aba019947b7..96d63e6656f 100644
--- a/chromium/net/tools/quic/quic_reject_reason_decoder_bin.cc
+++ b/chromium/net/tools/quic/quic_reject_reason_decoder_bin.cc
@@ -13,12 +13,9 @@
#include "net/quic/core/crypto/crypto_utils.h"
using base::CommandLine;
-using base::StringToUint;
using net::HandshakeFailureReason;
using net::CryptoUtils;
using net::MAX_FAILURE_REASON;
-using std::cerr;
-using std::cout;
int main(int argc, char* argv[]) {
CommandLine::Init(argc, argv);
@@ -26,13 +23,13 @@ int main(int argc, char* argv[]) {
const CommandLine::StringVector& args = line->GetArgs();
if (args.size() != 1) {
- cerr << "Missing argument (Usage: " << argv[0] << " <packed_reason>\n";
+ std::cerr << "Missing argument (Usage: " << argv[0] << " <packed_reason>\n";
return 1;
}
uint32_t packed_error = 0;
- if (!StringToUint(args[0], &packed_error)) {
- cerr << "Unable to parse: " << args[0] << "\n";
+ if (!base::StringToUint(args[0], &packed_error)) {
+ std::cerr << "Unable to parse: " << args[0] << "\n";
return 2;
}
@@ -41,7 +38,7 @@ int main(int argc, char* argv[]) {
continue;
}
HandshakeFailureReason reason = static_cast<HandshakeFailureReason>(i);
- cout << CryptoUtils::HandshakeFailureReasonToString(reason) << "\n";
+ std::cout << CryptoUtils::HandshakeFailureReasonToString(reason) << "\n";
}
return 0;
}
diff --git a/chromium/net/tools/quic/quic_server.cc b/chromium/net/tools/quic/quic_server.cc
index 69dd41a9b42..91b11a31836 100644
--- a/chromium/net/tools/quic/quic_server.cc
+++ b/chromium/net/tools/quic/quic_server.cc
@@ -13,8 +13,6 @@
#include <memory>
-#include "net/base/ip_endpoint.h"
-#include "net/base/sockaddr_storage.h"
#include "net/quic/core/crypto/crypto_handshake.h"
#include "net/quic/core/crypto/quic_random.h"
#include "net/quic/core/quic_crypto_stream.h"
@@ -34,7 +32,9 @@
#ifndef SO_RXQ_OVFL
#define SO_RXQ_OVFL 40
#endif
+
namespace net {
+
namespace {
// Specifies the directory used during QuicHttpResponseCache
@@ -67,6 +67,7 @@ QuicServer::QuicServer(
fd_(-1),
packets_dropped_(0),
overflow_supported_(false),
+ silent_close_(false),
config_(config),
crypto_config_(kSourceAddressTokenSecret,
QuicRandom::GetInstance(),
@@ -111,7 +112,7 @@ QuicServer::~QuicServer() {}
bool QuicServer::CreateUDPSocketAndListen(const QuicSocketAddress& address) {
fd_ = QuicSocketUtils::CreateUDPSocket(address, &overflow_supported_);
if (fd_ < 0) {
- LOG(ERROR) << "CreateSocket() failed: " << strerror(errno);
+ QUIC_LOG(ERROR) << "CreateSocket() failed: " << strerror(errno);
return false;
}
@@ -161,9 +162,11 @@ void QuicServer::WaitForEvents() {
}
void QuicServer::Shutdown() {
- // Before we shut down the epoll server, give all active sessions a chance to
- // notify clients that they're closing.
- dispatcher_->Shutdown();
+ if (!silent_close_) {
+ // Before we shut down the epoll server, give all active sessions a chance
+ // to notify clients that they're closing.
+ dispatcher_->Shutdown();
+ }
close(fd_);
fd_ = -1;
@@ -174,7 +177,7 @@ void QuicServer::OnEvent(int fd, EpollEvent* event) {
event->out_ready_mask = 0;
if (event->in_events & EPOLLIN) {
- DVLOG(1) << "EPOLLIN";
+ QUIC_DVLOG(1) << "EPOLLIN";
if (FLAGS_quic_reloadable_flag_quic_limit_num_new_sessions_per_epoll_loop) {
dispatcher_->ProcessBufferedChlos(kNumSessionsToCreatePerSocketEvent);
diff --git a/chromium/net/tools/quic/quic_server.h b/chromium/net/tools/quic/quic_server.h
index 7bce8e6b05c..2a3aca040e4 100644
--- a/chromium/net/tools/quic/quic_server.h
+++ b/chromium/net/tools/quic/quic_server.h
@@ -11,8 +11,6 @@
#ifndef NET_TOOLS_QUIC_QUIC_SERVER_H_
#define NET_TOOLS_QUIC_QUIC_SERVER_H_
-#include <stddef.h>
-
#include <memory>
#include "base/macros.h"
@@ -54,7 +52,7 @@ class QuicServer : public EpollCallbackInterface {
void WaitForEvents();
// Server deletion is imminent. Start cleaning up the epoll server.
- void Shutdown();
+ virtual void Shutdown();
// From EpollCallbackInterface
void OnRegistration(EpollServer* eps, int fd, int event_mask) override {}
@@ -89,6 +87,8 @@ class QuicServer : public EpollCallbackInterface {
QuicHttpResponseCache* response_cache() { return response_cache_; }
+ void set_silent_close(bool value) { silent_close_ = value; }
+
private:
friend class net::test::QuicServerPeer;
@@ -115,6 +115,10 @@ class QuicServer : public EpollCallbackInterface {
// because the socket would otherwise overflow.
bool overflow_supported_;
+ // If true, do not call Shutdown on the dispatcher. Connections will close
+ // without sending a final connection close.
+ bool silent_close_;
+
// config_ contains non-crypto parameters that are negotiated in the crypto
// handshake.
QuicConfig config_;
diff --git a/chromium/net/tools/quic/quic_server_test.cc b/chromium/net/tools/quic/quic_server_test.cc
index 8c6584eb46b..d880dcca383 100644
--- a/chromium/net/tools/quic/quic_server_test.cc
+++ b/chromium/net/tools/quic/quic_server_test.cc
@@ -51,8 +51,8 @@ class MockQuicSimpleDispatcher : public QuicSimpleDispatcher {
class TestQuicServer : public QuicServer {
public:
TestQuicServer()
- : QuicServer(CryptoTestUtils::ProofSourceForTesting(), &response_cache_) {
- }
+ : QuicServer(crypto_test_utils::ProofSourceForTesting(),
+ &response_cache_) {}
~TestQuicServer() override {}
@@ -130,9 +130,8 @@ TEST_F(QuicServerEpollInTest, ProcessBufferedCHLOsOnEpollin) {
char buf[1024];
memset(buf, 0, arraysize(buf));
sockaddr_storage storage = server_address_.generic_address();
- socklen_t storage_size = sizeof(storage);
int rc = sendto(fd, buf, arraysize(buf), 0,
- reinterpret_cast<sockaddr*>(&storage), storage_size);
+ reinterpret_cast<sockaddr*>(&storage), sizeof(storage));
if (rc < 0) {
QUIC_DLOG(INFO) << errno << " " << strerror(errno);
}
@@ -147,7 +146,7 @@ class QuicServerDispatchPacketTest : public ::testing::Test {
QuicServerDispatchPacketTest()
: crypto_config_("blah",
QuicRandom::GetInstance(),
- CryptoTestUtils::ProofSourceForTesting()),
+ crypto_test_utils::ProofSourceForTesting()),
version_manager_(AllSupportedVersions()),
dispatcher_(
config_,
diff --git a/chromium/net/tools/quic/quic_simple_client_bin.cc b/chromium/net/tools/quic/quic_simple_client_bin.cc
index ffa5e54d289..bfe5fe84c1b 100644
--- a/chromium/net/tools/quic/quic_simple_client_bin.cc
+++ b/chromium/net/tools/quic/quic_simple_client_bin.cc
@@ -47,6 +47,8 @@
#include "net/base/net_errors.h"
#include "net/base/privacy_mode.h"
#include "net/cert/cert_verifier.h"
+#include "net/cert/ct_known_logs.h"
+#include "net/cert/ct_log_verifier.h"
#include "net/cert/multi_log_ct_verifier.h"
#include "net/http/transport_security_state.h"
#include "net/quic/chromium/crypto/proof_verifier_chromium.h"
@@ -258,7 +260,8 @@ int main(int argc, char* argv[]) {
std::unique_ptr<CertVerifier> cert_verifier(CertVerifier::CreateDefault());
std::unique_ptr<TransportSecurityState> transport_security_state(
new TransportSecurityState);
- std::unique_ptr<CTVerifier> ct_verifier(new MultiLogCTVerifier());
+ std::unique_ptr<MultiLogCTVerifier> ct_verifier(new MultiLogCTVerifier());
+ ct_verifier->AddLogs(net::ct::CreateLogVerifiersForKnownLogs());
std::unique_ptr<CTPolicyEnforcer> ct_policy_enforcer(new CTPolicyEnforcer());
std::unique_ptr<ProofVerifier> proof_verifier;
if (line->HasSwitch("disable-certificate-verification")) {
diff --git a/chromium/net/tools/quic/quic_simple_client_test.cc b/chromium/net/tools/quic/quic_simple_client_test.cc
index 64db2d2a6dd..997890e03c7 100644
--- a/chromium/net/tools/quic/quic_simple_client_test.cc
+++ b/chromium/net/tools/quic/quic_simple_client_test.cc
@@ -18,7 +18,7 @@ TEST(QuicSimpleClientTest, Initialize) {
PRIVACY_MODE_DISABLED);
QuicVersionVector versions = AllSupportedVersions();
QuicSimpleClient client(server_address, server_id, versions,
- CryptoTestUtils::ProofVerifierForTesting());
+ crypto_test_utils::ProofVerifierForTesting());
EXPECT_TRUE(client.Initialize());
}
diff --git a/chromium/net/tools/quic/quic_simple_crypto_server_stream_helper.cc b/chromium/net/tools/quic/quic_simple_crypto_server_stream_helper.cc
index a25b872275b..6f310eb3985 100644
--- a/chromium/net/tools/quic/quic_simple_crypto_server_stream_helper.cc
+++ b/chromium/net/tools/quic/quic_simple_crypto_server_stream_helper.cc
@@ -13,8 +13,8 @@ QuicSimpleCryptoServerStreamHelper::QuicSimpleCryptoServerStreamHelper(
QuicSimpleCryptoServerStreamHelper::~QuicSimpleCryptoServerStreamHelper() {}
QuicConnectionId
- QuicSimpleCryptoServerStreamHelper::GenerateConnectionIdForReject(
- QuicConnectionId /*connection_id*/) const {
+QuicSimpleCryptoServerStreamHelper::GenerateConnectionIdForReject(
+ QuicConnectionId /*connection_id*/) const {
return random_->RandUint64();
}
diff --git a/chromium/net/tools/quic/quic_simple_server_session.cc b/chromium/net/tools/quic/quic_simple_server_session.cc
index 3e60f3a2acf..5f60d7427bd 100644
--- a/chromium/net/tools/quic/quic_simple_server_session.cc
+++ b/chromium/net/tools/quic/quic_simple_server_session.cc
@@ -9,11 +9,9 @@
#include "net/quic/core/proto/cached_network_parameters.pb.h"
#include "net/quic/core/quic_connection.h"
#include "net/quic/core/quic_flags.h"
-#include "net/quic/core/quic_spdy_session.h"
#include "net/quic/platform/api/quic_logging.h"
#include "net/quic/platform/api/quic_ptr_util.h"
#include "net/tools/quic/quic_simple_server_stream.h"
-#include "url/gurl.h"
using std::string;
@@ -154,13 +152,13 @@ SpdyHeaderBlock QuicSimpleServerSession::SynthesizePushRequestHeaders(
string request_url,
QuicHttpResponseCache::ServerPushInfo resource,
const SpdyHeaderBlock& original_request_headers) {
- GURL push_request_url = resource.request_url;
- string path = push_request_url.path();
+ QuicUrl push_request_url = resource.request_url;
SpdyHeaderBlock spdy_headers = original_request_headers.Clone();
// :authority could be different from original request.
spdy_headers[":authority"] = push_request_url.host();
- spdy_headers[":path"] = path;
+ spdy_headers[":path"] = push_request_url.path();
+ ;
// Push request always use GET.
spdy_headers[":method"] = "GET";
spdy_headers["referer"] = request_url;
@@ -198,7 +196,7 @@ void QuicSimpleServerSession::HandlePromisedPushRequests() {
QuicSimpleServerStream* promised_stream =
static_cast<QuicSimpleServerStream*>(
CreateOutgoingDynamicStream(promised_info.priority));
- DCHECK(promised_stream != nullptr);
+ DCHECK_NE(promised_stream, nullptr);
DCHECK_EQ(promised_info.stream_id, promised_stream->id());
QUIC_DLOG(INFO) << "created server push stream " << promised_stream->id();
diff --git a/chromium/net/tools/quic/quic_simple_server_session.h b/chromium/net/tools/quic/quic_simple_server_session.h
index b8efb35ba89..f9ff7da41fd 100644
--- a/chromium/net/tools/quic/quic_simple_server_session.h
+++ b/chromium/net/tools/quic/quic_simple_server_session.h
@@ -27,10 +27,6 @@
namespace net {
-class QuicConfig;
-class QuicConnection;
-class QuicCryptoServerConfig;
-
namespace test {
class QuicSimpleServerSessionPeer;
} // namespace test
diff --git a/chromium/net/tools/quic/quic_simple_server_session_test.cc b/chromium/net/tools/quic/quic_simple_server_session_test.cc
index a808d23e5a3..5d1cac27f33 100644
--- a/chromium/net/tools/quic/quic_simple_server_session_test.cc
+++ b/chromium/net/tools/quic/quic_simple_server_session_test.cc
@@ -8,7 +8,6 @@
#include <memory>
#include "base/macros.h"
-#include "base/strings/string_number_conversions.h"
#include "net/quic/core/crypto/quic_crypto_server_config.h"
#include "net/quic/core/crypto/quic_random.h"
#include "net/quic/core/proto/cached_network_parameters.pb.h"
@@ -29,12 +28,11 @@
#include "net/quic/test_tools/quic_test_utils.h"
#include "net/test/gtest_util.h"
#include "net/tools/quic/quic_simple_server_stream.h"
-#include "net/tools/quic/test_tools/mock_quic_server_session_visitor.h"
+#include "net/tools/quic/test_tools/mock_quic_session_visitor.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
using std::string;
-using testing::StrictMock;
using testing::_;
using testing::AtLeast;
using testing::InSequence;
@@ -181,7 +179,7 @@ class QuicSimpleServerSessionTest
QuicSimpleServerSessionTest()
: crypto_config_(QuicCryptoServerConfig::TESTING,
QuicRandom::GetInstance(),
- CryptoTestUtils::ProofSourceForTesting()),
+ crypto_test_utils::ProofSourceForTesting()),
compressed_certs_cache_(
QuicCompressedCertsCache::kQuicCompressedCertsCacheSize) {
config_.SetMaxStreamsPerConnection(kMaxStreamsForTest, kMaxStreamsForTest);
@@ -473,7 +471,7 @@ class QuicSimpleServerSessionServerPushTest
string path =
partial_push_resource_path + QuicTextUtils::Uint64ToString(i);
string url = scheme + "://" + resource_host + path;
- GURL resource_url = GURL(url);
+ QuicUrl resource_url = QuicUrl(url);
string body(body_size, 'a');
response_cache_.AddSimpleResponse(resource_host, path, 200, body);
push_resources.push_back(QuicHttpResponseCache::ServerPushInfo(
diff --git a/chromium/net/tools/quic/quic_simple_server_stream.cc b/chromium/net/tools/quic/quic_simple_server_stream.cc
index 7136bd5f7dc..8289655278e 100644
--- a/chromium/net/tools/quic/quic_simple_server_stream.cc
+++ b/chromium/net/tools/quic/quic_simple_server_stream.cc
@@ -7,12 +7,12 @@
#include <list>
#include <utility>
-#include "base/stl_util.h"
#include "net/quic/core/quic_flags.h"
#include "net/quic/core/quic_spdy_stream.h"
#include "net/quic/core/spdy_utils.h"
#include "net/quic/platform/api/quic_bug_tracker.h"
#include "net/quic/platform/api/quic_logging.h"
+#include "net/quic/platform/api/quic_map_util.h"
#include "net/quic/platform/api/quic_text_utils.h"
#include "net/spdy/spdy_protocol.h"
#include "net/tools/quic/quic_http_response_cache.h"
@@ -61,8 +61,8 @@ void QuicSimpleServerStream::OnDataAvailable() {
// No more data to read.
break;
}
- QUIC_DVLOG(1) << "Processed " << iov.iov_len << " bytes for stream "
- << id();
+ QUIC_DVLOG(1) << "Stream " << id() << " processed " << iov.iov_len
+ << " bytes.";
body_.append(static_cast<char*>(iov.iov_base), iov.iov_len);
if (content_length_ >= 0 &&
@@ -100,7 +100,7 @@ void QuicSimpleServerStream::PushResponse(
request_headers_ = std::move(push_request_headers);
content_length_ = 0;
QUIC_DVLOG(1) << "Stream " << id()
- << ": Ready to receive server push response.";
+ << " ready to receive server push response.";
// Set as if stream decompresed the headers and received fin.
QuicSpdyStream::OnInitialHeadersComplete(/*fin=*/true, 0, QuicHeaderList());
@@ -121,8 +121,8 @@ void QuicSimpleServerStream::SendResponse() {
return;
}
- if (!base::ContainsKey(request_headers_, ":authority") ||
- !base::ContainsKey(request_headers_, ":path")) {
+ if (!QuicContainsKey(request_headers_, ":authority") ||
+ !QuicContainsKey(request_headers_, ":path")) {
QUIC_DVLOG(1) << "Request headers do not contain :authority or :path.";
SendErrorResponse();
return;
@@ -152,8 +152,10 @@ void QuicSimpleServerStream::SendResponse() {
return;
}
- // Examing response status, if it was not pure integer as typical h2 response
- // status, send error response.
+ // Examing response status, if it was not pure integer as typical h2
+ // response status, send error response. Notice that
+ // QuicHttpResponseCache push urls are strictly authority + path only,
+ // scheme is not included (see |QuicHttpResponseCache::GetKey()|).
string request_url = request_headers_[":authority"].as_string() +
request_headers_[":path"].as_string();
int response_code;
@@ -186,8 +188,8 @@ void QuicSimpleServerStream::SendResponse() {
}
std::list<QuicHttpResponseCache::ServerPushInfo> resources =
response_cache_->GetServerPushResources(request_url);
- QUIC_DVLOG(1) << "Found " << resources.size() << " push resources for stream "
- << id();
+ QUIC_DVLOG(1) << "Stream " << id() << " found " << resources.size()
+ << " push resources.";
if (!resources.empty()) {
QuicSimpleServerSession* session =
@@ -196,13 +198,13 @@ void QuicSimpleServerStream::SendResponse() {
request_headers_);
}
- QUIC_DVLOG(1) << "Sending response for stream " << id();
+ QUIC_DVLOG(1) << "Stream " << id() << " sending response.";
SendHeadersAndBodyAndTrailers(response->headers().Clone(), response->body(),
response->trailers().Clone());
}
void QuicSimpleServerStream::SendNotFoundResponse() {
- QUIC_DVLOG(1) << "Sending not found response for stream " << id();
+ QUIC_DVLOG(1) << "Stream " << id() << " sending not found response.";
SpdyHeaderBlock headers;
headers[":status"] = "404";
headers["content-length"] =
@@ -211,7 +213,7 @@ void QuicSimpleServerStream::SendNotFoundResponse() {
}
void QuicSimpleServerStream::SendErrorResponse() {
- QUIC_DVLOG(1) << "Sending error response for stream " << id();
+ QUIC_DVLOG(1) << "Stream " << id() << " sending error response.";
SpdyHeaderBlock headers;
headers[":status"] = "500";
headers["content-length"] =
@@ -236,7 +238,7 @@ void QuicSimpleServerStream::SendHeadersAndBodyAndTrailers(
// Send the headers, with a FIN if there's nothing else to send.
bool send_fin = (body.empty() && response_trailers.empty());
- QUIC_DLOG(INFO) << "Writing headers (fin = " << send_fin
+ QUIC_DLOG(INFO) << "Stream " << id() << " writing headers (fin = " << send_fin
<< ") : " << response_headers.DebugString();
WriteHeaders(std::move(response_headers), send_fin, nullptr);
if (send_fin) {
@@ -246,7 +248,7 @@ void QuicSimpleServerStream::SendHeadersAndBodyAndTrailers(
// Send the body, with a FIN if there's no trailers to send.
send_fin = response_trailers.empty();
- QUIC_DLOG(INFO) << "Writing body (fin = " << send_fin
+ QUIC_DLOG(INFO) << "Stream " << id() << " writing body (fin = " << send_fin
<< ") with size: " << body.size();
if (!body.empty() || send_fin) {
WriteOrBufferData(body, send_fin, nullptr);
@@ -257,7 +259,7 @@ void QuicSimpleServerStream::SendHeadersAndBodyAndTrailers(
}
// Send the trailers. A FIN is always sent with trailers.
- QUIC_DLOG(INFO) << "Writing trailers (fin = true): "
+ QUIC_DLOG(INFO) << "Stream " << id() << " writing trailers (fin = true): "
<< response_trailers.DebugString();
WriteTrailers(std::move(response_trailers), nullptr);
}
diff --git a/chromium/net/tools/quic/quic_simple_server_stream.h b/chromium/net/tools/quic/quic_simple_server_stream.h
index 2aa7b759ce1..1471aada756 100644
--- a/chromium/net/tools/quic/quic_simple_server_stream.h
+++ b/chromium/net/tools/quic/quic_simple_server_stream.h
@@ -5,8 +5,6 @@
#ifndef NET_TOOLS_QUIC_QUIC_SIMPLE_SERVER_STREAM_H_
#define NET_TOOLS_QUIC_QUIC_SIMPLE_SERVER_STREAM_H_
-#include <stddef.h>
-
#include <string>
#include "base/macros.h"
@@ -18,7 +16,6 @@
namespace net {
-
namespace test {
class QuicSimpleServerStreamPeer;
} // namespace test
diff --git a/chromium/net/tools/quic/quic_simple_server_stream_test.cc b/chromium/net/tools/quic/quic_simple_server_stream_test.cc
index bd1780eb97a..4a444e3c916 100644
--- a/chromium/net/tools/quic/quic_simple_server_stream_test.cc
+++ b/chromium/net/tools/quic/quic_simple_server_stream_test.cc
@@ -8,11 +8,7 @@
#include <memory>
#include <utility>
-#include "base/strings/string_number_conversions.h"
#include "base/strings/string_piece.h"
-#include "net/quic/core/quic_connection.h"
-#include "net/quic/core/quic_flags.h"
-#include "net/quic/core/quic_packets.h"
#include "net/quic/core/quic_utils.h"
#include "net/quic/core/spdy_utils.h"
#include "net/quic/platform/api/quic_ptr_util.h"
@@ -21,23 +17,19 @@
#include "net/quic/test_tools/quic_stream_peer.h"
#include "net/quic/test_tools/quic_test_utils.h"
#include "net/test/gtest_util.h"
-#include "net/tools/epoll_server/epoll_server.h"
#include "net/tools/quic/quic_http_response_cache.h"
#include "net/tools/quic/quic_simple_server_session.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
-#include "url/gurl.h"
using base::StringPiece;
using std::string;
using testing::_;
using testing::AnyNumber;
using testing::Invoke;
-using testing::InvokeArgument;
using testing::InSequence;
using testing::Return;
using testing::StrictMock;
-using testing::WithArgs;
namespace net {
namespace test {
@@ -186,7 +178,7 @@ class QuicSimpleServerStreamTest
crypto_config_(new QuicCryptoServerConfig(
QuicCryptoServerConfig::TESTING,
QuicRandom::GetInstance(),
- ::net::test::CryptoTestUtils::ProofSourceForTesting())),
+ crypto_test_utils::ProofSourceForTesting())),
compressed_certs_cache_(
QuicCompressedCertsCache::kQuicCompressedCertsCacheSize),
session_(connection_,
@@ -210,8 +202,8 @@ class QuicSimpleServerStreamTest
kInitialStreamFlowControlWindowForTest);
session_.config()->SetInitialSessionFlowControlWindowToSend(
kInitialSessionFlowControlWindowForTest);
- stream_ = new QuicSimpleServerStreamPeer(::net::test::kClientDataStreamId1,
- &session_, &response_cache_);
+ stream_ = new QuicSimpleServerStreamPeer(kClientDataStreamId1, &session_,
+ &response_cache_);
// Register stream_ in dynamic_stream_map_ and pass ownership to session_.
session_.ActivateStream(QuicWrapUnique(stream_));
}
@@ -334,7 +326,9 @@ TEST_P(QuicSimpleServerStreamTest, SendResponseWithIllegalResponseStatus) {
QuicSimpleServerStreamPeer::SendResponse(stream_);
EXPECT_FALSE(QuicStreamPeer::read_side_closed(stream_));
- EXPECT_TRUE(stream_->reading_stopped());
+ if (!FLAGS_quic_reloadable_flag_quic_always_enable_bidi_streaming) {
+ EXPECT_TRUE(stream_->reading_stopped());
+ }
EXPECT_TRUE(stream_->write_side_closed());
}
@@ -365,7 +359,9 @@ TEST_P(QuicSimpleServerStreamTest, SendResponseWithIllegalResponseStatus2) {
QuicSimpleServerStreamPeer::SendResponse(stream_);
EXPECT_FALSE(QuicStreamPeer::read_side_closed(stream_));
- EXPECT_TRUE(stream_->reading_stopped());
+ if (!FLAGS_quic_reloadable_flag_quic_always_enable_bidi_streaming) {
+ EXPECT_TRUE(stream_->reading_stopped());
+ }
EXPECT_TRUE(stream_->write_side_closed());
}
@@ -421,7 +417,9 @@ TEST_P(QuicSimpleServerStreamTest, SendResponseWithValidHeaders) {
QuicSimpleServerStreamPeer::SendResponse(stream_);
EXPECT_FALSE(QuicStreamPeer::read_side_closed(stream_));
- EXPECT_TRUE(stream_->reading_stopped());
+ if (!FLAGS_quic_reloadable_flag_quic_always_enable_bidi_streaming) {
+ EXPECT_TRUE(stream_->reading_stopped());
+ }
EXPECT_TRUE(stream_->write_side_closed());
}
@@ -433,9 +431,8 @@ TEST_P(QuicSimpleServerStreamTest, SendReponseWithPushResources) {
string host = "www.google.com";
string request_path = "/foo";
string body = "Yummm";
- string url = host + "/bar";
QuicHttpResponseCache::ServerPushInfo push_info(
- GURL(url), SpdyHeaderBlock(), kDefaultPriority, "Push body");
+ QuicUrl(host, "/bar"), SpdyHeaderBlock(), kDefaultPriority, "Push body");
std::list<QuicHttpResponseCache::ServerPushInfo> push_resources;
push_resources.push_back(push_info);
response_cache_.AddSimpleResponseWithServerPushResources(
@@ -449,9 +446,8 @@ TEST_P(QuicSimpleServerStreamTest, SendReponseWithPushResources) {
stream_->set_fin_received(true);
InSequence s;
- EXPECT_CALL(session_,
- PromisePushResourcesMock(host + request_path, _,
- ::net::test::kClientDataStreamId1, _));
+ EXPECT_CALL(session_, PromisePushResourcesMock(host + request_path, _,
+ kClientDataStreamId1, _));
EXPECT_CALL(session_, WriteHeadersMock(stream_->id(), _, false, _, _));
EXPECT_CALL(session_, WritevData(_, _, _, _, _, _))
.Times(1)
@@ -527,7 +523,9 @@ TEST_P(QuicSimpleServerStreamTest, TestSendErrorResponse) {
QuicSimpleServerStreamPeer::SendErrorResponse(stream_);
EXPECT_FALSE(QuicStreamPeer::read_side_closed(stream_));
- EXPECT_TRUE(stream_->reading_stopped());
+ if (!FLAGS_quic_reloadable_flag_quic_always_enable_bidi_streaming) {
+ EXPECT_TRUE(stream_->reading_stopped());
+ }
EXPECT_TRUE(stream_->write_side_closed());
}
@@ -587,6 +585,9 @@ TEST_P(QuicSimpleServerStreamTest, ValidMultipleContentLength) {
}
TEST_P(QuicSimpleServerStreamTest, SendQuicRstStreamNoErrorWithEarlyResponse) {
+ if (FLAGS_quic_reloadable_flag_quic_always_enable_bidi_streaming) {
+ return;
+ }
InSequence s;
EXPECT_CALL(session_, WriteHeadersMock(stream_->id(), _, false, _, _));
EXPECT_CALL(session_, WritevData(_, _, _, _, _, _))
@@ -615,27 +616,27 @@ TEST_P(QuicSimpleServerStreamTest,
TEST_P(QuicSimpleServerStreamTest, InvalidHeadersWithFin) {
char arr[] = {
- 0x3a, 0x68, 0x6f, 0x73, // :hos
- 0x74, 0x00, 0x00, 0x00, // t...
- 0x00, 0x00, 0x00, 0x00, // ....
- 0x07, 0x3a, 0x6d, 0x65, // .:me
- 0x74, 0x68, 0x6f, 0x64, // thod
- 0x00, 0x00, 0x00, 0x03, // ....
- 0x47, 0x45, 0x54, 0x00, // GET.
- 0x00, 0x00, 0x05, 0x3a, // ...:
- 0x70, 0x61, 0x74, 0x68, // path
- 0x00, 0x00, 0x00, 0x04, // ....
- 0x2f, 0x66, 0x6f, 0x6f, // /foo
- 0x00, 0x00, 0x00, 0x07, // ....
- 0x3a, 0x73, 0x63, 0x68, // :sch
- 0x65, 0x6d, 0x65, 0x00, // eme.
- 0x00, 0x00, 0x00, 0x00, // ....
- 0x00, 0x00, 0x08, 0x3a, // ...:
- 0x76, 0x65, 0x72, 0x73, // vers
- '\x96', 0x6f, 0x6e, 0x00, // <i(69)>on.
- 0x00, 0x00, 0x08, 0x48, // ...H
- 0x54, 0x54, 0x50, 0x2f, // TTP/
- 0x31, 0x2e, 0x31, // 1.1
+ 0x3a, 0x68, 0x6f, 0x73, // :hos
+ 0x74, 0x00, 0x00, 0x00, // t...
+ 0x00, 0x00, 0x00, 0x00, // ....
+ 0x07, 0x3a, 0x6d, 0x65, // .:me
+ 0x74, 0x68, 0x6f, 0x64, // thod
+ 0x00, 0x00, 0x00, 0x03, // ....
+ 0x47, 0x45, 0x54, 0x00, // GET.
+ 0x00, 0x00, 0x05, 0x3a, // ...:
+ 0x70, 0x61, 0x74, 0x68, // path
+ 0x00, 0x00, 0x00, 0x04, // ....
+ 0x2f, 0x66, 0x6f, 0x6f, // /foo
+ 0x00, 0x00, 0x00, 0x07, // ....
+ 0x3a, 0x73, 0x63, 0x68, // :sch
+ 0x65, 0x6d, 0x65, 0x00, // eme.
+ 0x00, 0x00, 0x00, 0x00, // ....
+ 0x00, 0x00, 0x08, 0x3a, // ...:
+ 0x76, 0x65, 0x72, 0x73, // vers
+ 0x96, 0x6f, 0x6e, 0x00, // <i(69)>on.
+ 0x00, 0x00, 0x08, 0x48, // ...H
+ 0x54, 0x54, 0x50, 0x2f, // TTP/
+ 0x31, 0x2e, 0x31, // 1.1
};
StringPiece data(arr, arraysize(arr));
QuicStreamFrame frame(stream_->id(), true, 0, data);
diff --git a/chromium/net/tools/quic/quic_simple_server_test.cc b/chromium/net/tools/quic/quic_simple_server_test.cc
index 87969d82f55..58cd14ee933 100644
--- a/chromium/net/tools/quic/quic_simple_server_test.cc
+++ b/chromium/net/tools/quic/quic_simple_server_test.cc
@@ -24,7 +24,7 @@ class QuicChromeServerDispatchPacketTest : public ::testing::Test {
QuicChromeServerDispatchPacketTest()
: crypto_config_("blah",
QuicRandom::GetInstance(),
- CryptoTestUtils::ProofSourceForTesting()),
+ crypto_test_utils::ProofSourceForTesting()),
version_manager_(AllSupportedVersions()),
dispatcher_(
config_,
diff --git a/chromium/net/tools/quic/quic_spdy_client_stream.cc b/chromium/net/tools/quic/quic_spdy_client_stream.cc
index 554c173d0ac..47097a6c5ba 100644
--- a/chromium/net/tools/quic/quic_spdy_client_stream.cc
+++ b/chromium/net/tools/quic/quic_spdy_client_stream.cc
@@ -6,7 +6,6 @@
#include <utility>
-#include "base/stl_util.h"
#include "net/quic/core/quic_alarm.h"
#include "net/quic/core/quic_client_promised_info.h"
#include "net/quic/core/spdy_utils.h"
diff --git a/chromium/net/tools/quic/quic_spdy_client_stream_test.cc b/chromium/net/tools/quic/quic_spdy_client_stream_test.cc
index b7233dfff89..915d53913a8 100644
--- a/chromium/net/tools/quic/quic_spdy_client_stream_test.cc
+++ b/chromium/net/tools/quic/quic_spdy_client_stream_test.cc
@@ -38,7 +38,7 @@ class MockQuicClientSession : public QuicClientSession {
QuicServerId("example.com", 443, PRIVACY_MODE_DISABLED),
&crypto_config_,
push_promise_index),
- crypto_config_(CryptoTestUtils::ProofVerifierForTesting()) {}
+ crypto_config_(crypto_test_utils::ProofVerifierForTesting()) {}
~MockQuicClientSession() override {}
MOCK_METHOD1(CloseStream, void(QuicStreamId stream_id));
@@ -168,6 +168,9 @@ TEST_F(QuicSpdyClientStreamTest, DISABLED_TestFramingExtraData) {
}
TEST_F(QuicSpdyClientStreamTest, TestNoBidirectionalStreaming) {
+ if (FLAGS_quic_reloadable_flag_quic_always_enable_bidi_streaming) {
+ return;
+ }
QuicStreamFrame frame(kClientDataStreamId1, false, 3, StringPiece("asd"));
EXPECT_FALSE(stream_->write_side_closed());
@@ -196,9 +199,14 @@ TEST_F(QuicSpdyClientStreamTest, ReceivingTrailers) {
// Now send the body, which should close the stream as the FIN has been
// received, as well as all data.
- EXPECT_CALL(session_, CloseStream(stream_->id()));
+ if (!FLAGS_quic_reloadable_flag_quic_always_enable_bidi_streaming) {
+ EXPECT_CALL(session_, CloseStream(stream_->id()));
+ }
stream_->OnStreamFrame(
QuicStreamFrame(stream_->id(), /*fin=*/false, /*offset=*/0, body_));
+ if (FLAGS_quic_reloadable_flag_quic_always_enable_bidi_streaming) {
+ EXPECT_TRUE(stream_->reading_stopped());
+ }
}
} // namespace
diff --git a/chromium/net/tools/quic/quic_time_wait_list_manager.cc b/chromium/net/tools/quic/quic_time_wait_list_manager.cc
index 85918971ab9..da49cfc31e2 100644
--- a/chromium/net/tools/quic/quic_time_wait_list_manager.cc
+++ b/chromium/net/tools/quic/quic_time_wait_list_manager.cc
@@ -9,7 +9,6 @@
#include <memory>
#include "base/macros.h"
-#include "base/stl_util.h"
#include "net/quic/core/crypto/crypto_protocol.h"
#include "net/quic/core/crypto/quic_decrypter.h"
#include "net/quic/core/crypto/quic_encrypter.h"
@@ -20,6 +19,7 @@
#include "net/quic/core/quic_utils.h"
#include "net/quic/platform/api/quic_clock.h"
#include "net/quic/platform/api/quic_logging.h"
+#include "net/quic/platform/api/quic_map_util.h"
#include "net/quic/platform/api/quic_ptr_util.h"
#include "net/quic/platform/api/quic_socket_address.h"
@@ -127,7 +127,7 @@ void QuicTimeWaitListManager::AddConnectionIdToTimeWait(
bool QuicTimeWaitListManager::IsConnectionIdInTimeWait(
QuicConnectionId connection_id) const {
- return base::ContainsKey(connection_id_map_, connection_id);
+ return QuicContainsKey(connection_id_map_, connection_id);
}
QuicVersion QuicTimeWaitListManager::GetQuicVersionFromConnectionId(
diff --git a/chromium/net/tools/quic/quic_time_wait_list_manager.h b/chromium/net/tools/quic/quic_time_wait_list_manager.h
index 3c4dc0223a0..998bb3637da 100644
--- a/chromium/net/tools/quic/quic_time_wait_list_manager.h
+++ b/chromium/net/tools/quic/quic_time_wait_list_manager.h
@@ -15,13 +15,13 @@
#include <memory>
#include "base/macros.h"
-#include "net/base/linked_hash_map.h"
#include "net/quic/core/quic_blocked_writer_interface.h"
#include "net/quic/core/quic_connection.h"
#include "net/quic/core/quic_framer.h"
#include "net/quic/core/quic_packet_writer.h"
#include "net/quic/core/quic_packets.h"
#include "net/quic/core/quic_session.h"
+#include "net/quic/platform/api/quic_containers.h"
namespace net {
@@ -181,8 +181,8 @@ class QuicTimeWaitListManager : public QuicBlockedWriterInterface {
bool connection_rejected_statelessly;
};
- // linked_hash_map allows lookup by ConnectionId and traversal in add order.
- typedef linked_hash_map<QuicConnectionId, ConnectionIdData> ConnectionIdMap;
+ // QuicLinkedHashMap allows lookup by ConnectionId and traversal in add order.
+ typedef QuicLinkedHashMap<QuicConnectionId, ConnectionIdData> ConnectionIdMap;
ConnectionIdMap connection_id_map_;
// Pending public reset packets that need to be sent out to the client
diff --git a/chromium/net/tools/quic/quic_time_wait_list_manager_test.cc b/chromium/net/tools/quic/quic_time_wait_list_manager_test.cc
index a409ead8ca5..a870e3028f1 100644
--- a/chromium/net/tools/quic/quic_time_wait_list_manager_test.cc
+++ b/chromium/net/tools/quic/quic_time_wait_list_manager_test.cc
@@ -23,7 +23,7 @@
#include "net/tools/quic/quic_epoll_alarm_factory.h"
#include "net/tools/quic/quic_epoll_connection_helper.h"
#include "net/tools/quic/test_tools/mock_epoll_server.h"
-#include "net/tools/quic/test_tools/mock_quic_server_session_visitor.h"
+#include "net/tools/quic/test_tools/mock_quic_session_visitor.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
diff --git a/chromium/net/tools/quic/stateless_rejector_test.cc b/chromium/net/tools/quic/stateless_rejector_test.cc
index 23b6e3a53be..0076c13d7aa 100644
--- a/chromium/net/tools/quic/stateless_rejector_test.cc
+++ b/chromium/net/tools/quic/stateless_rejector_test.cc
@@ -74,10 +74,10 @@ std::vector<TestParams> GetTestParams() {
class StatelessRejectorTest : public ::testing::TestWithParam<TestParams> {
public:
StatelessRejectorTest()
- : proof_source_(CryptoTestUtils::ProofSourceForTesting()),
+ : proof_source_(crypto_test_utils::ProofSourceForTesting()),
config_(QuicCryptoServerConfig::TESTING,
QuicRandom::GetInstance(),
- CryptoTestUtils::ProofSourceForTesting()),
+ crypto_test_utils::ProofSourceForTesting()),
config_peer_(&config_),
compressed_certs_cache_(
QuicCompressedCertsCache::kQuicCompressedCertsCacheSize),
@@ -170,11 +170,9 @@ INSTANTIATE_TEST_CASE_P(Flags,
TEST_P(StatelessRejectorTest, InvalidChlo) {
// clang-format off
- const CryptoHandshakeMessage client_hello = CryptoTestUtils::Message(
- "CHLO",
- "PDMD", "X509",
- "COPT", "SREJ",
- nullptr);
+ const CryptoHandshakeMessage client_hello = crypto_test_utils::CreateCHLO(
+ {{"PDMD", "X509"},
+ {"COPT", "SREJ"}});
// clang-format on
rejector_->OnChlo(GetParam().version, kConnectionId,
kServerDesignateConnectionId, client_hello);
@@ -195,16 +193,14 @@ TEST_P(StatelessRejectorTest, InvalidChlo) {
TEST_P(StatelessRejectorTest, ValidChloWithoutSrejSupport) {
// clang-format off
- const CryptoHandshakeMessage client_hello = CryptoTestUtils::Message(
- "CHLO",
- "PDMD", "X509",
- "AEAD", "AESG",
- "KEXS", "C255",
- "PUBS", pubs_hex_.c_str(),
- "NONC", nonc_hex_.c_str(),
- "VER\0", ver_hex_.c_str(),
- "$padding", static_cast<int>(kClientHelloMinimumSize),
- nullptr);
+ const CryptoHandshakeMessage client_hello = crypto_test_utils::CreateCHLO(
+ {{"PDMD", "X509"},
+ {"AEAD", "AESG"},
+ {"KEXS", "C255"},
+ {"PUBS", pubs_hex_},
+ {"NONC", nonc_hex_},
+ {"VER\0", ver_hex_}},
+ kClientHelloMinimumSize);
// clang-format on
rejector_->OnChlo(GetParam().version, kConnectionId,
@@ -214,19 +210,17 @@ TEST_P(StatelessRejectorTest, ValidChloWithoutSrejSupport) {
TEST_P(StatelessRejectorTest, RejectChlo) {
// clang-format off
- const CryptoHandshakeMessage client_hello = CryptoTestUtils::Message(
- "CHLO",
- "PDMD", "X509",
- "AEAD", "AESG",
- "KEXS", "C255",
- "COPT", "SREJ",
- "SCID", scid_hex_.c_str(),
- "PUBS", pubs_hex_.c_str(),
- "NONC", nonc_hex_.c_str(),
- "#004b5453", stk_hex_.c_str(),
- "VER\0", ver_hex_.c_str(),
- "$padding", static_cast<int>(kClientHelloMinimumSize),
- nullptr);
+ const CryptoHandshakeMessage client_hello = crypto_test_utils::CreateCHLO(
+ {{"PDMD", "X509"},
+ {"AEAD", "AESG"},
+ {"KEXS", "C255"},
+ {"COPT", "SREJ"},
+ {"SCID", scid_hex_},
+ {"PUBS", pubs_hex_},
+ {"NONC", nonc_hex_},
+ {"#004b5453", stk_hex_},
+ {"VER\0", ver_hex_}},
+ kClientHelloMinimumSize);
// clang-format on
rejector_->OnChlo(GetParam().version, kConnectionId,
@@ -254,25 +248,23 @@ TEST_P(StatelessRejectorTest, RejectChlo) {
}
TEST_P(StatelessRejectorTest, AcceptChlo) {
- const uint64_t xlct = CryptoTestUtils::LeafCertHashForTesting();
+ const uint64_t xlct = crypto_test_utils::LeafCertHashForTesting();
const string xlct_hex =
"#" + QuicTextUtils::HexEncode(reinterpret_cast<const char*>(&xlct),
sizeof(xlct));
// clang-format off
- const CryptoHandshakeMessage client_hello = CryptoTestUtils::Message(
- "CHLO",
- "PDMD", "X509",
- "AEAD", "AESG",
- "KEXS", "C255",
- "COPT", "SREJ",
- "SCID", scid_hex_.c_str(),
- "PUBS", pubs_hex_.c_str(),
- "NONC", nonc_hex_.c_str(),
- "#004b5453", stk_hex_.c_str(),
- "VER\0", ver_hex_.c_str(),
- "XLCT", xlct_hex.c_str(),
- "$padding", static_cast<int>(kClientHelloMinimumSize),
- nullptr);
+ const CryptoHandshakeMessage client_hello = crypto_test_utils::CreateCHLO(
+ {{"PDMD", "X509"},
+ {"AEAD", "AESG"},
+ {"KEXS", "C255"},
+ {"COPT", "SREJ"},
+ {"SCID", scid_hex_},
+ {"PUBS", pubs_hex_},
+ {"NONC", nonc_hex_},
+ {"#004b5453", stk_hex_},
+ {"VER\0", ver_hex_},
+ {"XLCT", xlct_hex}},
+ kClientHelloMinimumSize);
// clang-format on
rejector_->OnChlo(GetParam().version, kConnectionId,
diff --git a/chromium/net/tools/quic/test_tools/limited_mtu_test_writer.h b/chromium/net/tools/quic/test_tools/limited_mtu_test_writer.h
index fb43471e137..3d2e2fd8f40 100644
--- a/chromium/net/tools/quic/test_tools/limited_mtu_test_writer.h
+++ b/chromium/net/tools/quic/test_tools/limited_mtu_test_writer.h
@@ -5,8 +5,6 @@
#ifndef NET_TOOLS_QUIC_TEST_TOOLS_LIMITED_MTU_TEST_WRITER_H_
#define NET_TOOLS_QUIC_TEST_TOOLS_LIMITED_MTU_TEST_WRITER_H_
-#include <stddef.h>
-
#include "base/macros.h"
#include "net/quic/core/quic_packets.h"
#include "net/tools/quic/quic_packet_writer_wrapper.h"
diff --git a/chromium/net/tools/quic/test_tools/mock_quic_server_session_visitor.cc b/chromium/net/tools/quic/test_tools/mock_quic_session_visitor.cc
index 46aac8d80e1..ea52f14ebf8 100644
--- a/chromium/net/tools/quic/test_tools/mock_quic_server_session_visitor.cc
+++ b/chromium/net/tools/quic/test_tools/mock_quic_session_visitor.cc
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "net/tools/quic/test_tools/mock_quic_server_session_visitor.h"
+#include "net/tools/quic/test_tools/mock_quic_session_visitor.h"
namespace net {
namespace test {
diff --git a/chromium/net/tools/quic/test_tools/mock_quic_server_session_visitor.h b/chromium/net/tools/quic/test_tools/mock_quic_session_visitor.h
index e141f63d49f..ee1a6c73dc7 100644
--- a/chromium/net/tools/quic/test_tools/mock_quic_server_session_visitor.h
+++ b/chromium/net/tools/quic/test_tools/mock_quic_session_visitor.h
@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef NET_TOOLS_QUIC_TEST_TOOLS_MOCK_QUIC_SERVER_SESSION_VISITOR_H_
-#define NET_TOOLS_QUIC_TEST_TOOLS_MOCK_QUIC_SERVER_SESSION_VISITOR_H_
+#ifndef NET_TOOLS_QUIC_TEST_TOOLS_MOCK_QUIC_SESSION_VISITOR_H_
+#define NET_TOOLS_QUIC_TEST_TOOLS_MOCK_QUIC_SESSION_VISITOR_H_
#include "base/macros.h"
#include "net/quic/core/quic_crypto_server_stream.h"
@@ -48,4 +48,4 @@ class MockQuicCryptoServerStreamHelper : public QuicCryptoServerStream::Helper {
} // namespace test
} // namespace net
-#endif // NET_TOOLS_QUIC_TEST_TOOLS_MOCK_QUIC_SERVER_SESSION_VISITOR_H_
+#endif // NET_TOOLS_QUIC_TEST_TOOLS_MOCK_QUIC_SESSION_VISITOR_H_
diff --git a/chromium/net/tools/quic/test_tools/mock_quic_time_wait_list_manager.h b/chromium/net/tools/quic/test_tools/mock_quic_time_wait_list_manager.h
index 574000823c0..a2d7fa6cee4 100644
--- a/chromium/net/tools/quic/test_tools/mock_quic_time_wait_list_manager.h
+++ b/chromium/net/tools/quic/test_tools/mock_quic_time_wait_list_manager.h
@@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-// Common utilities for Quic tests
-
#ifndef NET_TOOLS_QUIC_TEST_TOOLS_MOCK_QUIC_TIME_WAIT_LIST_MANAGER_H_
#define NET_TOOLS_QUIC_TEST_TOOLS_MOCK_QUIC_TIME_WAIT_LIST_MANAGER_H_
diff --git a/chromium/net/tools/quic/test_tools/quic_client_peer.h b/chromium/net/tools/quic/test_tools/quic_client_peer.h
index 711fb78c5a9..93201c0501d 100644
--- a/chromium/net/tools/quic/test_tools/quic_client_peer.h
+++ b/chromium/net/tools/quic/test_tools/quic_client_peer.h
@@ -9,12 +9,10 @@
namespace net {
+class QuicClient;
class QuicCryptoClientConfig;
class QuicPacketWriter;
-
-class QuicClient;
-
namespace test {
class QuicClientPeer {
diff --git a/chromium/net/tools/quic/test_tools/quic_dispatcher_peer.h b/chromium/net/tools/quic/test_tools/quic_dispatcher_peer.h
index a4a255e50f8..f035a5c1632 100644
--- a/chromium/net/tools/quic/test_tools/quic_dispatcher_peer.h
+++ b/chromium/net/tools/quic/test_tools/quic_dispatcher_peer.h
@@ -5,10 +5,8 @@
#ifndef NET_TOOLS_QUIC_TEST_TOOLS_QUIC_DISPATCHER_PEER_H_
#define NET_TOOLS_QUIC_TEST_TOOLS_QUIC_DISPATCHER_PEER_H_
-#include "net/tools/quic/quic_dispatcher.h"
-
#include "base/macros.h"
-#include "net/base/ip_endpoint.h"
+#include "net/tools/quic/quic_dispatcher.h"
namespace net {
diff --git a/chromium/net/tools/quic/test_tools/quic_server_peer.h b/chromium/net/tools/quic/test_tools/quic_server_peer.h
index 6aed20a6689..e3d5d1e4a3b 100644
--- a/chromium/net/tools/quic/test_tools/quic_server_peer.h
+++ b/chromium/net/tools/quic/test_tools/quic_server_peer.h
@@ -9,7 +9,6 @@
namespace net {
-
class QuicDispatcher;
class QuicServer;
class QuicPacketReader;
diff --git a/chromium/net/tools/quic/test_tools/quic_test_client.cc b/chromium/net/tools/quic/test_tools/quic_test_client.cc
index f844d4b49ed..56fe71247a3 100644
--- a/chromium/net/tools/quic/test_tools/quic_test_client.cc
+++ b/chromium/net/tools/quic/test_tools/quic_test_client.cc
@@ -8,19 +8,16 @@
#include <utility>
#include <vector>
-#include "base/memory/ptr_util.h"
-#include "base/time/time.h"
-#include "net/base/completion_callback.h"
-#include "net/base/net_errors.h"
-#include "net/cert/cert_verify_result.h"
-#include "net/cert/x509_certificate.h"
#include "net/quic/core/crypto/proof_verifier.h"
#include "net/quic/core/quic_flags.h"
#include "net/quic/core/quic_server_id.h"
#include "net/quic/core/quic_utils.h"
#include "net/quic/core/spdy_utils.h"
#include "net/quic/platform/api/quic_logging.h"
+#include "net/quic/platform/api/quic_ptr_util.h"
+#include "net/quic/platform/api/quic_stack_trace.h"
#include "net/quic/platform/api/quic_text_utils.h"
+#include "net/quic/platform/api/quic_url.h"
#include "net/quic/test_tools/crypto_test_utils.h"
#include "net/quic/test_tools/quic_connection_peer.h"
#include "net/quic/test_tools/quic_spdy_session_peer.h"
@@ -30,13 +27,9 @@
#include "net/tools/quic/quic_packet_writer_wrapper.h"
#include "net/tools/quic/quic_spdy_client_stream.h"
#include "net/tools/quic/test_tools/quic_client_peer.h"
-#include "url/gurl.h"
+#include "third_party/boringssl/src/include/openssl/x509.h"
using base::StringPiece;
-using net::QuicServerId;
-using net::test::QuicConnectionPeer;
-using net::test::QuicSpdySessionPeer;
-using net::test::QuicStreamPeer;
using std::string;
using testing::_;
using testing::Invoke;
@@ -101,9 +94,9 @@ class RecordingProofVerifier : public ProofVerifier {
QuicAsyncStatus VerifyCertChain(
const std::string& hostname,
const std::vector<std::string>& certs,
- const ProofVerifyContext* verify_context,
+ const ProofVerifyContext* context,
std::string* error_details,
- std::unique_ptr<ProofVerifyDetails>* verify_details,
+ std::unique_ptr<ProofVerifyDetails>* details,
std::unique_ptr<ProofVerifierCallback> callback) override {
return QUIC_SUCCESS;
}
@@ -156,7 +149,7 @@ MockableQuicClient::MockableQuicClient(
supported_versions,
config,
epoll_server,
- base::WrapUnique(
+ QuicWrapUnique(
new RecordingProofVerifier(std::move(proof_verifier)))),
override_connection_id_(0),
test_writer_(nullptr),
@@ -166,8 +159,9 @@ void MockableQuicClient::ProcessPacket(const QuicSocketAddress& self_address,
const QuicSocketAddress& peer_address,
const QuicReceivedPacket& packet) {
QuicClient::ProcessPacket(self_address, peer_address, packet);
- if (track_last_incoming_packet_)
+ if (track_last_incoming_packet_) {
last_incoming_packet_ = packet.Clone();
+ }
}
MockableQuicClient::~MockableQuicClient() {
@@ -359,10 +353,10 @@ ssize_t QuicTestClient::SendMessage(const SpdyHeaderBlock& headers,
// If we're not connected, try to find an sni hostname.
if (!connected()) {
- GURL url(SpdyUtils::GetUrlFromHeaderBlock(headers));
+ QuicUrl url(SpdyUtils::GetUrlFromHeaderBlock(headers));
if (override_sni_set_) {
- client_->set_server_id(QuicServerId(override_sni_, url.EffectiveIntPort(),
- PRIVACY_MODE_DISABLED));
+ client_->set_server_id(
+ QuicServerId(override_sni_, url.port(), PRIVACY_MODE_DISABLED));
}
}
@@ -547,7 +541,8 @@ bool QuicTestClient::WaitUntil(int timeout_ms, std::function<bool()> trigger) {
epoll_server()->set_timeout_in_us(old_timeout_us);
}
if (trigger && !trigger()) {
- VLOG(1) << "Client WaitUntil returning with trigger returning false.";
+ VLOG(1) << "Client WaitUntil returning with trigger returning false."
+ << QuicStackTrace();
return false;
}
return true;
diff --git a/chromium/net/tools/quic/test_tools/quic_test_client.h b/chromium/net/tools/quic/test_tools/quic_test_client.h
index f35003ccad5..9066b59f857 100644
--- a/chromium/net/tools/quic/test_tools/quic_test_client.h
+++ b/chromium/net/tools/quic/test_tools/quic_test_client.h
@@ -5,9 +5,6 @@
#ifndef NET_TOOLS_QUIC_TEST_TOOLS_QUIC_TEST_CLIENT_H_
#define NET_TOOLS_QUIC_TEST_TOOLS_QUIC_TEST_CLIENT_H_
-#include <stddef.h>
-#include <stdint.h>
-
#include <cstdint>
#include <memory>
#include <string>
@@ -17,7 +14,6 @@
#include "net/quic/core/quic_framer.h"
#include "net/quic/core/quic_packet_creator.h"
#include "net/quic/core/quic_packets.h"
-#include "net/tools/epoll_server/epoll_server.h"
#include "net/tools/quic/quic_client.h"
#include "testing/gmock/include/gmock/gmock.h"
@@ -26,14 +22,10 @@ using base::StringPiece;
namespace net {
class ProofVerifier;
-
-class ProofVerifier;
class QuicPacketWriterWrapper;
namespace test {
-class MockableQuicClient;
-
// A quic client which allows mocking out reads and writes.
class MockableQuicClient : public QuicClient {
public:
@@ -65,10 +57,6 @@ class MockableQuicClient : public QuicClient {
QuicConnectionId GenerateNewConnectionId() override;
void UseWriter(QuicPacketWriterWrapper* writer);
void UseConnectionId(QuicConnectionId connection_id);
- void SendCachedNetworkParamaters(
- const CachedNetworkParameters& cached_network_params) {
- cached_network_paramaters_ = cached_network_params;
- }
const QuicReceivedPacket* last_incoming_packet() {
return last_incoming_packet_.get();
}
@@ -251,8 +239,6 @@ class QuicTestClient : public QuicSpdyStream::Visitor,
allow_bidirectional_data_ = value;
}
- bool allow_bidirectional_data() const { return allow_bidirectional_data_; }
-
size_t num_requests() const { return num_requests_; }
size_t num_responses() const { return num_responses_; }
diff --git a/chromium/net/tools/quic/test_tools/quic_test_server.cc b/chromium/net/tools/quic/test_tools/quic_test_server.cc
index ae4f15b166f..95bf8d2c9e7 100644
--- a/chromium/net/tools/quic/test_tools/quic_test_server.cc
+++ b/chromium/net/tools/quic/test_tools/quic_test_server.cc
@@ -4,28 +4,15 @@
#include "net/tools/quic/test_tools/quic_test_server.h"
-#include "base/logging.h"
-#include "base/run_loop.h"
-#include "base/synchronization/lock.h"
-#include "base/threading/thread_task_runner_handle.h"
-#include "net/base/net_errors.h"
-#include "net/quic/chromium/quic_chromium_connection_helper.h"
-#include "net/quic/core/crypto/crypto_handshake.h"
-#include "net/quic/core/crypto/quic_crypto_server_config.h"
-#include "net/quic/core/crypto/quic_random.h"
-#include "net/quic/core/quic_config.h"
-#include "net/quic/core/quic_connection.h"
-#include "net/quic/core/quic_packet_writer.h"
-#include "net/quic/core/quic_packets.h"
#include "net/quic/platform/api/quic_ptr_util.h"
#include "net/tools/quic/quic_epoll_alarm_factory.h"
#include "net/tools/quic/quic_epoll_connection_helper.h"
#include "net/tools/quic/quic_simple_crypto_server_stream_helper.h"
#include "net/tools/quic/quic_simple_dispatcher.h"
#include "net/tools/quic/quic_simple_server_session.h"
-#include "net/tools/quic/quic_simple_server_stream.h"
namespace net {
+
namespace test {
class CustomStreamSession : public QuicSimpleServerSession {
@@ -220,4 +207,5 @@ void ImmediateGoAwaySession::OnStreamFrame(const QuicStreamFrame& frame) {
}
} // namespace test
+
} // namespace net
diff --git a/chromium/net/tools/quic/test_tools/quic_test_server.h b/chromium/net/tools/quic/test_tools/quic_test_server.h
index 26a8e766992..4679f6169cd 100644
--- a/chromium/net/tools/quic/test_tools/quic_test_server.h
+++ b/chromium/net/tools/quic/test_tools/quic_test_server.h
@@ -5,10 +5,6 @@
#ifndef NET_TOOLS_QUIC_TEST_TOOLS_QUIC_TEST_SERVER_H_
#define NET_TOOLS_QUIC_TEST_TOOLS_QUIC_TEST_SERVER_H_
-#include <memory>
-#include <string>
-
-#include "net/base/ip_endpoint.h"
#include "net/quic/core/quic_session.h"
#include "net/tools/quic/quic_dispatcher.h"
#include "net/tools/quic/quic_server.h"
@@ -17,7 +13,6 @@
namespace net {
-
namespace test {
// A test server which enables easy creation of custom QuicServerSessions
@@ -107,7 +102,6 @@ class ImmediateGoAwaySession : public QuicSimpleServerSession {
} // namespace test
-
} // namespace net
#endif // NET_TOOLS_QUIC_TEST_TOOLS_QUIC_TEST_SERVER_H_
diff --git a/chromium/net/tools/quic/test_tools/server_thread.cc b/chromium/net/tools/quic/test_tools/server_thread.cc
index a04311e944d..9afbdacc255 100644
--- a/chromium/net/tools/quic/test_tools/server_thread.cc
+++ b/chromium/net/tools/quic/test_tools/server_thread.cc
@@ -37,9 +37,8 @@ void ServerThread::Initialize() {
server_->CreateUDPSocketAndListen(address_);
- port_lock_.Acquire();
+ QuicWriterMutexLock lock(&port_lock_);
port_ = server_->port();
- port_lock_.Release();
initialized_ = true;
}
@@ -63,9 +62,8 @@ void ServerThread::Run() {
}
int ServerThread::GetPort() {
- port_lock_.Acquire();
+ QuicReaderMutexLock lock(&port_lock_);
int rc = port_;
- port_lock_.Release();
return rc;
}
diff --git a/chromium/net/tools/quic/test_tools/server_thread.h b/chromium/net/tools/quic/test_tools/server_thread.h
index 77f00736abb..1c20ccddc89 100644
--- a/chromium/net/tools/quic/test_tools/server_thread.h
+++ b/chromium/net/tools/quic/test_tools/server_thread.h
@@ -61,8 +61,8 @@ class ServerThread : public base::SimpleThread {
void MaybeNotifyOfHandshakeConfirmation();
void ExecuteScheduledActions();
- base::WaitableEvent confirmed_; // Notified when the first handshake is
- // confirmed.
+ base::WaitableEvent
+ confirmed_; // Notified when the first handshake is confirmed.
base::WaitableEvent pause_; // Notified when the server should pause.
base::WaitableEvent paused_; // Notitied when the server has paused
base::WaitableEvent resume_; // Notified when the server should resume.
@@ -70,8 +70,8 @@ class ServerThread : public base::SimpleThread {
std::unique_ptr<QuicServer> server_;
QuicSocketAddress address_;
- base::Lock port_lock_;
- int port_;
+ mutable QuicMutex port_lock_;
+ int port_ GUARDED_BY(port_lock_);
bool initialized_;