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

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: enough! Created 5 years, 1 month 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_session.h ('k') | net/quic/quic_stream_factory_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_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(cert_verifier,
584 cert_policy_enforcer,
585 transport_security_state)),
583 supported_versions_(supported_versions), 586 supported_versions_(supported_versions),
584 enable_port_selection_(enable_port_selection), 587 enable_port_selection_(enable_port_selection),
585 always_require_handshake_confirmation_( 588 always_require_handshake_confirmation_(
586 always_require_handshake_confirmation), 589 always_require_handshake_confirmation),
587 disable_connection_pooling_(disable_connection_pooling), 590 disable_connection_pooling_(disable_connection_pooling),
588 load_server_info_timeout_srtt_multiplier_( 591 load_server_info_timeout_srtt_multiplier_(
589 load_server_info_timeout_srtt_multiplier), 592 load_server_info_timeout_srtt_multiplier),
590 enable_connection_racing_(enable_connection_racing), 593 enable_connection_racing_(enable_connection_racing),
591 enable_non_blocking_io_(enable_non_blocking_io), 594 enable_non_blocking_io_(enable_non_blocking_io),
592 disable_disk_cache_(disable_disk_cache), 595 disable_disk_cache_(disable_disk_cache),
(...skipping 19 matching lines...) Expand all
612 check_persisted_supports_quic_(true), 615 check_persisted_supports_quic_(true),
613 has_initialized_data_(false), 616 has_initialized_data_(false),
614 task_runner_(nullptr), 617 task_runner_(nullptr),
615 weak_factory_(this) { 618 weak_factory_(this) {
616 DCHECK(transport_security_state_); 619 DCHECK(transport_security_state_);
617 DCHECK(http_server_properties_); 620 DCHECK(http_server_properties_);
618 crypto_config_.set_user_agent_id(user_agent_id); 621 crypto_config_.set_user_agent_id(user_agent_id);
619 crypto_config_.AddCanonicalSuffix(".c.youtube.com"); 622 crypto_config_.AddCanonicalSuffix(".c.youtube.com");
620 crypto_config_.AddCanonicalSuffix(".googlevideo.com"); 623 crypto_config_.AddCanonicalSuffix(".googlevideo.com");
621 crypto_config_.AddCanonicalSuffix(".googleusercontent.com"); 624 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 625 // TODO(rtenneti): http://crbug.com/487355. Temporary fix for b/20760730 until
625 // channel_id_service is supported in cronet. 626 // channel_id_service is supported in cronet.
626 if (channel_id_service) { 627 if (channel_id_service) {
627 crypto_config_.SetChannelIDSource( 628 crypto_config_.SetChannelIDSource(
628 new ChannelIDSourceChromium(channel_id_service)); 629 new ChannelIDSourceChromium(channel_id_service));
629 } 630 }
630 #if defined(USE_OPENSSL) 631 #if defined(USE_OPENSSL)
631 crypto::EnsureOpenSSLInit(); 632 crypto::EnsureOpenSSLInit();
632 bool has_aes_hardware_support = !!EVP_has_aes_hardware(); 633 bool has_aes_hardware_support = !!EVP_has_aes_hardware();
633 #else 634 #else
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
688 quic_server_info_factory_.reset(quic_server_info_factory); 689 quic_server_info_factory_.reset(quic_server_info_factory);
689 } 690 }
690 691
691 int QuicStreamFactory::Create(const HostPortPair& host_port_pair, 692 int QuicStreamFactory::Create(const HostPortPair& host_port_pair,
692 PrivacyMode privacy_mode, 693 PrivacyMode privacy_mode,
693 int cert_verify_flags, 694 int cert_verify_flags,
694 base::StringPiece origin_host, 695 base::StringPiece origin_host,
695 base::StringPiece method, 696 base::StringPiece method,
696 const BoundNetLog& net_log, 697 const BoundNetLog& net_log,
697 QuicStreamRequest* request) { 698 QuicStreamRequest* request) {
698 QuicServerId server_id(host_port_pair, /*is_https=*/true, privacy_mode); 699 QuicServerId server_id(host_port_pair, privacy_mode);
699 SessionMap::iterator it = active_sessions_.find(server_id); 700 SessionMap::iterator it = active_sessions_.find(server_id);
700 if (it != active_sessions_.end()) { 701 if (it != active_sessions_.end()) {
701 QuicChromiumClientSession* session = it->second; 702 QuicChromiumClientSession* session = it->second;
702 if (!session->CanPool(origin_host.as_string(), privacy_mode)) 703 if (!session->CanPool(origin_host.as_string(), privacy_mode))
703 return ERR_ALTERNATIVE_CERT_NOT_VALID_FOR_ORIGIN; 704 return ERR_ALTERNATIVE_CERT_NOT_VALID_FOR_ORIGIN;
704 request->set_stream(CreateFromSession(session)); 705 request->set_stream(CreateFromSession(session));
705 return OK; 706 return OK;
706 } 707 }
707 708
708 if (HasActiveJob(server_id)) { 709 if (HasActiveJob(server_id)) {
(...skipping 516 matching lines...) Expand 10 before | Expand all | Expand 10 after
1225 DefaultPacketWriterFactory packet_writer_factory(socket.get()); 1226 DefaultPacketWriterFactory packet_writer_factory(socket.get());
1226 1227
1227 if (!helper_.get()) { 1228 if (!helper_.get()) {
1228 helper_.reset( 1229 helper_.reset(
1229 new QuicConnectionHelper(base::ThreadTaskRunnerHandle::Get().get(), 1230 new QuicConnectionHelper(base::ThreadTaskRunnerHandle::Get().get(),
1230 clock_.get(), random_generator_)); 1231 clock_.get(), random_generator_));
1231 } 1232 }
1232 1233
1233 QuicConnection* connection = new QuicConnection( 1234 QuicConnection* connection = new QuicConnection(
1234 connection_id, addr, helper_.get(), packet_writer_factory, 1235 connection_id, addr, helper_.get(), packet_writer_factory,
1235 true /* owns_writer */, Perspective::IS_CLIENT, /*is_https=*/true, 1236 true /* owns_writer */, Perspective::IS_CLIENT, supported_versions_);
1236 supported_versions_);
1237 connection->SetMaxPacketLength(max_packet_length_); 1237 connection->SetMaxPacketLength(max_packet_length_);
1238 1238
1239 InitializeCachedStateInCryptoConfig(server_id, server_info); 1239 InitializeCachedStateInCryptoConfig(server_id, server_info);
1240 1240
1241 QuicConfig config = config_; 1241 QuicConfig config = config_;
1242 config.SetSocketReceiveBufferToSend(socket_receive_buffer_size_); 1242 config.SetSocketReceiveBufferToSend(socket_receive_buffer_size_);
1243 config.set_max_undecryptable_packets(kMaxUndecryptablePackets); 1243 config.set_max_undecryptable_packets(kMaxUndecryptablePackets);
1244 config.SetInitialSessionFlowControlWindowToSend( 1244 config.SetInitialSessionFlowControlWindowToSend(
1245 kQuicSessionMaxRecvWindowSize); 1245 kQuicSessionMaxRecvWindowSize);
1246 config.SetInitialStreamFlowControlWindowToSend(kQuicStreamMaxRecvWindowSize); 1246 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 1426 // Since the session was active, there's no longer an
1427 // HttpStreamFactoryImpl::Job running which can mark it broken, unless the TCP 1427 // 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 1428 // 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 1429 // it as recently broken, which means that 0-RTT will be disabled but we'll
1430 // still race. 1430 // still race.
1431 http_server_properties_->MarkAlternativeServiceRecentlyBroken( 1431 http_server_properties_->MarkAlternativeServiceRecentlyBroken(
1432 alternative_service); 1432 alternative_service);
1433 } 1433 }
1434 1434
1435 } // namespace net 1435 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/quic_session.h ('k') | net/quic/quic_stream_factory_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698