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

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

Issue 1411063004: Remove insecure QUIC support (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 2 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
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_stream_factory.h" 5 #include "net/quic/quic_stream_factory.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <set> 8 #include <set>
9 9
10 #include "base/location.h" 10 #include "base/location.h"
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after
210 bool server_and_origin_have_same_host, 210 bool server_and_origin_have_same_host,
211 bool was_alternative_service_recently_broken, 211 bool was_alternative_service_recently_broken,
212 PrivacyMode privacy_mode, 212 PrivacyMode privacy_mode,
213 int cert_verify_flags, 213 int cert_verify_flags,
214 bool is_post, 214 bool is_post,
215 QuicServerInfo* server_info, 215 QuicServerInfo* server_info,
216 const BoundNetLog& net_log) 216 const BoundNetLog& net_log)
217 : io_state_(STATE_RESOLVE_HOST), 217 : io_state_(STATE_RESOLVE_HOST),
218 factory_(factory), 218 factory_(factory),
219 host_resolver_(host_resolver), 219 host_resolver_(host_resolver),
220 server_id_(host_port_pair, /*is_https=*/true, privacy_mode), 220 server_id_(host_port_pair, privacy_mode),
221 cert_verify_flags_(cert_verify_flags), 221 cert_verify_flags_(cert_verify_flags),
222 server_and_origin_have_same_host_(server_and_origin_have_same_host), 222 server_and_origin_have_same_host_(server_and_origin_have_same_host),
223 is_post_(is_post), 223 is_post_(is_post),
224 was_alternative_service_recently_broken_( 224 was_alternative_service_recently_broken_(
225 was_alternative_service_recently_broken), 225 was_alternative_service_recently_broken),
226 server_info_(server_info), 226 server_info_(server_info),
227 started_another_job_(false), 227 started_another_job_(false),
228 net_log_(net_log), 228 net_log_(net_log),
229 session_(nullptr), 229 session_(nullptr),
230 weak_factory_(this) {} 230 weak_factory_(this) {}
(...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after
522 522
523 void QuicStreamRequest::OnRequestComplete(int rv) { 523 void QuicStreamRequest::OnRequestComplete(int rv) {
524 factory_ = nullptr; 524 factory_ = nullptr;
525 callback_.Run(rv); 525 callback_.Run(rv);
526 } 526 }
527 527
528 base::TimeDelta QuicStreamRequest::GetTimeDelayForWaitingJob() const { 528 base::TimeDelta QuicStreamRequest::GetTimeDelayForWaitingJob() const {
529 if (!factory_) 529 if (!factory_)
530 return base::TimeDelta(); 530 return base::TimeDelta();
531 return factory_->GetTimeDelayForWaitingJob( 531 return factory_->GetTimeDelayForWaitingJob(
532 QuicServerId(host_port_pair_, /*is_https=*/true, privacy_mode_)); 532 QuicServerId(host_port_pair_, privacy_mode_));
533 } 533 }
534 534
535 scoped_ptr<QuicHttpStream> QuicStreamRequest::ReleaseStream() { 535 scoped_ptr<QuicHttpStream> QuicStreamRequest::ReleaseStream() {
536 DCHECK(stream_); 536 DCHECK(stream_);
537 return stream_.Pass(); 537 return stream_.Pass();
538 } 538 }
539 539
540 QuicStreamFactory::QuicStreamFactory( 540 QuicStreamFactory::QuicStreamFactory(
541 HostResolver* host_resolver, 541 HostResolver* host_resolver,
542 ClientSocketFactory* client_socket_factory, 542 ClientSocketFactory* client_socket_factory,
(...skipping 30 matching lines...) Expand all
573 host_resolver_(host_resolver), 573 host_resolver_(host_resolver),
574 client_socket_factory_(client_socket_factory), 574 client_socket_factory_(client_socket_factory),
575 http_server_properties_(http_server_properties), 575 http_server_properties_(http_server_properties),
576 transport_security_state_(transport_security_state), 576 transport_security_state_(transport_security_state),
577 quic_crypto_client_stream_factory_(quic_crypto_client_stream_factory), 577 quic_crypto_client_stream_factory_(quic_crypto_client_stream_factory),
578 random_generator_(random_generator), 578 random_generator_(random_generator),
579 clock_(clock), 579 clock_(clock),
580 max_packet_length_(max_packet_length), 580 max_packet_length_(max_packet_length),
581 socket_performance_watcher_factory_(socket_performance_watcher_factory), 581 socket_performance_watcher_factory_(socket_performance_watcher_factory),
582 config_(InitializeQuicConfig(connection_options)), 582 config_(InitializeQuicConfig(connection_options)),
583 crypto_config_(new ProofVerifierChromium(
584 cert_verifier, cert_policy_enforcer, transport_security_state)),
583 supported_versions_(supported_versions), 585 supported_versions_(supported_versions),
584 enable_port_selection_(enable_port_selection), 586 enable_port_selection_(enable_port_selection),
585 always_require_handshake_confirmation_( 587 always_require_handshake_confirmation_(
586 always_require_handshake_confirmation), 588 always_require_handshake_confirmation),
587 disable_connection_pooling_(disable_connection_pooling), 589 disable_connection_pooling_(disable_connection_pooling),
588 load_server_info_timeout_srtt_multiplier_( 590 load_server_info_timeout_srtt_multiplier_(
589 load_server_info_timeout_srtt_multiplier), 591 load_server_info_timeout_srtt_multiplier),
590 enable_connection_racing_(enable_connection_racing), 592 enable_connection_racing_(enable_connection_racing),
591 enable_non_blocking_io_(enable_non_blocking_io), 593 enable_non_blocking_io_(enable_non_blocking_io),
592 disable_disk_cache_(disable_disk_cache), 594 disable_disk_cache_(disable_disk_cache),
(...skipping 19 matching lines...) Expand all
612 check_persisted_supports_quic_(true), 614 check_persisted_supports_quic_(true),
613 has_initialized_data_(false), 615 has_initialized_data_(false),
614 task_runner_(nullptr), 616 task_runner_(nullptr),
615 weak_factory_(this) { 617 weak_factory_(this) {
616 DCHECK(transport_security_state_); 618 DCHECK(transport_security_state_);
617 DCHECK(http_server_properties_); 619 DCHECK(http_server_properties_);
618 crypto_config_.set_user_agent_id(user_agent_id); 620 crypto_config_.set_user_agent_id(user_agent_id);
619 crypto_config_.AddCanonicalSuffix(".c.youtube.com"); 621 crypto_config_.AddCanonicalSuffix(".c.youtube.com");
620 crypto_config_.AddCanonicalSuffix(".googlevideo.com"); 622 crypto_config_.AddCanonicalSuffix(".googlevideo.com");
621 crypto_config_.AddCanonicalSuffix(".googleusercontent.com"); 623 crypto_config_.AddCanonicalSuffix(".googleusercontent.com");
622 crypto_config_.SetProofVerifier(new ProofVerifierChromium(
623 cert_verifier, cert_policy_enforcer, transport_security_state));
624 // TODO(rtenneti): http://crbug.com/487355. Temporary fix for b/20760730 until 624 // TODO(rtenneti): http://crbug.com/487355. Temporary fix for b/20760730 until
625 // channel_id_service is supported in cronet. 625 // channel_id_service is supported in cronet.
626 if (channel_id_service) { 626 if (channel_id_service) {
627 crypto_config_.SetChannelIDSource( 627 crypto_config_.SetChannelIDSource(
628 new ChannelIDSourceChromium(channel_id_service)); 628 new ChannelIDSourceChromium(channel_id_service));
629 } 629 }
630 #if defined(USE_OPENSSL) 630 #if defined(USE_OPENSSL)
631 crypto::EnsureOpenSSLInit(); 631 crypto::EnsureOpenSSLInit();
632 bool has_aes_hardware_support = !!EVP_has_aes_hardware(); 632 bool has_aes_hardware_support = !!EVP_has_aes_hardware();
633 #else 633 #else
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
688 quic_server_info_factory_.reset(quic_server_info_factory); 688 quic_server_info_factory_.reset(quic_server_info_factory);
689 } 689 }
690 690
691 int QuicStreamFactory::Create(const HostPortPair& host_port_pair, 691 int QuicStreamFactory::Create(const HostPortPair& host_port_pair,
692 PrivacyMode privacy_mode, 692 PrivacyMode privacy_mode,
693 int cert_verify_flags, 693 int cert_verify_flags,
694 base::StringPiece origin_host, 694 base::StringPiece origin_host,
695 base::StringPiece method, 695 base::StringPiece method,
696 const BoundNetLog& net_log, 696 const BoundNetLog& net_log,
697 QuicStreamRequest* request) { 697 QuicStreamRequest* request) {
698 QuicServerId server_id(host_port_pair, /*is_https=*/true, privacy_mode); 698 QuicServerId server_id(host_port_pair, privacy_mode);
699 SessionMap::iterator it = active_sessions_.find(server_id); 699 SessionMap::iterator it = active_sessions_.find(server_id);
700 if (it != active_sessions_.end()) { 700 if (it != active_sessions_.end()) {
701 QuicChromiumClientSession* session = it->second; 701 QuicChromiumClientSession* session = it->second;
702 if (!session->CanPool(origin_host.as_string(), privacy_mode)) 702 if (!session->CanPool(origin_host.as_string(), privacy_mode))
703 return ERR_ALTERNATIVE_CERT_NOT_VALID_FOR_ORIGIN; 703 return ERR_ALTERNATIVE_CERT_NOT_VALID_FOR_ORIGIN;
704 request->set_stream(CreateFromSession(session)); 704 request->set_stream(CreateFromSession(session));
705 return OK; 705 return OK;
706 } 706 }
707 707
708 if (HasActiveJob(server_id)) { 708 if (HasActiveJob(server_id)) {
(...skipping 516 matching lines...) Expand 10 before | Expand all | Expand 10 after
1225 DefaultPacketWriterFactory packet_writer_factory(socket.get()); 1225 DefaultPacketWriterFactory packet_writer_factory(socket.get());
1226 1226
1227 if (!helper_.get()) { 1227 if (!helper_.get()) {
1228 helper_.reset( 1228 helper_.reset(
1229 new QuicConnectionHelper(base::ThreadTaskRunnerHandle::Get().get(), 1229 new QuicConnectionHelper(base::ThreadTaskRunnerHandle::Get().get(),
1230 clock_.get(), random_generator_)); 1230 clock_.get(), random_generator_));
1231 } 1231 }
1232 1232
1233 QuicConnection* connection = new QuicConnection( 1233 QuicConnection* connection = new QuicConnection(
1234 connection_id, addr, helper_.get(), packet_writer_factory, 1234 connection_id, addr, helper_.get(), packet_writer_factory,
1235 true /* owns_writer */, Perspective::IS_CLIENT, /*is_https=*/true, 1235 true /* owns_writer */, Perspective::IS_CLIENT, supported_versions_);
1236 supported_versions_);
1237 connection->SetMaxPacketLength(max_packet_length_); 1236 connection->SetMaxPacketLength(max_packet_length_);
1238 1237
1239 InitializeCachedStateInCryptoConfig(server_id, server_info); 1238 InitializeCachedStateInCryptoConfig(server_id, server_info);
1240 1239
1241 QuicConfig config = config_; 1240 QuicConfig config = config_;
1242 config.SetSocketReceiveBufferToSend(socket_receive_buffer_size_); 1241 config.SetSocketReceiveBufferToSend(socket_receive_buffer_size_);
1243 config.set_max_undecryptable_packets(kMaxUndecryptablePackets); 1242 config.set_max_undecryptable_packets(kMaxUndecryptablePackets);
1244 config.SetInitialSessionFlowControlWindowToSend( 1243 config.SetInitialSessionFlowControlWindowToSend(
1245 kQuicSessionMaxRecvWindowSize); 1244 kQuicSessionMaxRecvWindowSize);
1246 config.SetInitialStreamFlowControlWindowToSend(kQuicStreamMaxRecvWindowSize); 1245 config.SetInitialStreamFlowControlWindowToSend(kQuicStreamMaxRecvWindowSize);
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after
1426 // Since the session was active, there's no longer an 1425 // Since the session was active, there's no longer an
1427 // HttpStreamFactoryImpl::Job running which can mark it broken, unless the TCP 1426 // HttpStreamFactoryImpl::Job running which can mark it broken, unless the TCP
1428 // job also fails. So to avoid not using QUIC when we otherwise could, we mark 1427 // job also fails. So to avoid not using QUIC when we otherwise could, we mark
1429 // it as recently broken, which means that 0-RTT will be disabled but we'll 1428 // it as recently broken, which means that 0-RTT will be disabled but we'll
1430 // still race. 1429 // still race.
1431 http_server_properties_->MarkAlternativeServiceRecentlyBroken( 1430 http_server_properties_->MarkAlternativeServiceRecentlyBroken(
1432 alternative_service); 1431 alternative_service);
1433 } 1432 }
1434 1433
1435 } // namespace net 1434 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698