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

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

Issue 485943004: Revert 290320 "Refactor pooling logic into a helper method" (Closed) Base URL: svn://svn.chromium.org/chrome/
Patch Set: Created 6 years, 4 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 | Annotate | Revision Log
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"
11 #include "base/stl_util.h" 11 #include "base/stl_util.h"
12 #include "base/strings/string_number_conversions.h" 12 #include "base/strings/string_number_conversions.h"
13 #include "base/values.h" 13 #include "base/values.h"
14 #include "net/base/io_buffer.h" 14 #include "net/base/io_buffer.h"
15 #include "net/base/net_errors.h" 15 #include "net/base/net_errors.h"
16 #include "net/http/transport_security_state.h"
17 #include "net/quic/crypto/proof_verifier_chromium.h" 16 #include "net/quic/crypto/proof_verifier_chromium.h"
18 #include "net/quic/crypto/quic_server_info.h" 17 #include "net/quic/crypto/quic_server_info.h"
19 #include "net/quic/quic_connection_helper.h" 18 #include "net/quic/quic_connection_helper.h"
20 #include "net/quic/quic_crypto_client_stream_factory.h" 19 #include "net/quic/quic_crypto_client_stream_factory.h"
21 #include "net/quic/quic_default_packet_writer.h" 20 #include "net/quic/quic_default_packet_writer.h"
22 #include "net/quic/quic_server_id.h" 21 #include "net/quic/quic_server_id.h"
23 #include "net/quic/quic_stream_factory.h" 22 #include "net/quic/quic_stream_factory.h"
24 #include "net/spdy/spdy_session.h"
25 #include "net/ssl/channel_id_service.h" 23 #include "net/ssl/channel_id_service.h"
26 #include "net/ssl/ssl_connection_status_flags.h" 24 #include "net/ssl/ssl_connection_status_flags.h"
27 #include "net/ssl/ssl_info.h" 25 #include "net/ssl/ssl_info.h"
28 #include "net/udp/datagram_client_socket.h" 26 #include "net/udp/datagram_client_socket.h"
29 27
30 namespace net { 28 namespace net {
31 29
32 namespace { 30 namespace {
33 31
34 // The length of time to wait for a 0-RTT handshake to complete 32 // The length of time to wait for a 0-RTT handshake to complete
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
133 session_.reset(); 131 session_.reset();
134 ResetAndReturn(&callback_).Run(rv); 132 ResetAndReturn(&callback_).Run(rv);
135 } 133 }
136 134
137 QuicClientSession::QuicClientSession( 135 QuicClientSession::QuicClientSession(
138 QuicConnection* connection, 136 QuicConnection* connection,
139 scoped_ptr<DatagramClientSocket> socket, 137 scoped_ptr<DatagramClientSocket> socket,
140 scoped_ptr<QuicDefaultPacketWriter> writer, 138 scoped_ptr<QuicDefaultPacketWriter> writer,
141 QuicStreamFactory* stream_factory, 139 QuicStreamFactory* stream_factory,
142 QuicCryptoClientStreamFactory* crypto_client_stream_factory, 140 QuicCryptoClientStreamFactory* crypto_client_stream_factory,
143 TransportSecurityState* transport_security_state,
144 scoped_ptr<QuicServerInfo> server_info, 141 scoped_ptr<QuicServerInfo> server_info,
145 const QuicServerId& server_id, 142 const QuicServerId& server_id,
146 const QuicConfig& config, 143 const QuicConfig& config,
147 QuicCryptoClientConfig* crypto_config, 144 QuicCryptoClientConfig* crypto_config,
148 base::TaskRunner* task_runner, 145 base::TaskRunner* task_runner,
149 NetLog* net_log) 146 NetLog* net_log)
150 : QuicClientSessionBase(connection, config), 147 : QuicClientSessionBase(connection, config),
151 server_host_port_(server_id.host_port_pair()), 148 server_host_port_(server_id.host_port_pair()),
152 require_confirmation_(false), 149 require_confirmation_(false),
153 stream_factory_(stream_factory), 150 stream_factory_(stream_factory),
154 socket_(socket.Pass()), 151 socket_(socket.Pass()),
155 writer_(writer.Pass()), 152 writer_(writer.Pass()),
156 read_buffer_(new IOBufferWithSize(kMaxPacketSize)), 153 read_buffer_(new IOBufferWithSize(kMaxPacketSize)),
157 transport_security_state_(transport_security_state),
158 server_info_(server_info.Pass()), 154 server_info_(server_info.Pass()),
159 read_pending_(false), 155 read_pending_(false),
160 num_total_streams_(0), 156 num_total_streams_(0),
161 task_runner_(task_runner), 157 task_runner_(task_runner),
162 net_log_(BoundNetLog::Make(net_log, NetLog::SOURCE_QUIC_SESSION)), 158 net_log_(BoundNetLog::Make(net_log, NetLog::SOURCE_QUIC_SESSION)),
163 logger_(new QuicConnectionLogger(net_log_)), 159 logger_(new QuicConnectionLogger(net_log_)),
164 num_packets_read_(0), 160 num_packets_read_(0),
165 going_away_(false), 161 going_away_(false),
166 weak_factory_(this) { 162 weak_factory_(this) {
167 crypto_stream_.reset( 163 crypto_stream_.reset(
(...skipping 318 matching lines...) Expand 10 before | Expand all | Expand 10 after
486 } 482 }
487 483
488 bool QuicClientSession::CanPool(const std::string& hostname) const { 484 bool QuicClientSession::CanPool(const std::string& hostname) const {
489 DCHECK(connection()->connected()); 485 DCHECK(connection()->connected());
490 SSLInfo ssl_info; 486 SSLInfo ssl_info;
491 if (!GetSSLInfo(&ssl_info) || !ssl_info.cert) { 487 if (!GetSSLInfo(&ssl_info) || !ssl_info.cert) {
492 // We can always pool with insecure QUIC sessions. 488 // We can always pool with insecure QUIC sessions.
493 return true; 489 return true;
494 } 490 }
495 491
496 return SpdySession::CanPool(transport_security_state_, ssl_info, 492 // Disable pooling for secure sessions.
497 server_host_port_.host(), hostname); 493 // TODO(rch): re-enable this.
494 return false;
495 #if 0
496 bool unused = false;
497 // Pooling is prohibited if the server cert is not valid for the new domain,
498 // and for connections on which client certs were sent. It is also prohibited
499 // when channel ID was sent if the hosts are from different eTLDs+1.
500 if (!ssl_info.cert->VerifyNameMatch(hostname, &unused))
501 return false;
502
503 if (ssl_info.client_cert_sent)
504 return false;
505
506 if (ssl_info.channel_id_sent &&
507 ChannelIDService::GetDomainForHost(hostname) !=
508 ChannelIDService::GetDomainForHost(server_host_port_.host())) {
509 return false;
510 }
511
512 return true;
513 #endif
498 } 514 }
499 515
500 QuicDataStream* QuicClientSession::CreateIncomingDataStream( 516 QuicDataStream* QuicClientSession::CreateIncomingDataStream(
501 QuicStreamId id) { 517 QuicStreamId id) {
502 DLOG(ERROR) << "Server push not supported"; 518 DLOG(ERROR) << "Server push not supported";
503 return NULL; 519 return NULL;
504 } 520 }
505 521
506 void QuicClientSession::CloseStream(QuicStreamId stream_id) { 522 void QuicClientSession::CloseStream(QuicStreamId stream_id) {
507 ReliableQuicStream* stream = GetStream(stream_id); 523 ReliableQuicStream* stream = GetStream(stream_id);
(...skipping 345 matching lines...) Expand 10 before | Expand all | Expand 10 after
853 return; 869 return;
854 870
855 // TODO(rch): re-enable this code once beta is cut. 871 // TODO(rch): re-enable this code once beta is cut.
856 // if (stream_factory_) 872 // if (stream_factory_)
857 // stream_factory_->OnSessionConnectTimeout(this); 873 // stream_factory_->OnSessionConnectTimeout(this);
858 // CloseAllStreams(ERR_QUIC_HANDSHAKE_FAILED); 874 // CloseAllStreams(ERR_QUIC_HANDSHAKE_FAILED);
859 // DCHECK_EQ(0u, GetNumOpenStreams()); 875 // DCHECK_EQ(0u, GetNumOpenStreams());
860 } 876 }
861 877
862 } // namespace net 878 } // namespace net
OLDNEW
« no previous file with comments | « trunk/src/net/quic/quic_client_session.h ('k') | trunk/src/net/quic/quic_client_session_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698