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

Side by Side Diff: net/http/http_stream_factory_impl_job.cc

Issue 1051023003: Change ClientSocketPoolManager::InitSocketHandleForHttpRequest and friends (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix comments Created 5 years, 8 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/http/http_stream_factory_impl_job.h ('k') | net/socket/client_socket_pool_manager.h » ('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/http/http_stream_factory_impl_job.h" 5 #include "net/http/http_stream_factory_impl_job.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <string> 8 #include <string>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 610 matching lines...) Expand 10 before | Expand all | Expand 10 after
621 } else { 621 } else {
622 server_ = HostPortPair::FromURL(request_info_.url); 622 server_ = HostPortPair::FromURL(request_info_.url);
623 } 623 }
624 origin_url_ = 624 origin_url_ =
625 stream_factory_->ApplyHostMappingRules(request_info_.url, &server_); 625 stream_factory_->ApplyHostMappingRules(request_info_.url, &server_);
626 alternative_service_url_ = origin_url_; 626 alternative_service_url_ = origin_url_;
627 // For SPDY via Alt-Svc, set |alternative_service_url_| to 627 // For SPDY via Alt-Svc, set |alternative_service_url_| to
628 // https://<alternative host>:<alternative port>/... 628 // https://<alternative host>:<alternative port>/...
629 // so the proxy resolution works with the actual destination, and so 629 // so the proxy resolution works with the actual destination, and so
630 // that the correct socket pool is used. 630 // that the correct socket pool is used.
631 // TODO(rch): change the socket pool API to not require a full URL.
632 if (alternative_service_.protocol >= NPN_SPDY_MINIMUM_VERSION && 631 if (alternative_service_.protocol >= NPN_SPDY_MINIMUM_VERSION &&
633 alternative_service_.protocol <= NPN_SPDY_MAXIMUM_VERSION) { 632 alternative_service_.protocol <= NPN_SPDY_MAXIMUM_VERSION) {
634 // TODO(rch): Figure out how to make QUIC iteract with PAC 633 // TODO(rch): Figure out how to make QUIC iteract with PAC
635 // scripts. By not re-writing the URL, we will query the PAC script 634 // scripts. By not re-writing the URL, we will query the PAC script
636 // for the proxy to use to reach the original URL via TCP. But 635 // for the proxy to use to reach the original URL via TCP. But
637 // the alternate request will be going via UDP to a different port. 636 // the alternate request will be going via UDP to a different port.
638 GURL::Replacements replacements; 637 GURL::Replacements replacements;
639 // new_port needs to be in scope here because GURL::Replacements references 638 // new_port needs to be in scope here because GURL::Replacements references
640 // the memory contained by it directly. 639 // the memory contained by it directly.
641 const std::string new_port = base::IntToString(alternative_service_.port); 640 const std::string new_port = base::IntToString(alternative_service_.port);
(...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after
863 http_server_properties->MaybeForceHTTP11(server_, &server_ssl_config_); 862 http_server_properties->MaybeForceHTTP11(server_, &server_ssl_config_);
864 if (proxy_info_.is_http() || proxy_info_.is_https()) { 863 if (proxy_info_.is_http() || proxy_info_.is_https()) {
865 http_server_properties->MaybeForceHTTP11( 864 http_server_properties->MaybeForceHTTP11(
866 proxy_info_.proxy_server().host_port_pair(), &proxy_ssl_config_); 865 proxy_info_.proxy_server().host_port_pair(), &proxy_ssl_config_);
867 } 866 }
868 } 867 }
869 868
870 if (IsPreconnecting()) { 869 if (IsPreconnecting()) {
871 DCHECK(!stream_factory_->for_websockets_); 870 DCHECK(!stream_factory_->for_websockets_);
872 return PreconnectSocketsForHttpRequest( 871 return PreconnectSocketsForHttpRequest(
873 alternative_service_url_, request_info_.extra_headers, 872 GetSocketGroup(), server_, request_info_.extra_headers,
874 request_info_.load_flags, priority_, session_, proxy_info_, 873 request_info_.load_flags, priority_, session_, proxy_info_,
875 ShouldForceSpdySSL(), want_spdy_over_npn, server_ssl_config_, 874 ShouldForceSpdySSL(), want_spdy_over_npn, server_ssl_config_,
876 proxy_ssl_config_, request_info_.privacy_mode, net_log_, num_streams_); 875 proxy_ssl_config_, request_info_.privacy_mode, net_log_, num_streams_);
877 } 876 }
878 877
879 // If we can't use a SPDY session, don't bother checking for one after 878 // If we can't use a SPDY session, don't bother checking for one after
880 // the hostname is resolved. 879 // the hostname is resolved.
881 OnHostResolutionCallback resolution_callback = CanUseExistingSpdySession() ? 880 OnHostResolutionCallback resolution_callback = CanUseExistingSpdySession() ?
882 base::Bind(&Job::OnHostResolution, session_->spdy_session_pool(), 881 base::Bind(&Job::OnHostResolution, session_->spdy_session_pool(),
883 GetSpdySessionKey()) : 882 GetSpdySessionKey()) :
884 OnHostResolutionCallback(); 883 OnHostResolutionCallback();
885 if (stream_factory_->for_websockets_) { 884 if (stream_factory_->for_websockets_) {
886 // TODO(ricea): Re-enable NPN when WebSockets over SPDY is supported. 885 // TODO(ricea): Re-enable NPN when WebSockets over SPDY is supported.
887 SSLConfig websocket_server_ssl_config = server_ssl_config_; 886 SSLConfig websocket_server_ssl_config = server_ssl_config_;
888 websocket_server_ssl_config.next_protos.clear(); 887 websocket_server_ssl_config.next_protos.clear();
889 return InitSocketHandleForWebSocketRequest( 888 return InitSocketHandleForWebSocketRequest(
890 origin_url_, request_info_.extra_headers, request_info_.load_flags, 889 GetSocketGroup(), server_, request_info_.extra_headers,
891 priority_, session_, proxy_info_, ShouldForceSpdySSL(), 890 request_info_.load_flags, priority_, session_, proxy_info_,
892 want_spdy_over_npn, websocket_server_ssl_config, proxy_ssl_config_, 891 ShouldForceSpdySSL(), want_spdy_over_npn, websocket_server_ssl_config,
893 request_info_.privacy_mode, net_log_, 892 proxy_ssl_config_, request_info_.privacy_mode, net_log_,
894 connection_.get(), resolution_callback, io_callback_); 893 connection_.get(), resolution_callback, io_callback_);
895 } 894 }
896 895
897 return InitSocketHandleForHttpRequest( 896 return InitSocketHandleForHttpRequest(
898 alternative_service_url_, request_info_.extra_headers, 897 GetSocketGroup(), server_, request_info_.extra_headers,
899 request_info_.load_flags, priority_, session_, proxy_info_, 898 request_info_.load_flags, priority_, session_, proxy_info_,
900 ShouldForceSpdySSL(), want_spdy_over_npn, server_ssl_config_, 899 ShouldForceSpdySSL(), want_spdy_over_npn, server_ssl_config_,
901 proxy_ssl_config_, request_info_.privacy_mode, net_log_, 900 proxy_ssl_config_, request_info_.privacy_mode, net_log_,
902 connection_.get(), resolution_callback, io_callback_); 901 connection_.get(), resolution_callback, io_callback_);
903 } 902 }
904 903
905 int HttpStreamFactoryImpl::Job::DoInitConnectionComplete(int result) { 904 int HttpStreamFactoryImpl::Job::DoInitConnectionComplete(int result) {
906 if (IsPreconnecting()) { 905 if (IsPreconnecting()) {
907 if (using_quic_) 906 if (using_quic_)
908 return result; 907 return result;
(...skipping 574 matching lines...) Expand 10 before | Expand all | Expand 10 after
1483 } 1482 }
1484 1483
1485 if (job_status_ == STATUS_SUCCEEDED && other_job_status_ == STATUS_BROKEN) { 1484 if (job_status_ == STATUS_SUCCEEDED && other_job_status_ == STATUS_BROKEN) {
1486 HistogramBrokenAlternateProtocolLocation( 1485 HistogramBrokenAlternateProtocolLocation(
1487 BROKEN_ALTERNATE_PROTOCOL_LOCATION_HTTP_STREAM_FACTORY_IMPL_JOB_MAIN); 1486 BROKEN_ALTERNATE_PROTOCOL_LOCATION_HTTP_STREAM_FACTORY_IMPL_JOB_MAIN);
1488 session_->http_server_properties()->MarkAlternativeServiceBroken( 1487 session_->http_server_properties()->MarkAlternativeServiceBroken(
1489 other_job_alternative_service_); 1488 other_job_alternative_service_);
1490 } 1489 }
1491 } 1490 }
1492 1491
1492 ClientSocketPoolManager::SocketGroupType
1493 HttpStreamFactoryImpl::Job::GetSocketGroup() const {
1494 if (ShouldForceSpdySSL())
1495 return ClientSocketPoolManager::SSL_GROUP;
1496
1497 return ClientSocketPoolManager::GroupTypeFromScheme(
1498 alternative_service_url_.scheme());
1499 }
1500
1493 } // namespace net 1501 } // namespace net
OLDNEW
« no previous file with comments | « net/http/http_stream_factory_impl_job.h ('k') | net/socket/client_socket_pool_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698