Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1)

Side by Side Diff: net/quic/quic_client_session.cc

Issue 868803003: Do not pool QUIC sessions when privacy mode mismatches. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « net/quic/quic_client_session.h ('k') | net/quic/quic_client_session_test.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "net/quic/quic_client_session.h" 5 #include "net/quic/quic_client_session.h"
6 6
7 #include "base/callback_helpers.h" 7 #include "base/callback_helpers.h"
8 #include "base/message_loop/message_loop.h" 8 #include "base/message_loop/message_loop.h"
9 #include "base/metrics/histogram.h" 9 #include "base/metrics/histogram.h"
10 #include "base/metrics/sparse_histogram.h" 10 #include "base/metrics/sparse_histogram.h"
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after
181 address.GetFamily() == ADDRESS_FAMILY_IPV6) { 181 address.GetFamily() == ADDRESS_FAMILY_IPV6) {
182 connection->set_max_packet_length( 182 connection->set_max_packet_length(
183 connection->max_packet_length() - kAdditionalOverheadForIPv6); 183 connection->max_packet_length() - kAdditionalOverheadForIPv6);
184 } 184 }
185 } 185 }
186 186
187 void QuicClientSession::InitializeSession( 187 void QuicClientSession::InitializeSession(
188 const QuicServerId& server_id, 188 const QuicServerId& server_id,
189 QuicCryptoClientConfig* crypto_config, 189 QuicCryptoClientConfig* crypto_config,
190 QuicCryptoClientStreamFactory* crypto_client_stream_factory) { 190 QuicCryptoClientStreamFactory* crypto_client_stream_factory) {
191 server_host_port_ = server_id.host_port_pair(); 191 server_id_ = server_id;
192 crypto_stream_.reset( 192 crypto_stream_.reset(
193 crypto_client_stream_factory ? 193 crypto_client_stream_factory ?
194 crypto_client_stream_factory->CreateQuicCryptoClientStream( 194 crypto_client_stream_factory->CreateQuicCryptoClientStream(
195 server_id, this, crypto_config) : 195 server_id, this, crypto_config) :
196 new QuicCryptoClientStream(server_id, this, 196 new QuicCryptoClientStream(server_id, this,
197 new ProofVerifyContextChromium(net_log_), 197 new ProofVerifyContextChromium(net_log_),
198 crypto_config)); 198 crypto_config));
199 QuicClientSessionBase::InitializeSession(); 199 QuicClientSessionBase::InitializeSession();
200 // TODO(rch): pass in full host port proxy pair 200 // TODO(rch): pass in full host port proxy pair
201 net_log_.BeginEvent(NetLog::TYPE_QUIC_SESSION, 201 net_log_.BeginEvent(NetLog::TYPE_QUIC_SESSION,
(...skipping 324 matching lines...) Expand 10 before | Expand all | Expand 10 after
526 return ERR_QUIC_HANDSHAKE_FAILED; 526 return ERR_QUIC_HANDSHAKE_FAILED;
527 527
528 callback_ = callback; 528 callback_ = callback;
529 return ERR_IO_PENDING; 529 return ERR_IO_PENDING;
530 } 530 }
531 531
532 int QuicClientSession::GetNumSentClientHellos() const { 532 int QuicClientSession::GetNumSentClientHellos() const {
533 return crypto_stream_->num_sent_client_hellos(); 533 return crypto_stream_->num_sent_client_hellos();
534 } 534 }
535 535
536 bool QuicClientSession::CanPool(const std::string& hostname) const { 536 bool QuicClientSession::CanPool(const std::string& hostname,
537 PrivacyMode privacy_mode) const {
537 DCHECK(connection()->connected()); 538 DCHECK(connection()->connected());
539 if (privacy_mode != server_id_.privacy_mode()) {
540 // Privacy mode must always match.
541 return false;
542 }
538 SSLInfo ssl_info; 543 SSLInfo ssl_info;
539 if (!GetSSLInfo(&ssl_info) || !ssl_info.cert.get()) { 544 if (!GetSSLInfo(&ssl_info) || !ssl_info.cert.get()) {
540 // We can always pool with insecure QUIC sessions. 545 // We can always pool with insecure QUIC sessions.
541 return true; 546 return true;
542 } 547 }
543 548
544 return SpdySession::CanPool(transport_security_state_, ssl_info, 549 return SpdySession::CanPool(transport_security_state_, ssl_info,
545 server_host_port_.host(), hostname); 550 server_id_.host(), hostname);
546 } 551 }
547 552
548 QuicDataStream* QuicClientSession::CreateIncomingDataStream( 553 QuicDataStream* QuicClientSession::CreateIncomingDataStream(
549 QuicStreamId id) { 554 QuicStreamId id) {
550 DLOG(ERROR) << "Server push not supported"; 555 DLOG(ERROR) << "Server push not supported";
551 return nullptr; 556 return nullptr;
552 } 557 }
553 558
554 void QuicClientSession::CloseStream(QuicStreamId stream_id) { 559 void QuicClientSession::CloseStream(QuicStreamId stream_id) {
555 ReliableQuicStream* stream = GetStream(stream_id); 560 ReliableQuicStream* stream = GetStream(stream_id);
(...skipping 375 matching lines...) Expand 10 before | Expand all | Expand 10 after
931 return; 936 return;
932 937
933 // TODO(rch): re-enable this code once beta is cut. 938 // TODO(rch): re-enable this code once beta is cut.
934 // if (stream_factory_) 939 // if (stream_factory_)
935 // stream_factory_->OnSessionConnectTimeout(this); 940 // stream_factory_->OnSessionConnectTimeout(this);
936 // CloseAllStreams(ERR_QUIC_HANDSHAKE_FAILED); 941 // CloseAllStreams(ERR_QUIC_HANDSHAKE_FAILED);
937 // DCHECK_EQ(0u, GetNumOpenStreams()); 942 // DCHECK_EQ(0u, GetNumOpenStreams());
938 } 943 }
939 944
940 } // namespace net 945 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/quic_client_session.h ('k') | net/quic/quic_client_session_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698