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

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: 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
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. 631 // TODO(rch): change the socket pool API to not require a full URL.
mmenke 2015/04/07 16:36:58 You're doing this here, so should remove the TODO
Ryan Hamilton 2015/04/07 19:07:30 Done.
632 if (alternative_service_.protocol >= NPN_SPDY_MINIMUM_VERSION && 632 if (alternative_service_.protocol >= NPN_SPDY_MINIMUM_VERSION &&
633 alternative_service_.protocol <= NPN_SPDY_MAXIMUM_VERSION) { 633 alternative_service_.protocol <= NPN_SPDY_MAXIMUM_VERSION) {
634 // TODO(rch): Figure out how to make QUIC iteract with PAC 634 // 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 635 // 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 636 // 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. 637 // the alternate request will be going via UDP to a different port.
638 GURL::Replacements replacements; 638 GURL::Replacements replacements;
639 // new_port needs to be in scope here because GURL::Replacements references 639 // new_port needs to be in scope here because GURL::Replacements references
640 // the memory contained by it directly. 640 // the memory contained by it directly.
641 const std::string new_port = base::IntToString(alternative_service_.port); 641 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_); 863 http_server_properties->MaybeForceHTTP11(server_, &server_ssl_config_);
864 if (proxy_info_.is_http() || proxy_info_.is_https()) { 864 if (proxy_info_.is_http() || proxy_info_.is_https()) {
865 http_server_properties->MaybeForceHTTP11( 865 http_server_properties->MaybeForceHTTP11(
866 proxy_info_.proxy_server().host_port_pair(), &proxy_ssl_config_); 866 proxy_info_.proxy_server().host_port_pair(), &proxy_ssl_config_);
867 } 867 }
868 } 868 }
869 869
870 if (IsPreconnecting()) { 870 if (IsPreconnecting()) {
871 DCHECK(!stream_factory_->for_websockets_); 871 DCHECK(!stream_factory_->for_websockets_);
872 return PreconnectSocketsForHttpRequest( 872 return PreconnectSocketsForHttpRequest(
873 alternative_service_url_, request_info_.extra_headers, 873 GetSocketGroup(), server_, request_info_.extra_headers,
874 request_info_.load_flags, priority_, session_, proxy_info_, 874 request_info_.load_flags, priority_, session_, proxy_info_,
875 ShouldForceSpdySSL(), want_spdy_over_npn, server_ssl_config_, 875 ShouldForceSpdySSL(), want_spdy_over_npn, server_ssl_config_,
876 proxy_ssl_config_, request_info_.privacy_mode, net_log_, num_streams_); 876 proxy_ssl_config_, request_info_.privacy_mode, net_log_, num_streams_);
877 } 877 }
878 878
879 // If we can't use a SPDY session, don't bother checking for one after 879 // If we can't use a SPDY session, don't bother checking for one after
880 // the hostname is resolved. 880 // the hostname is resolved.
881 OnHostResolutionCallback resolution_callback = CanUseExistingSpdySession() ? 881 OnHostResolutionCallback resolution_callback = CanUseExistingSpdySession() ?
882 base::Bind(&Job::OnHostResolution, session_->spdy_session_pool(), 882 base::Bind(&Job::OnHostResolution, session_->spdy_session_pool(),
883 GetSpdySessionKey()) : 883 GetSpdySessionKey()) :
884 OnHostResolutionCallback(); 884 OnHostResolutionCallback();
885 if (stream_factory_->for_websockets_) { 885 if (stream_factory_->for_websockets_) {
886 // TODO(ricea): Re-enable NPN when WebSockets over SPDY is supported. 886 // TODO(ricea): Re-enable NPN when WebSockets over SPDY is supported.
887 SSLConfig websocket_server_ssl_config = server_ssl_config_; 887 SSLConfig websocket_server_ssl_config = server_ssl_config_;
888 websocket_server_ssl_config.next_protos.clear(); 888 websocket_server_ssl_config.next_protos.clear();
889 return InitSocketHandleForWebSocketRequest( 889 return InitSocketHandleForWebSocketRequest(
890 origin_url_, request_info_.extra_headers, request_info_.load_flags, 890 GetSocketGroup(), server_, request_info_.extra_headers,
891 priority_, session_, proxy_info_, ShouldForceSpdySSL(), 891 request_info_.load_flags, priority_, session_, proxy_info_,
892 want_spdy_over_npn, websocket_server_ssl_config, proxy_ssl_config_, 892 ShouldForceSpdySSL(), want_spdy_over_npn, websocket_server_ssl_config,
893 request_info_.privacy_mode, net_log_, 893 proxy_ssl_config_, request_info_.privacy_mode, net_log_,
894 connection_.get(), resolution_callback, io_callback_); 894 connection_.get(), resolution_callback, io_callback_);
895 } 895 }
896 896
897 return InitSocketHandleForHttpRequest( 897 return InitSocketHandleForHttpRequest(
898 alternative_service_url_, request_info_.extra_headers, 898 GetSocketGroup(), server_, request_info_.extra_headers,
899 request_info_.load_flags, priority_, session_, proxy_info_, 899 request_info_.load_flags, priority_, session_, proxy_info_,
900 ShouldForceSpdySSL(), want_spdy_over_npn, server_ssl_config_, 900 ShouldForceSpdySSL(), want_spdy_over_npn, server_ssl_config_,
901 proxy_ssl_config_, request_info_.privacy_mode, net_log_, 901 proxy_ssl_config_, request_info_.privacy_mode, net_log_,
902 connection_.get(), resolution_callback, io_callback_); 902 connection_.get(), resolution_callback, io_callback_);
903 } 903 }
904 904
905 int HttpStreamFactoryImpl::Job::DoInitConnectionComplete(int result) { 905 int HttpStreamFactoryImpl::Job::DoInitConnectionComplete(int result) {
906 if (IsPreconnecting()) { 906 if (IsPreconnecting()) {
907 if (using_quic_) 907 if (using_quic_)
908 return result; 908 return result;
(...skipping 574 matching lines...) Expand 10 before | Expand all | Expand 10 after
1483 } 1483 }
1484 1484
1485 if (job_status_ == STATUS_SUCCEEDED && other_job_status_ == STATUS_BROKEN) { 1485 if (job_status_ == STATUS_SUCCEEDED && other_job_status_ == STATUS_BROKEN) {
1486 HistogramBrokenAlternateProtocolLocation( 1486 HistogramBrokenAlternateProtocolLocation(
1487 BROKEN_ALTERNATE_PROTOCOL_LOCATION_HTTP_STREAM_FACTORY_IMPL_JOB_MAIN); 1487 BROKEN_ALTERNATE_PROTOCOL_LOCATION_HTTP_STREAM_FACTORY_IMPL_JOB_MAIN);
1488 session_->http_server_properties()->MarkAlternativeServiceBroken( 1488 session_->http_server_properties()->MarkAlternativeServiceBroken(
1489 other_job_alternative_service_); 1489 other_job_alternative_service_);
1490 } 1490 }
1491 } 1491 }
1492 1492
1493 ClientSocketPoolManager::SocketGroupType
1494 HttpStreamFactoryImpl::Job::GetSocketGroup() {
1495 if (IsAlternate() &&
1496 alternative_service_.protocol >= NPN_SPDY_MINIMUM_VERSION &&
1497 alternative_service_.protocol <= NPN_SPDY_MAXIMUM_VERSION) {
1498 return ClientSocketPoolManager::SSL_GROUP;
mmenke 2015/04/07 16:36:58 This is kinda weird. In HttpStreamFactoryImpl::Jo
Ryan Hamilton 2015/04/07 19:07:30 Done. Good point. My slightly longer term object
1499 }
1500 return ClientSocketPoolManager::GroupTypeFromScheme(origin_url_.scheme());
1501 }
1502
1493 } // namespace net 1503 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698