summaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorrtenneti@chromium.org <rtenneti@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-03-15 00:45:14 +0000
committerrtenneti@chromium.org <rtenneti@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-03-15 00:45:14 +0000
commite4c3ea63ddd3f174701664e61ac5a357e1bb3733 (patch)
treeb70f7929ae2fad757e3983197eff84e091132506 /net
parente9e8bc891c8bacc98147d763d4faf2c7f5a45fca (diff)
downloadchromium_src-e4c3ea63ddd3f174701664e61ac5a357e1bb3733.zip
chromium_src-e4c3ea63ddd3f174701664e61ac5a357e1bb3733.tar.gz
chromium_src-e4c3ea63ddd3f174701664e61ac5a357e1bb3733.tar.bz2
QUIC - use QuicSessionKey tuple (host, port, is_https) instead of
server_hostname, while creating QuicClientSession, QuicCryptoClientStream, QuicCryptoClientConfig, etc objects. QuicSessionKey is used as the key to access QUIC server config information from all caches (disk and memory caches). On Disk cache, the key for accessing QUIC server information is the flattened version (scheme://hostname:port) of QuicSession. scheme would be either http or https until we support other schemes. R=rch@chromium.org, wtc@chromium.org Review URL: https://codereview.chromium.org/192583004 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@257272 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net')
-rw-r--r--net/http/disk_cache_based_quic_server_info.cc9
-rw-r--r--net/http/disk_cache_based_quic_server_info.h5
-rw-r--r--net/http/disk_cache_based_quic_server_info_unittest.cc127
-rw-r--r--net/http/http_cache.cc5
-rw-r--r--net/quic/crypto/quic_crypto_client_config.cc18
-rw-r--r--net/quic/crypto/quic_crypto_client_config.h20
-rw-r--r--net/quic/crypto/quic_crypto_client_config_test.cc10
-rw-r--r--net/quic/crypto/quic_server_info.cc3
-rw-r--r--net/quic/crypto/quic_server_info.h14
-rw-r--r--net/quic/quic_client_session.cc9
-rw-r--r--net/quic/quic_client_session.h3
-rw-r--r--net/quic/quic_client_session_test.cc5
-rw-r--r--net/quic/quic_crypto_client_stream.cc12
-rw-r--r--net/quic/quic_crypto_client_stream.h7
-rw-r--r--net/quic/quic_crypto_client_stream_factory.h3
-rw-r--r--net/quic/quic_crypto_client_stream_test.cc13
-rw-r--r--net/quic/quic_crypto_server_stream_test.cc8
-rw-r--r--net/quic/quic_http_stream_test.cc7
-rw-r--r--net/quic/quic_session_key.cc6
-rw-r--r--net/quic/quic_session_key.h5
-rw-r--r--net/quic/quic_stream_factory.cc23
-rw-r--r--net/quic/quic_stream_factory.h2
-rw-r--r--net/quic/quic_stream_factory_test.cc30
-rw-r--r--net/quic/test_tools/crypto_test_utils.cc10
-rw-r--r--net/quic/test_tools/mock_crypto_client_stream.cc6
-rw-r--r--net/quic/test_tools/mock_crypto_client_stream.h4
-rw-r--r--net/quic/test_tools/mock_crypto_client_stream_factory.cc5
-rw-r--r--net/quic/test_tools/mock_crypto_client_stream_factory.h4
-rw-r--r--net/tools/quic/end_to_end_test.cc15
-rw-r--r--net/tools/quic/quic_client.cc11
-rw-r--r--net/tools/quic/quic_client.h17
-rw-r--r--net/tools/quic/quic_client_bin.cc14
-rw-r--r--net/tools/quic/quic_client_session.cc5
-rw-r--r--net/tools/quic/quic_client_session.h3
-rw-r--r--net/tools/quic/quic_client_session_test.cc6
-rw-r--r--net/tools/quic/quic_spdy_client_stream_test.cc4
-rw-r--r--net/tools/quic/test_tools/quic_test_client.cc39
-rw-r--r--net/tools/quic/test_tools/quic_test_client.h13
38 files changed, 340 insertions, 160 deletions
diff --git a/net/http/disk_cache_based_quic_server_info.cc b/net/http/disk_cache_based_quic_server_info.cc
index 91625bc..e985807 100644
--- a/net/http/disk_cache_based_quic_server_info.cc
+++ b/net/http/disk_cache_based_quic_server_info.cc
@@ -12,6 +12,7 @@
#include "net/base/net_errors.h"
#include "net/http/http_cache.h"
#include "net/http/http_network_session.h"
+#include "net/quic/quic_session_key.h"
namespace net {
@@ -43,9 +44,9 @@ struct DiskCacheBasedQuicServerInfo::CacheOperationDataShim {
};
DiskCacheBasedQuicServerInfo::DiskCacheBasedQuicServerInfo(
- const std::string& hostname,
+ const QuicSessionKey& server_key,
HttpCache* http_cache)
- : QuicServerInfo(hostname),
+ : QuicServerInfo(server_key),
weak_factory_(this),
data_shim_(new CacheOperationDataShim()),
io_callback_(
@@ -55,7 +56,7 @@ DiskCacheBasedQuicServerInfo::DiskCacheBasedQuicServerInfo(
state_(GET_BACKEND),
ready_(false),
found_entry_(false),
- hostname_(hostname),
+ server_key_(server_key),
http_cache_(http_cache),
backend_(NULL),
entry_(NULL) {
@@ -113,7 +114,7 @@ DiskCacheBasedQuicServerInfo::~DiskCacheBasedQuicServerInfo() {
}
std::string DiskCacheBasedQuicServerInfo::key() const {
- return "quicserverinfo:" + hostname_;
+ return "quicserverinfo:" + server_key_.ToString();
}
void DiskCacheBasedQuicServerInfo::OnIOComplete(CacheOperationDataShim* unused,
diff --git a/net/http/disk_cache_based_quic_server_info.h b/net/http/disk_cache_based_quic_server_info.h
index 7637931..a8c55690 100644
--- a/net/http/disk_cache_based_quic_server_info.h
+++ b/net/http/disk_cache_based_quic_server_info.h
@@ -18,6 +18,7 @@ namespace net {
class HttpCache;
class IOBuffer;
+class QuicSessionKey;
// DiskCacheBasedQuicServerInfo fetches information about a QUIC server from
// our standard disk cache. Since the information is defined to be
@@ -26,7 +27,7 @@ class NET_EXPORT_PRIVATE DiskCacheBasedQuicServerInfo
: public QuicServerInfo,
public NON_EXPORTED_BASE(base::NonThreadSafe) {
public:
- DiskCacheBasedQuicServerInfo(const std::string& hostname,
+ DiskCacheBasedQuicServerInfo(const QuicSessionKey& server_key,
HttpCache* http_cache);
// QuicServerInfo implementation.
@@ -89,7 +90,7 @@ class NET_EXPORT_PRIVATE DiskCacheBasedQuicServerInfo
bool ready_;
bool found_entry_; // Controls the behavior of DoCreateOrOpen.
std::string new_data_;
- const std::string hostname_;
+ const QuicSessionKey server_key_;
HttpCache* const http_cache_;
disk_cache::Backend* backend_;
disk_cache::Entry* entry_;
diff --git a/net/http/disk_cache_based_quic_server_info_unittest.cc b/net/http/disk_cache_based_quic_server_info_unittest.cc
index 4e4591f..4de10a5 100644
--- a/net/http/disk_cache_based_quic_server_info_unittest.cc
+++ b/net/http/disk_cache_based_quic_server_info_unittest.cc
@@ -11,13 +11,29 @@
#include "net/base/net_errors.h"
#include "net/http/mock_http_cache.h"
#include "net/quic/crypto/quic_server_info.h"
+#include "net/quic/quic_session_key.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace {
// This is an empty transaction, needed to register the URL and the test mode.
-const MockTransaction kHostInfoTransaction = {
- "quicserverinfo:https://www.google.com",
+const MockTransaction kHostInfoTransaction1 = {
+ "quicserverinfo:https://www.google.com:443",
+ "",
+ base::Time(),
+ "",
+ net::LOAD_NORMAL,
+ "",
+ "",
+ base::Time(),
+ "",
+ TEST_MODE_NORMAL,
+ NULL,
+ 0
+};
+
+const MockTransaction kHostInfoTransaction2 = {
+ "quicserverinfo:http://www.google.com:80",
"",
base::Time(),
"",
@@ -38,9 +54,9 @@ TEST(DiskCacheBasedQuicServerInfo, DeleteInCallback) {
// of quic_server_info->WaitForDataReady(), so that the callback will run.
MockBlockingBackendFactory* factory = new MockBlockingBackendFactory();
MockHttpCache cache(factory);
+ net::QuicSessionKey server_key("www.verisign.com", 443, true);
scoped_ptr<net::QuicServerInfo> quic_server_info(
- new net::DiskCacheBasedQuicServerInfo("https://www.verisign.com",
- cache.http_cache()));
+ new net::DiskCacheBasedQuicServerInfo(server_key, cache.http_cache()));
quic_server_info->Start();
net::TestCompletionCallback callback;
int rv = quic_server_info->WaitForDataReady(callback.callback());
@@ -53,12 +69,12 @@ TEST(DiskCacheBasedQuicServerInfo, DeleteInCallback) {
// Tests the basic logic of storing, retrieving and updating data.
TEST(DiskCacheBasedQuicServerInfo, Update) {
MockHttpCache cache;
- AddMockTransaction(&kHostInfoTransaction);
+ AddMockTransaction(&kHostInfoTransaction1);
net::TestCompletionCallback callback;
+ net::QuicSessionKey server_key("www.google.com", 443, true);
scoped_ptr<net::QuicServerInfo> quic_server_info(
- new net::DiskCacheBasedQuicServerInfo("https://www.google.com",
- cache.http_cache()));
+ new net::DiskCacheBasedQuicServerInfo(server_key, cache.http_cache()));
quic_server_info->Start();
int rv = quic_server_info->WaitForDataReady(callback.callback());
EXPECT_EQ(net::OK, callback.GetResult(rv));
@@ -82,8 +98,7 @@ TEST(DiskCacheBasedQuicServerInfo, Update) {
// Open the stored QuicServerInfo.
quic_server_info.reset(
- new net::DiskCacheBasedQuicServerInfo("https://www.google.com",
- cache.http_cache()));
+ new net::DiskCacheBasedQuicServerInfo(server_key, cache.http_cache()));
quic_server_info->Start();
rv = quic_server_info->WaitForDataReady(callback.callback());
EXPECT_EQ(net::OK, callback.GetResult(rv));
@@ -99,8 +114,7 @@ TEST(DiskCacheBasedQuicServerInfo, Update) {
// Verify that the state was updated.
quic_server_info.reset(
- new net::DiskCacheBasedQuicServerInfo("https://www.google.com",
- cache.http_cache()));
+ new net::DiskCacheBasedQuicServerInfo(server_key, cache.http_cache()));
quic_server_info->Start();
rv = quic_server_info->WaitForDataReady(callback.callback());
EXPECT_EQ(net::OK, callback.GetResult(rv));
@@ -114,7 +128,96 @@ TEST(DiskCacheBasedQuicServerInfo, Update) {
EXPECT_EQ(cert_a, state1.certs[0]);
EXPECT_EQ(cert_b, state1.certs[1]);
- RemoveMockTransaction(&kHostInfoTransaction);
+ RemoveMockTransaction(&kHostInfoTransaction1);
+}
+
+// Test that demonstrates different info is returned when the ports differ.
+TEST(DiskCacheBasedQuicServerInfo, UpdateDifferentPorts) {
+ MockHttpCache cache;
+ AddMockTransaction(&kHostInfoTransaction1);
+ AddMockTransaction(&kHostInfoTransaction2);
+ net::TestCompletionCallback callback;
+
+ // Persist data for port 443.
+ net::QuicSessionKey server_key1("www.google.com", 443, true);
+ scoped_ptr<net::QuicServerInfo> quic_server_info1(
+ new net::DiskCacheBasedQuicServerInfo(server_key1, cache.http_cache()));
+ quic_server_info1->Start();
+ int rv = quic_server_info1->WaitForDataReady(callback.callback());
+ EXPECT_EQ(net::OK, callback.GetResult(rv));
+
+ net::QuicServerInfo::State* state1 = quic_server_info1->mutable_state();
+ EXPECT_TRUE(state1->certs.empty());
+ const string server_config_a = "server_config_a";
+ const string source_address_token_a = "source_address_token_a";
+ const string server_config_sig_a = "server_config_sig_a";
+ const string cert_a = "cert_a";
+
+ state1->server_config = server_config_a;
+ state1->source_address_token = source_address_token_a;
+ state1->server_config_sig = server_config_sig_a;
+ state1->certs.push_back(cert_a);
+ quic_server_info1->Persist();
+
+ // Wait until Persist() does the work.
+ base::MessageLoop::current()->RunUntilIdle();
+
+ // Persist data for port 80.
+ net::QuicSessionKey server_key2("www.google.com", 80, false);
+ scoped_ptr<net::QuicServerInfo> quic_server_info2(
+ new net::DiskCacheBasedQuicServerInfo(server_key2, cache.http_cache()));
+ quic_server_info2->Start();
+ rv = quic_server_info2->WaitForDataReady(callback.callback());
+ EXPECT_EQ(net::OK, callback.GetResult(rv));
+
+ net::QuicServerInfo::State* state2 = quic_server_info2->mutable_state();
+ EXPECT_TRUE(state2->certs.empty());
+ const string server_config_b = "server_config_b";
+ const string source_address_token_b = "source_address_token_b";
+ const string server_config_sig_b = "server_config_sig_b";
+ const string cert_b = "cert_b";
+
+ state2->server_config = server_config_b;
+ state2->source_address_token = source_address_token_b;
+ state2->server_config_sig = server_config_sig_b;
+ state2->certs.push_back(cert_b);
+ quic_server_info2->Persist();
+
+ // Wait until Persist() does the work.
+ base::MessageLoop::current()->RunUntilIdle();
+
+ // Verify the stored QuicServerInfo for port 443.
+ scoped_ptr<net::QuicServerInfo> quic_server_info(
+ new net::DiskCacheBasedQuicServerInfo(server_key1, cache.http_cache()));
+ quic_server_info->Start();
+ rv = quic_server_info->WaitForDataReady(callback.callback());
+ EXPECT_EQ(net::OK, callback.GetResult(rv));
+
+ const net::QuicServerInfo::State& state_a = quic_server_info->state();
+ EXPECT_TRUE(quic_server_info->IsDataReady());
+ EXPECT_EQ(server_config_a, state_a.server_config);
+ EXPECT_EQ(source_address_token_a, state_a.source_address_token);
+ EXPECT_EQ(server_config_sig_a, state_a.server_config_sig);
+ EXPECT_EQ(1U, state_a.certs.size());
+ EXPECT_EQ(cert_a, state_a.certs[0]);
+
+ // Verify the stored QuicServerInfo for port 80.
+ quic_server_info.reset(
+ new net::DiskCacheBasedQuicServerInfo(server_key2, cache.http_cache()));
+ quic_server_info->Start();
+ rv = quic_server_info->WaitForDataReady(callback.callback());
+ EXPECT_EQ(net::OK, callback.GetResult(rv));
+
+ const net::QuicServerInfo::State& state_b = quic_server_info->state();
+ EXPECT_TRUE(quic_server_info->IsDataReady());
+ EXPECT_EQ(server_config_b, state_b.server_config);
+ EXPECT_EQ(source_address_token_b, state_b.source_address_token);
+ EXPECT_EQ(server_config_sig_b, state_b.server_config_sig);
+ EXPECT_EQ(1U, state_b.certs.size());
+ EXPECT_EQ(cert_b, state_b.certs[0]);
+
+ RemoveMockTransaction(&kHostInfoTransaction2);
+ RemoveMockTransaction(&kHostInfoTransaction1);
}
} // namespace
diff --git a/net/http/http_cache.cc b/net/http/http_cache.cc
index e4319e1..c040aa9 100644
--- a/net/http/http_cache.cc
+++ b/net/http/http_cache.cc
@@ -275,8 +275,9 @@ class HttpCache::QuicServerInfoFactoryAdaptor : public QuicServerInfoFactory {
: http_cache_(http_cache) {
}
- virtual QuicServerInfo* GetForHost(const std::string& hostname) OVERRIDE {
- return new DiskCacheBasedQuicServerInfo(hostname, http_cache_);
+ virtual QuicServerInfo* GetForServer(
+ const QuicSessionKey& server_key) OVERRIDE {
+ return new DiskCacheBasedQuicServerInfo(server_key, http_cache_);
}
private:
diff --git a/net/quic/crypto/quic_crypto_client_config.cc b/net/quic/crypto/quic_crypto_client_config.cc
index 3b075868..0fa78a4 100644
--- a/net/quic/crypto/quic_crypto_client_config.cc
+++ b/net/quic/crypto/quic_crypto_client_config.cc
@@ -15,6 +15,7 @@
#include "net/quic/crypto/p256_key_exchange.h"
#include "net/quic/crypto/proof_verifier.h"
#include "net/quic/crypto/quic_encrypter.h"
+#include "net/quic/quic_session_key.h"
#include "net/quic/quic_utils.h"
#if defined(OS_WIN)
@@ -22,6 +23,7 @@
#endif
using base::StringPiece;
+using std::make_pair;
using std::map;
using std::string;
using std::vector;
@@ -253,15 +255,15 @@ void QuicCryptoClientConfig::SetDefaults() {
}
QuicCryptoClientConfig::CachedState* QuicCryptoClientConfig::LookupOrCreate(
- const string& server_hostname) {
- map<string, CachedState*>::const_iterator it =
- cached_states_.find(server_hostname);
+ const QuicSessionKey& server_key) {
+ map<QuicSessionKey, CachedState*>::const_iterator it =
+ cached_states_.find(server_key);
if (it != cached_states_.end()) {
return it->second;
}
CachedState* cached = new CachedState;
- cached_states_.insert(make_pair(server_hostname, cached));
+ cached_states_.insert(make_pair(server_key, cached));
return cached;
}
@@ -666,15 +668,15 @@ void QuicCryptoClientConfig::SetChannelIDSigner(ChannelIDSigner* signer) {
}
void QuicCryptoClientConfig::InitializeFrom(
- const std::string& server_hostname,
- const std::string& canonical_server_hostname,
+ const QuicSessionKey& server_key,
+ const QuicSessionKey& canonical_server_key,
QuicCryptoClientConfig* canonical_crypto_config) {
CachedState* canonical_cached =
- canonical_crypto_config->LookupOrCreate(canonical_server_hostname);
+ canonical_crypto_config->LookupOrCreate(canonical_server_key);
if (!canonical_cached->proof_valid()) {
return;
}
- CachedState* cached = LookupOrCreate(server_hostname);
+ CachedState* cached = LookupOrCreate(server_key);
cached->InitializeFrom(*canonical_cached);
}
diff --git a/net/quic/crypto/quic_crypto_client_config.h b/net/quic/crypto/quic_crypto_client_config.h
index f29157c..f2e8649 100644
--- a/net/quic/crypto/quic_crypto_client_config.h
+++ b/net/quic/crypto/quic_crypto_client_config.h
@@ -22,6 +22,7 @@ class CryptoHandshakeMessage;
class ProofVerifier;
class ProofVerifyDetails;
class QuicRandom;
+class QuicSessionKey;
// QuicCryptoClientConfig contains crypto-related configuration settings for a
// client. Note that this object isn't thread-safe. It's designed to be used on
@@ -131,9 +132,9 @@ class NET_EXPORT_PRIVATE QuicCryptoClientConfig : public QuicCryptoConfig {
// Sets the members to reasonable, default values.
void SetDefaults();
- // LookupOrCreate returns a CachedState for the given hostname. If no such
+ // LookupOrCreate returns a CachedState for the given |server_key|. If no such
// CachedState currently exists, it will be created and cached.
- CachedState* LookupOrCreate(const std::string& server_hostname);
+ CachedState* LookupOrCreate(const QuicSessionKey& server_key);
// FillInchoateClientHello sets |out| to be a CHLO message that elicits a
// source-address token or SCFG from a server. If |cached| is non-NULL, the
@@ -211,17 +212,16 @@ class NET_EXPORT_PRIVATE QuicCryptoClientConfig : public QuicCryptoConfig {
void SetChannelIDSigner(ChannelIDSigner* signer);
// Initialize the CachedState from |canonical_crypto_config| for the
- // |canonical_server_hostname| as the initial CachedState for
- // |server_hostname|. We will copy config data only if
- // |canonical_crypto_config| has valid proof.
- void InitializeFrom(const std::string& server_hostname,
- const std::string& canonical_server_hostname,
+ // |canonical_server_key| as the initial CachedState for |server_key|. We will
+ // copy config data only if |canonical_crypto_config| has valid proof.
+ void InitializeFrom(const QuicSessionKey& server_key,
+ const QuicSessionKey& canonical_server_key,
QuicCryptoClientConfig* canonical_crypto_config);
private:
- // cached_states_ maps from the server hostname to the cached information
- // about that server.
- std::map<std::string, CachedState*> cached_states_;
+ // cached_states_ maps from the server_key to the cached information about
+ // that server.
+ std::map<QuicSessionKey, CachedState*> cached_states_;
scoped_ptr<ProofVerifier> proof_verifier_;
scoped_ptr<ChannelIDSigner> channel_id_signer_;
diff --git a/net/quic/crypto/quic_crypto_client_config_test.cc b/net/quic/crypto/quic_crypto_client_config_test.cc
index 12996fb..d151e0c 100644
--- a/net/quic/crypto/quic_crypto_client_config_test.cc
+++ b/net/quic/crypto/quic_crypto_client_config_test.cc
@@ -5,6 +5,7 @@
#include "net/quic/crypto/quic_crypto_client_config.h"
#include "net/quic/crypto/proof_verifier.h"
+#include "net/quic/quic_session_key.h"
#include "net/quic/test_tools/quic_test_utils.h"
#include "testing/gtest/include/gtest/gtest.h"
@@ -90,15 +91,16 @@ TEST(QuicCryptoClientConfigTest, ProcessServerDowngradeAttack) {
TEST(QuicCryptoClientConfigTest, InitializeFrom) {
QuicCryptoClientConfig config;
+ QuicSessionKey canonical_key1("www.google.com", 80, false);
QuicCryptoClientConfig::CachedState* state =
- config.LookupOrCreate("www.google.com");
+ config.LookupOrCreate(canonical_key1);
// TODO(rch): Populate other fields of |state|.
state->set_source_address_token("TOKEN");
state->SetProofValid();
- config.InitializeFrom("mail.google.com", "www.google.com", &config);
- QuicCryptoClientConfig::CachedState* other =
- config.LookupOrCreate("mail.google.com");
+ QuicSessionKey other_key("mail.google.com", 80, false);
+ config.InitializeFrom(other_key, canonical_key1, &config);
+ QuicCryptoClientConfig::CachedState* other = config.LookupOrCreate(other_key);
EXPECT_EQ(state->server_config(), other->server_config());
EXPECT_EQ(state->source_address_token(), other->source_address_token());
diff --git a/net/quic/crypto/quic_server_info.cc b/net/quic/crypto/quic_server_info.cc
index 6093008..ab2a062 100644
--- a/net/quic/crypto/quic_server_info.cc
+++ b/net/quic/crypto/quic_server_info.cc
@@ -29,7 +29,8 @@ void QuicServerInfo::State::Clear() {
certs.clear();
}
-QuicServerInfo::QuicServerInfo(const string& hostname) : hostname_(hostname) {
+QuicServerInfo::QuicServerInfo(const QuicSessionKey& server_key)
+ : server_key_(server_key) {
}
QuicServerInfo::~QuicServerInfo() {
diff --git a/net/quic/crypto/quic_server_info.h b/net/quic/crypto/quic_server_info.h
index 853504a..51533ec 100644
--- a/net/quic/crypto/quic_server_info.h
+++ b/net/quic/crypto/quic_server_info.h
@@ -13,6 +13,7 @@
#include "base/time/time.h"
#include "net/base/completion_callback.h"
#include "net/base/net_export.h"
+#include "net/quic/quic_session_key.h"
namespace net {
@@ -24,7 +25,7 @@ class X509Certificate;
// crypto config.
class NET_EXPORT_PRIVATE QuicServerInfo {
public:
- QuicServerInfo(const std::string& hostname);
+ QuicServerInfo(const QuicSessionKey& server_key);
virtual ~QuicServerInfo();
// Start will commence the lookup. This must be called before any other
@@ -92,17 +93,18 @@ class NET_EXPORT_PRIVATE QuicServerInfo {
// SerializeInner is a helper function for Serialize.
std::string SerializeInner() const;
- // This is the QUIC server hostname for which we restore the crypto_config.
- const std::string hostname_;
+ // This is the QUIC server (hostname, port, is_https) tuple for which we
+ // restore the crypto_config.
+ const QuicSessionKey server_key_;
};
class QuicServerInfoFactory {
public:
virtual ~QuicServerInfoFactory();
- // GetForHost returns a fresh, allocated QuicServerInfo for the given
- // hostname or NULL on failure.
- virtual QuicServerInfo* GetForHost(const std::string& hostname) = 0;
+ // GetForServer returns a fresh, allocated QuicServerInfo for the given
+ // |server_key| or NULL on failure.
+ virtual QuicServerInfo* GetForServer(const QuicSessionKey& server_key) = 0;
};
} // namespace net
diff --git a/net/quic/quic_client_session.cc b/net/quic/quic_client_session.cc
index a65324e..d80e97f 100644
--- a/net/quic/quic_client_session.cc
+++ b/net/quic/quic_client_session.cc
@@ -17,6 +17,7 @@
#include "net/quic/quic_connection_helper.h"
#include "net/quic/quic_crypto_client_stream_factory.h"
#include "net/quic/quic_default_packet_writer.h"
+#include "net/quic/quic_session_key.h"
#include "net/quic/quic_stream_factory.h"
#include "net/ssl/ssl_info.h"
#include "net/udp/datagram_client_socket.h"
@@ -88,7 +89,7 @@ QuicClientSession::QuicClientSession(
QuicStreamFactory* stream_factory,
scoped_ptr<QuicServerInfo> server_info,
QuicCryptoClientStreamFactory* crypto_client_stream_factory,
- const string& server_hostname,
+ const QuicSessionKey& server_key,
const QuicConfig& config,
QuicCryptoClientConfig* crypto_config,
NetLog* net_log)
@@ -107,8 +108,8 @@ QuicClientSession::QuicClientSession(
crypto_stream_.reset(
crypto_client_stream_factory ?
crypto_client_stream_factory->CreateQuicCryptoClientStream(
- server_hostname, this, crypto_config) :
- new QuicCryptoClientStream(server_hostname, this, crypto_config));
+ server_key, this, crypto_config) :
+ new QuicCryptoClientStream(server_key, this, crypto_config));
crypto_stream_->SetQuicServerInfo(server_info.Pass());
@@ -116,7 +117,7 @@ QuicClientSession::QuicClientSession(
// TODO(rch): pass in full host port proxy pair
net_log_.BeginEvent(
NetLog::TYPE_QUIC_SESSION,
- NetLog::StringCallback("host", &server_hostname));
+ NetLog::StringCallback("host", &server_key.host()));
}
QuicClientSession::~QuicClientSession() {
diff --git a/net/quic/quic_client_session.h b/net/quic/quic_client_session.h
index f56a9b6..2b2ffd2 100644
--- a/net/quic/quic_client_session.h
+++ b/net/quic/quic_client_session.h
@@ -29,6 +29,7 @@ class DatagramClientSocket;
class QuicConnectionHelper;
class QuicCryptoClientStreamFactory;
class QuicDefaultPacketWriter;
+class QuicSessionKey;
class QuicStreamFactory;
class SSLInfo;
@@ -92,7 +93,7 @@ class NET_EXPORT_PRIVATE QuicClientSession : public QuicSession {
QuicStreamFactory* stream_factory,
scoped_ptr<QuicServerInfo> server_info,
QuicCryptoClientStreamFactory* crypto_client_stream_factory,
- const std::string& server_hostname,
+ const QuicSessionKey& server_key,
const QuicConfig& config,
QuicCryptoClientConfig* crypto_config,
NetLog* net_log);
diff --git a/net/quic/quic_client_session_test.cc b/net/quic/quic_client_session_test.cc
index ba8ba97..758a174 100644
--- a/net/quic/quic_client_session_test.cc
+++ b/net/quic/quic_client_session_test.cc
@@ -28,6 +28,7 @@ namespace test {
namespace {
const char kServerHostname[] = "www.example.com";
+const uint16 kServerPort = 80;
class TestPacketWriter : public QuicDefaultPacketWriter {
public:
@@ -69,8 +70,8 @@ class QuicClientSessionTest : public ::testing::TestWithParam<QuicVersion> {
new PacketSavingConnection(false, SupportedVersions(GetParam()))),
session_(connection_, GetSocket().Pass(), writer_.Pass(), NULL,
make_scoped_ptr((QuicServerInfo*)NULL), NULL,
- kServerHostname, DefaultQuicConfig(), &crypto_config_,
- &net_log_) {
+ QuicSessionKey(kServerHostname, kServerPort, false),
+ DefaultQuicConfig(), &crypto_config_, &net_log_) {
session_.config()->SetDefaults();
crypto_config_.SetDefaults();
}
diff --git a/net/quic/quic_crypto_client_stream.cc b/net/quic/quic_crypto_client_stream.cc
index 5afa482..307a3aa 100644
--- a/net/quic/quic_crypto_client_stream.cc
+++ b/net/quic/quic_crypto_client_stream.cc
@@ -66,14 +66,14 @@ void QuicCryptoClientStream::ProofVerifierCallbackImpl::Cancel() {
}
QuicCryptoClientStream::QuicCryptoClientStream(
- const string& server_hostname,
+ const QuicSessionKey& server_key,
QuicSession* session,
QuicCryptoClientConfig* crypto_config)
: QuicCryptoStream(session),
next_state_(STATE_IDLE),
num_client_hellos_(0),
crypto_config_(crypto_config),
- server_hostname_(server_hostname),
+ server_key_(server_key),
generation_counter_(0),
proof_verify_callback_(NULL),
disk_cache_load_result_(ERR_UNEXPECTED),
@@ -152,7 +152,7 @@ void QuicCryptoClientStream::DoHandshakeLoop(
QuicErrorCode error;
string error_details;
QuicCryptoClientConfig::CachedState* cached =
- crypto_config_->LookupOrCreate(server_hostname_);
+ crypto_config_->LookupOrCreate(server_key_);
if (in != NULL) {
DVLOG(1) << "Client: Received " << in->DebugString();
@@ -183,7 +183,7 @@ void QuicCryptoClientStream::DoHandshakeLoop(
if (!cached->IsComplete(session()->connection()->clock()->WallNow())) {
crypto_config_->FillInchoateClientHello(
- server_hostname_,
+ server_key_.host(),
session()->connection()->supported_versions().front(),
cached, &crypto_negotiated_params_, &out);
// Pad the inchoate client hello to fill up a packet.
@@ -209,7 +209,7 @@ void QuicCryptoClientStream::DoHandshakeLoop(
}
session()->config()->ToHandshakeMessage(&out);
error = crypto_config_->FillClientHello(
- server_hostname_,
+ server_key_.host(),
session()->connection()->connection_id(),
session()->connection()->supported_versions().front(),
cached,
@@ -297,7 +297,7 @@ void QuicCryptoClientStream::DoHandshakeLoop(
verify_ok_ = false;
ProofVerifier::Status status = verifier->VerifyProof(
- server_hostname_,
+ server_key_.host(),
cached->server_config(),
cached->certs(),
cached->signature(),
diff --git a/net/quic/quic_crypto_client_stream.h b/net/quic/quic_crypto_client_stream.h
index 1f4c98b..a988556 100644
--- a/net/quic/quic_crypto_client_stream.h
+++ b/net/quic/quic_crypto_client_stream.h
@@ -15,6 +15,7 @@
#include "net/quic/crypto/quic_crypto_client_config.h"
#include "net/quic/quic_config.h"
#include "net/quic/quic_crypto_stream.h"
+#include "net/quic/quic_session_key.h"
namespace net {
@@ -28,7 +29,7 @@ class CryptoTestUtils;
class NET_EXPORT_PRIVATE QuicCryptoClientStream : public QuicCryptoStream {
public:
- QuicCryptoClientStream(const string& server_hostname,
+ QuicCryptoClientStream(const QuicSessionKey& server_key,
QuicSession* session,
QuicCryptoClientConfig* crypto_config);
virtual ~QuicCryptoClientStream();
@@ -118,8 +119,8 @@ class NET_EXPORT_PRIVATE QuicCryptoClientStream : public QuicCryptoStream {
// Client's connection nonce (4-byte timestamp + 28 random bytes)
std::string nonce_;
- // Server's hostname
- std::string server_hostname_;
+ // Server's (hostname, port, is_https) tuple.
+ const QuicSessionKey server_key_;
// Generation counter from QuicCryptoClientConfig's CachedState.
uint64 generation_counter_;
diff --git a/net/quic/quic_crypto_client_stream_factory.h b/net/quic/quic_crypto_client_stream_factory.h
index 4fa5f57..6b18bec 100644
--- a/net/quic/quic_crypto_client_stream_factory.h
+++ b/net/quic/quic_crypto_client_stream_factory.h
@@ -13,6 +13,7 @@ namespace net {
class QuicCryptoClientStream;
class QuicSession;
+class QuicSessionKey;
// An interface used to instantiate QuicCryptoClientStream objects. Used to
// facilitate testing code with mock implementations.
@@ -21,7 +22,7 @@ class NET_EXPORT QuicCryptoClientStreamFactory {
virtual ~QuicCryptoClientStreamFactory() {}
virtual QuicCryptoClientStream* CreateQuicCryptoClientStream(
- const string& server_hostname,
+ const QuicSessionKey& server_key,
QuicSession* session,
QuicCryptoClientConfig* crypto_config) = 0;
};
diff --git a/net/quic/quic_crypto_client_stream_test.cc b/net/quic/quic_crypto_client_stream_test.cc
index 8154d17..eb62a13 100644
--- a/net/quic/quic_crypto_client_stream_test.cc
+++ b/net/quic/quic_crypto_client_stream_test.cc
@@ -9,6 +9,7 @@
#include "net/quic/crypto/quic_decrypter.h"
#include "net/quic/crypto/quic_encrypter.h"
#include "net/quic/quic_protocol.h"
+#include "net/quic/quic_session_key.h"
#include "net/quic/test_tools/crypto_test_utils.h"
#include "net/quic/test_tools/quic_test_utils.h"
#include "net/quic/test_tools/simple_quic_framer.h"
@@ -20,14 +21,16 @@ namespace test {
namespace {
const char kServerHostname[] = "example.com";
+const uint16 kServerPort = 80;
class QuicCryptoClientStreamTest : public ::testing::Test {
public:
QuicCryptoClientStreamTest()
: connection_(new PacketSavingConnection(false)),
session_(new TestSession(connection_, DefaultQuicConfig())),
- stream_(new QuicCryptoClientStream(kServerHostname, session_.get(),
- &crypto_config_)) {
+ server_key_(kServerHostname, kServerPort, false),
+ stream_(new QuicCryptoClientStream(
+ server_key_, session_.get(), &crypto_config_)) {
session_->SetCryptoStream(stream_.get());
crypto_config_.SetDefaults();
}
@@ -44,6 +47,7 @@ class QuicCryptoClientStreamTest : public ::testing::Test {
PacketSavingConnection* connection_;
scoped_ptr<TestSession> session_;
+ QuicSessionKey server_key_;
scoped_ptr<QuicCryptoClientStream> stream_;
CryptoHandshakeMessage message_;
scoped_ptr<QuicData> message_data_;
@@ -101,7 +105,8 @@ TEST_F(QuicCryptoClientStreamTest, NegotiatedParameters) {
}
TEST_F(QuicCryptoClientStreamTest, InvalidHostname) {
- stream_.reset(new QuicCryptoClientStream("invalid", session_.get(),
+ QuicSessionKey server_key("invalid", 80, false);
+ stream_.reset(new QuicCryptoClientStream(server_key, session_.get(),
&crypto_config_));
session_->SetCryptoStream(stream_.get());
@@ -116,7 +121,7 @@ TEST_F(QuicCryptoClientStreamTest, ExpiredServerConfig) {
connection_ = new PacketSavingConnection(true);
session_.reset(new TestSession(connection_, DefaultQuicConfig()));
- stream_.reset(new QuicCryptoClientStream(kServerHostname, session_.get(),
+ stream_.reset(new QuicCryptoClientStream(server_key_, session_.get(),
&crypto_config_));
session_->SetCryptoStream(stream_.get());
diff --git a/net/quic/quic_crypto_server_stream_test.cc b/net/quic/quic_crypto_server_stream_test.cc
index b8d21f2..63b1cf5 100644
--- a/net/quic/quic_crypto_server_stream_test.cc
+++ b/net/quic/quic_crypto_server_stream_test.cc
@@ -49,6 +49,9 @@ class QuicCryptoServerConfigPeer {
namespace {
+const char kServerHostname[] = "test.example.com";
+const uint16 kServerPort = 80;
+
class QuicCryptoServerStreamTest : public ::testing::TestWithParam<bool> {
public:
QuicCryptoServerStreamTest()
@@ -142,8 +145,9 @@ TEST_P(QuicCryptoServerStreamTest, ZeroRTT) {
QuicCryptoClientConfig client_crypto_config;
client_crypto_config.SetDefaults();
+ QuicSessionKey server_key(kServerHostname, kServerPort, false);
scoped_ptr<QuicCryptoClientStream> client(new QuicCryptoClientStream(
- "test.example.com", client_session.get(), &client_crypto_config));
+ server_key, client_session.get(), &client_crypto_config));
client_session->SetCryptoStream(client.get());
// Do a first handshake in order to prime the client config with the server's
@@ -176,7 +180,7 @@ TEST_P(QuicCryptoServerStreamTest, ZeroRTT) {
client_session.reset(new TestSession(client_conn, client_config));
server_session.reset(new TestSession(server_conn, config_));
client.reset(new QuicCryptoClientStream(
- "test.example.com", client_session.get(), &client_crypto_config));
+ server_key, client_session.get(), &client_crypto_config));
client_session->SetCryptoStream(client.get());
server.reset(new QuicCryptoServerStream(crypto_config_,
diff --git a/net/quic/quic_http_stream_test.cc b/net/quic/quic_http_stream_test.cc
index 316f114..bc0037a 100644
--- a/net/quic/quic_http_stream_test.cc
+++ b/net/quic/quic_http_stream_test.cc
@@ -49,6 +49,8 @@ namespace test {
namespace {
const char kUploadData[] = "hello world!";
+const char kServerHostname[] = "www.google.com";
+const uint16 kServerPort = 80;
class TestQuicConnection : public QuicConnection {
public:
@@ -206,8 +208,9 @@ class QuicHttpStreamTest : public ::testing::TestWithParam<QuicVersion> {
writer_.Pass(), NULL,
make_scoped_ptr((QuicServerInfo*)NULL),
&crypto_client_stream_factory_,
- "www.google.com", DefaultQuicConfig(),
- &crypto_config_, NULL));
+ QuicSessionKey(kServerHostname, kServerPort,
+ false),
+ DefaultQuicConfig(), &crypto_config_, NULL));
session_->GetCryptoStream()->CryptoConnect();
EXPECT_TRUE(session_->IsCryptoHandshakeConfirmed());
stream_.reset(use_closing_stream_ ?
diff --git a/net/quic/quic_session_key.cc b/net/quic/quic_session_key.cc
index 1f6908a..836850f 100644
--- a/net/quic/quic_session_key.cc
+++ b/net/quic/quic_session_key.cc
@@ -13,6 +13,12 @@ QuicSessionKey::QuicSessionKey(const HostPortPair& host_port_pair,
: host_port_pair_(host_port_pair),
is_https_(is_https) {}
+QuicSessionKey::QuicSessionKey(const std::string& host,
+ uint16 port,
+ bool is_https)
+ : host_port_pair_(host, port),
+ is_https_(is_https) {}
+
QuicSessionKey::~QuicSessionKey() {}
bool QuicSessionKey::operator<(const QuicSessionKey &other) const {
diff --git a/net/quic/quic_session_key.h b/net/quic/quic_session_key.h
index 486efd1..398fc00 100644
--- a/net/quic/quic_session_key.h
+++ b/net/quic/quic_session_key.h
@@ -17,6 +17,7 @@ class NET_EXPORT_PRIVATE QuicSessionKey {
public:
QuicSessionKey();
QuicSessionKey(const HostPortPair& host_port_pair, bool is_https);
+ QuicSessionKey(const std::string& host, uint16 port, bool is_https);
~QuicSessionKey();
// Needed to be an element of std::set.
@@ -31,6 +32,10 @@ class NET_EXPORT_PRIVATE QuicSessionKey {
return host_port_pair_;
}
+ const std::string& host() const { return host_port_pair_.host(); }
+
+ uint16 port() const { return host_port_pair_.port(); }
+
bool is_https() const { return is_https_; }
private:
diff --git a/net/quic/quic_stream_factory.cc b/net/quic/quic_stream_factory.cc
index f1e29c1..f54af96 100644
--- a/net/quic/quic_stream_factory.cc
+++ b/net/quic/quic_stream_factory.cc
@@ -31,6 +31,7 @@
#include "net/quic/quic_default_packet_writer.h"
#include "net/quic/quic_http_stream.h"
#include "net/quic/quic_protocol.h"
+#include "net/quic/quic_session_key.h"
#include "net/socket/client_socket_factory.h"
using std::string;
@@ -399,11 +400,10 @@ int QuicStreamFactory::Create(const HostPortPair& host_port_pair,
QuicCryptoClientConfig* crypto_config =
GetOrCreateCryptoConfig(session_key);
QuicCryptoClientConfig::CachedState* cached =
- crypto_config->LookupOrCreate(session_key.host_port_pair().host());
+ crypto_config->LookupOrCreate(session_key);
DCHECK(cached);
if (cached->IsEmpty()) {
- quic_server_info =
- quic_server_info_factory_->GetForHost(host_port_pair.host());
+ quic_server_info = quic_server_info_factory_->GetForServer(session_key);
}
}
scoped_ptr<Job> job(new Job(this, host_resolver_, host_port_pair,
@@ -438,7 +438,7 @@ bool QuicStreamFactory::OnResolution(
for (SessionSet::const_iterator i = sessions.begin();
i != sessions.end(); ++i) {
QuicClientSession* session = *i;
- if (!session->CanPool(session_key.host_port_pair().host()))
+ if (!session->CanPool(session_key.host()))
continue;
active_sessions_[session_key] = session;
session_aliases_[session].insert(session_key);
@@ -715,8 +715,8 @@ int QuicStreamFactory::CreateSession(
*session = new QuicClientSession(
connection, socket.Pass(), writer.Pass(), this, server_info.Pass(),
- quic_crypto_client_stream_factory_, host_port_pair.host(),
- config, crypto_config, net_log.net_log());
+ quic_crypto_client_stream_factory_, session_key, config, crypto_config,
+ net_log.net_log());
all_sessions_.insert(*session); // owning pointer
if (is_https) {
crypto_config->SetProofVerifier(
@@ -762,8 +762,7 @@ QuicCryptoClientConfig* QuicStreamFactory::GetOrCreateCryptoConfig(
void QuicStreamFactory::PopulateFromCanonicalConfig(
const QuicSessionKey& session_key,
QuicCryptoClientConfig* crypto_config) {
- const string server_hostname = session_key.host_port_pair().host();
- const uint16 server_port = session_key.host_port_pair().port();
+ const string server_hostname = session_key.host();
unsigned i = 0;
for (; i < canoncial_suffixes_.size(); ++i) {
if (EndsWith(server_hostname, canoncial_suffixes_[i], false)) {
@@ -773,7 +772,8 @@ void QuicStreamFactory::PopulateFromCanonicalConfig(
if (i == canoncial_suffixes_.size())
return;
- HostPortPair suffix_host_port_pair(canoncial_suffixes_[i], server_port);
+ HostPortPair suffix_host_port_pair(canoncial_suffixes_[i],
+ session_key.port());
QuicSessionKey suffix_session_key(suffix_host_port_pair,
session_key.is_https());
if (!ContainsKey(canonical_hostname_to_origin_map_, suffix_session_key)) {
@@ -788,13 +788,10 @@ void QuicStreamFactory::PopulateFromCanonicalConfig(
QuicCryptoClientConfig* canonical_crypto_config =
all_crypto_configs_[canonical_session_key];
DCHECK(canonical_crypto_config);
- const HostPortPair& canonical_host_port_pair =
- canonical_session_key.host_port_pair();
// Copy the CachedState for the canonical server from canonical_crypto_config
// as the initial CachedState for the server_hostname in crypto_config.
- crypto_config->InitializeFrom(server_hostname,
- canonical_host_port_pair.host(),
+ crypto_config->InitializeFrom(session_key, canonical_session_key,
canonical_crypto_config);
// Update canonical version to point at the "most recent" crypto_config.
canonical_hostname_to_origin_map_[suffix_session_key] =
diff --git a/net/quic/quic_stream_factory.h b/net/quic/quic_stream_factory.h
index 9c0edf4..f49b63d 100644
--- a/net/quic/quic_stream_factory.h
+++ b/net/quic/quic_stream_factory.h
@@ -23,7 +23,6 @@
#include "net/quic/quic_crypto_stream.h"
#include "net/quic/quic_http_stream.h"
#include "net/quic/quic_protocol.h"
-#include "net/quic/quic_session_key.h"
namespace net {
@@ -37,6 +36,7 @@ class QuicConnectionHelper;
class QuicCryptoClientStreamFactory;
class QuicRandom;
class QuicServerInfoFactory;
+class QuicSessionKey;
class QuicStreamFactory;
namespace test {
diff --git a/net/quic/quic_stream_factory_test.cc b/net/quic/quic_stream_factory_test.cc
index f075ea9..62dc868 100644
--- a/net/quic/quic_stream_factory_test.cc
+++ b/net/quic/quic_stream_factory_test.cc
@@ -44,24 +44,24 @@ class QuicStreamFactoryPeer {
QuicStreamFactory* factory,
const HostPortPair& host_port_pair,
bool is_https) {
- QuicSessionKey session_key(host_port_pair, is_https);
- return factory->GetOrCreateCryptoConfig(session_key);
+ QuicSessionKey server_key(host_port_pair, is_https);
+ return factory->GetOrCreateCryptoConfig(server_key);
}
static bool HasActiveSession(QuicStreamFactory* factory,
const HostPortPair& host_port_pair,
bool is_https) {
- QuicSessionKey session_key(host_port_pair, is_https);
- return factory->HasActiveSession(session_key);
+ QuicSessionKey server_key(host_port_pair, is_https);
+ return factory->HasActiveSession(server_key);
}
static QuicClientSession* GetActiveSession(
QuicStreamFactory* factory,
const HostPortPair& host_port_pair,
bool is_https) {
- QuicSessionKey session_key(host_port_pair, is_https);
- DCHECK(factory->HasActiveSession(session_key));
- return factory->active_sessions_[session_key];
+ QuicSessionKey server_key(host_port_pair, is_https);
+ DCHECK(factory->HasActiveSession(server_key));
+ return factory->active_sessions_[server_key];
}
static scoped_ptr<QuicHttpStream> CreateIfSessionExists(
@@ -69,8 +69,8 @@ class QuicStreamFactoryPeer {
const HostPortPair& host_port_pair,
bool is_https,
const BoundNetLog& net_log) {
- QuicSessionKey session_key(host_port_pair, is_https);
- return factory->CreateIfSessionExists(session_key, net_log);
+ QuicSessionKey server_key(host_port_pair, is_https);
+ return factory->CreateIfSessionExists(server_key, net_log);
}
static bool IsLiveSession(QuicStreamFactory* factory,
@@ -1029,8 +1029,9 @@ TEST_P(QuicStreamFactoryTest, SharedCryptoConfig) {
QuicStreamFactoryPeer::GetOrCreateCryptoConfig(
&factory_, host_port_pair1, is_https_);
DCHECK(crypto_config1);
+ QuicSessionKey server_key1(host_port_pair1, is_https_);
QuicCryptoClientConfig::CachedState* cached1 =
- crypto_config1->LookupOrCreate(host_port_pair1.host());
+ crypto_config1->LookupOrCreate(server_key1);
EXPECT_FALSE(cached1->proof_valid());
EXPECT_TRUE(cached1->source_address_token().empty());
@@ -1044,8 +1045,9 @@ TEST_P(QuicStreamFactoryTest, SharedCryptoConfig) {
QuicStreamFactoryPeer::GetOrCreateCryptoConfig(
&factory_, host_port_pair2, is_https_);
DCHECK(crypto_config2);
+ QuicSessionKey server_key2(host_port_pair2, is_https_);
QuicCryptoClientConfig::CachedState* cached2 =
- crypto_config2->LookupOrCreate(host_port_pair2.host());
+ crypto_config2->LookupOrCreate(server_key2);
EXPECT_EQ(cached1->source_address_token(), cached2->source_address_token());
EXPECT_TRUE(cached2->proof_valid());
}
@@ -1067,8 +1069,9 @@ TEST_P(QuicStreamFactoryTest, CryptoConfigWhenProofIsInvalid) {
QuicStreamFactoryPeer::GetOrCreateCryptoConfig(
&factory_, host_port_pair1, is_https_);
DCHECK(crypto_config1);
+ QuicSessionKey server_key1(host_port_pair1, is_https_);
QuicCryptoClientConfig::CachedState* cached1 =
- crypto_config1->LookupOrCreate(host_port_pair1.host());
+ crypto_config1->LookupOrCreate(server_key1);
EXPECT_FALSE(cached1->proof_valid());
EXPECT_TRUE(cached1->source_address_token().empty());
@@ -1082,8 +1085,9 @@ TEST_P(QuicStreamFactoryTest, CryptoConfigWhenProofIsInvalid) {
QuicStreamFactoryPeer::GetOrCreateCryptoConfig(
&factory_, host_port_pair2, is_https_);
DCHECK(crypto_config2);
+ QuicSessionKey server_key2(host_port_pair2, is_https_);
QuicCryptoClientConfig::CachedState* cached2 =
- crypto_config2->LookupOrCreate(host_port_pair2.host());
+ crypto_config2->LookupOrCreate(server_key2);
EXPECT_NE(cached1->source_address_token(), cached2->source_address_token());
EXPECT_TRUE(cached2->source_address_token().empty());
EXPECT_FALSE(cached2->proof_valid());
diff --git a/net/quic/test_tools/crypto_test_utils.cc b/net/quic/test_tools/crypto_test_utils.cc
index 2dbae1e..86b22e1 100644
--- a/net/quic/test_tools/crypto_test_utils.cc
+++ b/net/quic/test_tools/crypto_test_utils.cc
@@ -15,6 +15,7 @@
#include "net/quic/quic_crypto_client_stream.h"
#include "net/quic/quic_crypto_server_stream.h"
#include "net/quic/quic_crypto_stream.h"
+#include "net/quic/quic_session_key.h"
#include "net/quic/test_tools/quic_connection_peer.h"
#include "net/quic/test_tools/quic_test_utils.h"
#include "net/quic/test_tools/simple_quic_framer.h"
@@ -30,6 +31,9 @@ namespace test {
namespace {
+const char kServerHostname[] = "test.example.com";
+const uint16 kServerPort = 80;
+
// CryptoFramerVisitor is a framer visitor that records handshake messages.
class CryptoFramerVisitor : public CryptoFramerVisitorInterface {
public:
@@ -175,8 +179,8 @@ int CryptoTestUtils::HandshakeWithFakeClient(
if (options.channel_id_enabled) {
crypto_config.SetChannelIDSigner(ChannelIDSignerForTesting());
}
- QuicCryptoClientStream client("test.example.com", &client_session,
- &crypto_config);
+ QuicSessionKey server_key(kServerHostname, kServerPort, false);
+ QuicCryptoClientStream client(server_key, &client_session, &crypto_config);
client_session.SetCryptoStream(&client);
CHECK(client.CryptoConnect());
@@ -188,7 +192,7 @@ int CryptoTestUtils::HandshakeWithFakeClient(
if (options.channel_id_enabled) {
EXPECT_EQ(crypto_config.channel_id_signer()->GetKeyForHostname(
- "test.example.com"),
+ kServerHostname),
server->crypto_negotiated_params().channel_id);
}
diff --git a/net/quic/test_tools/mock_crypto_client_stream.cc b/net/quic/test_tools/mock_crypto_client_stream.cc
index 7dd3ffe..5166bb1 100644
--- a/net/quic/test_tools/mock_crypto_client_stream.cc
+++ b/net/quic/test_tools/mock_crypto_client_stream.cc
@@ -3,18 +3,20 @@
// found in the LICENSE file.
#include "net/quic/test_tools/mock_crypto_client_stream.h"
+
+#include "net/quic/quic_session_key.h"
#include "net/ssl/ssl_info.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace net {
MockCryptoClientStream::MockCryptoClientStream(
- const string& server_hostname,
+ const QuicSessionKey& server_key,
QuicSession* session,
QuicCryptoClientConfig* crypto_config,
HandshakeMode handshake_mode,
const SSLInfo* ssl_info)
- : QuicCryptoClientStream(server_hostname, session, crypto_config),
+ : QuicCryptoClientStream(server_key, session, crypto_config),
handshake_mode_(handshake_mode),
ssl_info_(ssl_info) {
}
diff --git a/net/quic/test_tools/mock_crypto_client_stream.h b/net/quic/test_tools/mock_crypto_client_stream.h
index ab393e8..ad3a18c 100644
--- a/net/quic/test_tools/mock_crypto_client_stream.h
+++ b/net/quic/test_tools/mock_crypto_client_stream.h
@@ -14,6 +14,8 @@
namespace net {
+class QuicSessionKey;
+
class MockCryptoClientStream : public QuicCryptoClientStream {
public:
// HandshakeMode enumerates the handshake mode MockCryptoClientStream should
@@ -34,7 +36,7 @@ class MockCryptoClientStream : public QuicCryptoClientStream {
};
MockCryptoClientStream(
- const string& server_hostname,
+ const QuicSessionKey& server_key,
QuicSession* session,
QuicCryptoClientConfig* crypto_config,
HandshakeMode handshake_mode,
diff --git a/net/quic/test_tools/mock_crypto_client_stream_factory.cc b/net/quic/test_tools/mock_crypto_client_stream_factory.cc
index 671a872..d87b508 100644
--- a/net/quic/test_tools/mock_crypto_client_stream_factory.cc
+++ b/net/quic/test_tools/mock_crypto_client_stream_factory.cc
@@ -6,6 +6,7 @@
#include "base/lazy_instance.h"
#include "net/quic/quic_crypto_client_stream.h"
+#include "net/quic/quic_session_key.h"
using std::string;
@@ -19,11 +20,11 @@ MockCryptoClientStreamFactory::MockCryptoClientStreamFactory()
QuicCryptoClientStream*
MockCryptoClientStreamFactory::CreateQuicCryptoClientStream(
- const string& server_hostname,
+ const QuicSessionKey& server_key,
QuicSession* session,
QuicCryptoClientConfig* crypto_config) {
last_stream_ = new MockCryptoClientStream(
- server_hostname, session, crypto_config, handshake_mode_, ssl_info_);
+ server_key, session, crypto_config, handshake_mode_, ssl_info_);
return last_stream_;
}
diff --git a/net/quic/test_tools/mock_crypto_client_stream_factory.h b/net/quic/test_tools/mock_crypto_client_stream_factory.h
index 26caf50..69a0bbe 100644
--- a/net/quic/test_tools/mock_crypto_client_stream_factory.h
+++ b/net/quic/test_tools/mock_crypto_client_stream_factory.h
@@ -13,13 +13,15 @@
namespace net {
+class QuicSessionKey;
+
class MockCryptoClientStreamFactory : public QuicCryptoClientStreamFactory {
public:
MockCryptoClientStreamFactory();
virtual ~MockCryptoClientStreamFactory() {}
virtual QuicCryptoClientStream* CreateQuicCryptoClientStream(
- const string& server_hostname,
+ const QuicSessionKey& server_key,
QuicSession* session,
QuicCryptoClientConfig* crypto_config) OVERRIDE;
diff --git a/net/tools/quic/end_to_end_test.cc b/net/tools/quic/end_to_end_test.cc
index a15124ef..7014bab 100644
--- a/net/tools/quic/end_to_end_test.cc
+++ b/net/tools/quic/end_to_end_test.cc
@@ -20,6 +20,7 @@
#include "net/quic/quic_packet_creator.h"
#include "net/quic/quic_protocol.h"
#include "net/quic/quic_sent_packet_manager.h"
+#include "net/quic/quic_session_key.h"
#include "net/quic/test_tools/quic_connection_peer.h"
#include "net/quic/test_tools/quic_session_peer.h"
#include "net/quic/test_tools/quic_test_utils.h"
@@ -149,12 +150,13 @@ class ClientDelegate : public PacketDroppingTestWriter::Delegate {
class EndToEndTest : public ::testing::TestWithParam<TestParams> {
protected:
EndToEndTest()
- : server_hostname_("example.com"),
- server_started_(false),
+ : server_started_(false),
strike_register_no_startup_period_(false) {
net::IPAddressNumber ip;
CHECK(net::ParseIPLiteralToNumber("127.0.0.1", &ip));
- server_address_ = IPEndPoint(ip, 0);
+ uint port = 0;
+ server_address_ = IPEndPoint(ip, port);
+ server_key_ = QuicSessionKey("example.com", port, false);
client_supported_versions_ = GetParam().client_supported_versions;
server_supported_versions_ = GetParam().server_supported_versions;
@@ -182,7 +184,7 @@ class EndToEndTest : public ::testing::TestWithParam<TestParams> {
QuicTestClient* CreateQuicClient(QuicPacketWriterWrapper* writer) {
QuicTestClient* client = new QuicTestClient(server_address_,
- server_hostname_,
+ server_key_,
false, // not secure
client_config_,
client_supported_versions_);
@@ -223,6 +225,9 @@ class EndToEndTest : public ::testing::TestWithParam<TestParams> {
server_thread_->Initialize();
server_address_ = IPEndPoint(server_address_.address(),
server_thread_->GetPort());
+ server_key_ = QuicSessionKey(server_key_.host(),
+ server_thread_->GetPort(), false);
+
QuicDispatcher* dispatcher =
QuicServerPeer::GetDispatcher(server_thread_->server());
QuicDispatcherPeer::UseWriter(dispatcher, server_writer_);
@@ -276,7 +281,7 @@ class EndToEndTest : public ::testing::TestWithParam<TestParams> {
}
IPEndPoint server_address_;
- string server_hostname_;
+ QuicSessionKey server_key_;
scoped_ptr<ServerThread> server_thread_;
scoped_ptr<QuicTestClient> client_;
PacketDroppingTestWriter* client_writer_;
diff --git a/net/tools/quic/quic_client.cc b/net/tools/quic/quic_client.cc
index 5a6a51e..83d867f 100644
--- a/net/tools/quic/quic_client.cc
+++ b/net/tools/quic/quic_client.cc
@@ -16,6 +16,7 @@
#include "net/quic/quic_connection.h"
#include "net/quic/quic_data_reader.h"
#include "net/quic/quic_protocol.h"
+#include "net/quic/quic_session_key.h"
#include "net/tools/balsa/balsa_headers.h"
#include "net/tools/quic/quic_epoll_connection_helper.h"
#include "net/tools/quic/quic_socket_utils.h"
@@ -31,11 +32,11 @@ namespace tools {
const int kEpollFlags = EPOLLIN | EPOLLOUT | EPOLLET;
QuicClient::QuicClient(IPEndPoint server_address,
- const string& server_hostname,
+ const QuicSessionKey& server_key,
const QuicVersionVector& supported_versions,
bool print_response)
: server_address_(server_address),
- server_hostname_(server_hostname),
+ server_key_(server_key),
local_port_(0),
fd_(-1),
helper_(CreateQuicConnectionHelper()),
@@ -48,11 +49,11 @@ QuicClient::QuicClient(IPEndPoint server_address,
}
QuicClient::QuicClient(IPEndPoint server_address,
- const string& server_hostname,
+ const QuicSessionKey& server_key,
const QuicConfig& config,
const QuicVersionVector& supported_versions)
: server_address_(server_address),
- server_hostname_(server_hostname),
+ server_key_(server_key),
config_(config),
local_port_(0),
fd_(-1),
@@ -162,7 +163,7 @@ bool QuicClient::StartConnect() {
}
session_.reset(new QuicClientSession(
- server_hostname_,
+ server_key_,
config_,
new QuicConnection(GenerateConnectionId(), server_address_, helper_.get(),
writer_.get(), false, supported_versions_),
diff --git a/net/tools/quic/quic_client.h b/net/tools/quic/quic_client.h
index aec6679..8ea37ea 100644
--- a/net/tools/quic/quic_client.h
+++ b/net/tools/quic/quic_client.h
@@ -25,6 +25,7 @@
namespace net {
class ProofVerifier;
+class QuicSessionKey;
namespace tools {
@@ -47,11 +48,11 @@ class QuicClient : public EpollCallbackInterface,
};
QuicClient(IPEndPoint server_address,
- const string& server_hostname,
+ const QuicSessionKey& server_key,
const QuicVersionVector& supported_versions,
bool print_response);
QuicClient(IPEndPoint server_address,
- const std::string& server_hostname,
+ const QuicSessionKey& server_key,
const QuicConfig& config,
const QuicVersionVector& supported_versions);
@@ -134,13 +135,11 @@ class QuicClient : public EpollCallbackInterface,
int fd() { return fd_; }
- string server_hostname() {
- return server_hostname_;
- }
+ const QuicSessionKey& server_key() const { return server_key_; }
// This should only be set before the initial Connect()
- void set_server_hostname(const string& hostname) {
- server_hostname_ = hostname;
+ void set_server_key(const QuicSessionKey& server_key) {
+ server_key_ = server_key;
}
// SetProofVerifier sets the ProofVerifier that will be used to verify the
@@ -181,8 +180,8 @@ class QuicClient : public EpollCallbackInterface,
// Address of the server.
const IPEndPoint server_address_;
- // Hostname of the server. This may be a DNS name or an IP address literal.
- std::string server_hostname_;
+ // |server_key_| is a tuple (hostname, port, is_https) of the server.
+ QuicSessionKey server_key_;
// config_ and crypto_config_ contain configuration and cached state about
// servers.
diff --git a/net/tools/quic/quic_client_bin.cc b/net/tools/quic/quic_client_bin.cc
index 49cfdef..36ad5b7 100644
--- a/net/tools/quic/quic_client_bin.cc
+++ b/net/tools/quic/quic_client_bin.cc
@@ -4,6 +4,7 @@
// A binary wrapper for QuicClient. Connects to --hostname via --address
// on --port and requests URLs specified on the command line.
+// --secure to check the certificates using proof verifier .
//
// For example:
// quic_client --address=127.0.0.1 --port=6122 --hostname=www.google.com
@@ -22,6 +23,7 @@
int32 FLAGS_port = 6121;
std::string FLAGS_address = "127.0.0.1";
std::string FLAGS_hostname = "localhost";
+bool FLAGS_secure = false;
int main(int argc, char *argv[]) {
CommandLine::Init(argc, argv);
@@ -39,7 +41,8 @@ int main(int argc, char *argv[]) {
"-h, --help show this help message and exit\n"
"--port=<port> specify the port to connect to\n"
"--address=<address> specify the IP address to connect to\n"
- "--host=<host> specify the SNI hostname to use\n";
+ "--host=<host> specify the SNI hostname to use\n"
+ "--secure check certificates\n";
std::cout << help_str;
exit(0);
}
@@ -55,9 +58,13 @@ int main(int argc, char *argv[]) {
if (line->HasSwitch("hostname")) {
FLAGS_hostname = line->GetSwitchValueASCII("hostname");
}
+ if (line->HasSwitch("secure")) {
+ FLAGS_secure = true;
+ }
VLOG(1) << "server port: " << FLAGS_port
<< " address: " << FLAGS_address
- << " hostname: " << FLAGS_hostname;
+ << " hostname: " << FLAGS_hostname
+ << " secure: " << FLAGS_secure;
base::AtExitManager exit_manager;
@@ -65,7 +72,8 @@ int main(int argc, char *argv[]) {
CHECK(net::ParseIPLiteralToNumber(FLAGS_address, &addr));
// TODO(rjshade): Set version on command line.
net::tools::QuicClient client(
- net::IPEndPoint(addr, FLAGS_port), FLAGS_hostname,
+ net::IPEndPoint(addr, FLAGS_port),
+ net::QuicSessionKey(FLAGS_hostname, FLAGS_port, FLAGS_secure),
net::QuicSupportedVersions(), true);
client.Initialize();
diff --git a/net/tools/quic/quic_client_session.cc b/net/tools/quic/quic_client_session.cc
index a2d6949..cc4ef37 100644
--- a/net/tools/quic/quic_client_session.cc
+++ b/net/tools/quic/quic_client_session.cc
@@ -6,6 +6,7 @@
#include "base/logging.h"
#include "net/quic/crypto/crypto_protocol.h"
+#include "net/quic/quic_session_key.h"
#include "net/tools/quic/quic_spdy_client_stream.h"
using std::string;
@@ -14,12 +15,12 @@ namespace net {
namespace tools {
QuicClientSession::QuicClientSession(
- const string& server_hostname,
+ const QuicSessionKey& server_key,
const QuicConfig& config,
QuicConnection* connection,
QuicCryptoClientConfig* crypto_config)
: QuicSession(connection, config),
- crypto_stream_(server_hostname, this, crypto_config) {
+ crypto_stream_(server_key, this, crypto_config) {
}
QuicClientSession::~QuicClientSession() {
diff --git a/net/tools/quic/quic_client_session.h b/net/tools/quic/quic_client_session.h
index 8330e2d..f3bce29 100644
--- a/net/tools/quic/quic_client_session.h
+++ b/net/tools/quic/quic_client_session.h
@@ -18,13 +18,14 @@
namespace net {
class QuicConnection;
+class QuicSessionKey;
class ReliableQuicStream;
namespace tools {
class QuicClientSession : public QuicSession {
public:
- QuicClientSession(const std::string& server_hostname,
+ QuicClientSession(const QuicSessionKey& server_key,
const QuicConfig& config,
QuicConnection* connection,
QuicCryptoClientConfig* crypto_config);
diff --git a/net/tools/quic/quic_client_session_test.cc b/net/tools/quic/quic_client_session_test.cc
index 23d79a7..a0b49d4 100644
--- a/net/tools/quic/quic_client_session_test.cc
+++ b/net/tools/quic/quic_client_session_test.cc
@@ -25,6 +25,7 @@ namespace test {
namespace {
const char kServerHostname[] = "www.example.com";
+const uint16 kPort = 80;
class ToolsQuicClientSessionTest
: public ::testing::TestWithParam<QuicVersion> {
@@ -33,8 +34,9 @@ class ToolsQuicClientSessionTest
: connection_(new PacketSavingConnection(false,
SupportedVersions(GetParam()))) {
crypto_config_.SetDefaults();
- session_.reset(new QuicClientSession(kServerHostname, DefaultQuicConfig(),
- connection_, &crypto_config_));
+ session_.reset(new QuicClientSession(
+ QuicSessionKey(kServerHostname, kPort, false),
+ DefaultQuicConfig(), connection_, &crypto_config_));
session_->config()->SetDefaults();
}
diff --git a/net/tools/quic/quic_spdy_client_stream_test.cc b/net/tools/quic/quic_spdy_client_stream_test.cc
index bad90804..301bf83 100644
--- a/net/tools/quic/quic_spdy_client_stream_test.cc
+++ b/net/tools/quic/quic_spdy_client_stream_test.cc
@@ -30,8 +30,8 @@ class QuicSpdyClientStreamTest : public TestWithParam<QuicVersion> {
QuicSpdyClientStreamTest()
: connection_(new StrictMock<MockConnection>(
false, SupportedVersions(GetParam()))),
- session_("example.com", DefaultQuicConfig(), connection_,
- &crypto_config_),
+ session_(QuicSessionKey("example.com", 80, false), DefaultQuicConfig(),
+ connection_, &crypto_config_),
body_("hello world") {
crypto_config_.SetDefaults();
diff --git a/net/tools/quic/test_tools/quic_test_client.cc b/net/tools/quic/test_tools/quic_test_client.cc
index 8cfeefb..00061b5 100644
--- a/net/tools/quic/test_tools/quic_test_client.cc
+++ b/net/tools/quic/test_tools/quic_test_client.cc
@@ -10,6 +10,7 @@
#include "net/cert/cert_verify_result.h"
#include "net/cert/x509_certificate.h"
#include "net/quic/crypto/proof_verifier.h"
+#include "net/quic/quic_session_key.h"
#include "net/quic/test_tools/quic_connection_peer.h"
#include "net/tools/balsa/balsa_headers.h"
#include "net/tools/quic/quic_epoll_connection_helper.h"
@@ -99,17 +100,17 @@ BalsaHeaders* MungeHeaders(const BalsaHeaders* const_headers,
class MockableQuicClient : public QuicClient {
public:
MockableQuicClient(IPEndPoint server_address,
- const string& server_hostname,
+ const QuicSessionKey& server_key,
const QuicVersionVector& supported_versions)
- : QuicClient(server_address, server_hostname, supported_versions, false),
+ : QuicClient(server_address, server_key, supported_versions, false),
override_connection_id_(0),
test_writer_(NULL) {}
MockableQuicClient(IPEndPoint server_address,
- const string& server_hostname,
+ const QuicSessionKey& server_key,
const QuicConfig& config,
const QuicVersionVector& supported_versions)
- : QuicClient(server_address, server_hostname, config, supported_versions),
+ : QuicClient(server_address, server_key, config, supported_versions),
override_connection_id_(0),
test_writer_(NULL) {}
@@ -145,34 +146,36 @@ class MockableQuicClient : public QuicClient {
QuicPacketWriterWrapper* test_writer_;
};
-QuicTestClient::QuicTestClient(IPEndPoint address, const string& hostname,
+QuicTestClient::QuicTestClient(IPEndPoint address,
+ const QuicSessionKey& server_key,
const QuicVersionVector& supported_versions)
- : client_(new MockableQuicClient(address, hostname, supported_versions)) {
- Initialize(address, hostname, true);
+ : client_(new MockableQuicClient(address, server_key, supported_versions)) {
+ Initialize(address, server_key, true);
}
QuicTestClient::QuicTestClient(IPEndPoint address,
- const string& hostname,
+ const QuicSessionKey& server_key,
bool secure,
const QuicVersionVector& supported_versions)
- : client_(new MockableQuicClient(address, hostname, supported_versions)) {
- Initialize(address, hostname, secure);
+ : client_(new MockableQuicClient(address, server_key, supported_versions)) {
+ Initialize(address, server_key, secure);
}
QuicTestClient::QuicTestClient(IPEndPoint address,
- const string& hostname,
+ const QuicSessionKey& server_key,
bool secure,
const QuicConfig& config,
const QuicVersionVector& supported_versions)
- : client_(new MockableQuicClient(
- address, hostname, config, supported_versions)) {
- Initialize(address, hostname, secure);
+ : client_(new MockableQuicClient(address, server_key, config,
+ supported_versions)) {
+ Initialize(address, server_key, secure);
}
void QuicTestClient::Initialize(IPEndPoint address,
- const string& hostname,
+ const QuicSessionKey& server_key,
bool secure) {
server_address_ = address;
+ server_key_ = server_key;
priority_ = 3;
connect_attempted_ = false;
secure_ = secure;
@@ -211,7 +214,9 @@ ssize_t QuicTestClient::SendMessage(const HTTPMessage& message) {
if (!connected()) {
GURL url(message.headers()->request_uri().as_string());
if (!url.host().empty()) {
- client_->set_server_hostname(url.host());
+ client_->set_server_key(
+ QuicSessionKey(url.host(), url.EffectiveIntPort(),
+ url.SchemeIs("https") ? true : false));
}
}
@@ -292,7 +297,7 @@ QuicTagValueMap QuicTestClient::GetServerConfig() const {
net::QuicCryptoClientConfig* config =
QuicClientPeer::GetCryptoConfig(client_.get());
net::QuicCryptoClientConfig::CachedState* state =
- config->LookupOrCreate(client_->server_hostname());
+ config->LookupOrCreate(client_->server_key());
const net::CryptoHandshakeMessage* handshake_msg = state->GetServerConfig();
if (handshake_msg != NULL) {
return handshake_msg->tag_value_map();
diff --git a/net/tools/quic/test_tools/quic_test_client.h b/net/tools/quic/test_tools/quic_test_client.h
index fd1f4c4..7a0ab82 100644
--- a/net/tools/quic/test_tools/quic_test_client.h
+++ b/net/tools/quic/test_tools/quic_test_client.h
@@ -17,6 +17,7 @@
namespace net {
class ProofVerifier;
+class QuicSessionKey;
namespace tools {
@@ -30,14 +31,15 @@ class MockableQuicClient;
// A toy QUIC client used for testing.
class QuicTestClient : public QuicDataStream::Visitor {
public:
- QuicTestClient(IPEndPoint server_address, const string& server_hostname,
+ QuicTestClient(IPEndPoint server_address,
+ const QuicSessionKey& server_key,
const QuicVersionVector& supported_versions);
QuicTestClient(IPEndPoint server_address,
- const string& server_hostname,
+ const QuicSessionKey& server_key,
bool secure,
const QuicVersionVector& supported_versions);
QuicTestClient(IPEndPoint server_address,
- const string& server_hostname,
+ const QuicSessionKey& server_key,
bool secure,
const QuicConfig& config,
const QuicVersionVector& supported_versions);
@@ -118,10 +120,13 @@ class QuicTestClient : public QuicDataStream::Visitor {
void WaitForWriteToFlush();
private:
- void Initialize(IPEndPoint address, const string& hostname, bool secure);
+ void Initialize(IPEndPoint address,
+ const QuicSessionKey& server_key,
+ bool secure);
IPEndPoint server_address_;
IPEndPoint client_address_;
+ QuicSessionKey server_key_;
scoped_ptr<MockableQuicClient> client_; // The actual client
QuicSpdyClientStream* stream_;