OLD | NEW |
1 // Copyright (c) 2016 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2016 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_controller.h" | 5 #include "net/http/http_stream_factory_impl_job_controller.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 #include <utility> | 8 #include <utility> |
9 | 9 |
10 #include "base/memory/ptr_util.h" | 10 #include "base/memory/ptr_util.h" |
(...skipping 615 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
626 CHECK(request_); | 626 CHECK(request_); |
627 session_->spdy_session_pool()->RemoveRequestFromSpdySessionRequestMap( | 627 session_->spdy_session_pool()->RemoveRequestFromSpdySessionRequestMap( |
628 request_); | 628 request_); |
629 } | 629 } |
630 | 630 |
631 const NetLogWithSource* HttpStreamFactoryImpl::JobController::GetNetLog() | 631 const NetLogWithSource* HttpStreamFactoryImpl::JobController::GetNetLog() |
632 const { | 632 const { |
633 return &net_log_; | 633 return &net_log_; |
634 } | 634 } |
635 | 635 |
| 636 const QuicVersionVector& |
| 637 HttpStreamFactoryImpl::JobController::GetAdvertisedQuicVersions() const { |
| 638 return alternative_service_info_.advertised_versions(); |
| 639 } |
| 640 |
636 void HttpStreamFactoryImpl::JobController::MaybeSetWaitTimeForMainJob( | 641 void HttpStreamFactoryImpl::JobController::MaybeSetWaitTimeForMainJob( |
637 const base::TimeDelta& delay) { | 642 const base::TimeDelta& delay) { |
638 if (main_job_is_blocked_) { | 643 if (main_job_is_blocked_) { |
639 main_job_wait_time_ = std::min( | 644 main_job_wait_time_ = std::min( |
640 delay, base::TimeDelta::FromSeconds(kMaxDelayTimeForMainJobSecs)); | 645 delay, base::TimeDelta::FromSeconds(kMaxDelayTimeForMainJobSecs)); |
641 } | 646 } |
642 } | 647 } |
643 | 648 |
644 bool HttpStreamFactoryImpl::JobController::HasPendingMainJob() const { | 649 bool HttpStreamFactoryImpl::JobController::HasPendingMainJob() const { |
645 return main_job_.get() != nullptr; | 650 return main_job_.get() != nullptr; |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
763 } | 768 } |
764 | 769 |
765 int HttpStreamFactoryImpl::JobController::DoCreateJobs() { | 770 int HttpStreamFactoryImpl::JobController::DoCreateJobs() { |
766 DCHECK(!main_job_); | 771 DCHECK(!main_job_); |
767 DCHECK(!alternative_job_); | 772 DCHECK(!alternative_job_); |
768 | 773 |
769 HostPortPair destination(HostPortPair::FromURL(request_info_.url)); | 774 HostPortPair destination(HostPortPair::FromURL(request_info_.url)); |
770 GURL origin_url = ApplyHostMappingRules(request_info_.url, &destination); | 775 GURL origin_url = ApplyHostMappingRules(request_info_.url, &destination); |
771 | 776 |
772 // Create an alternative job if alternative service is set up for this domain. | 777 // Create an alternative job if alternative service is set up for this domain. |
773 alternative_service_ = | 778 alternative_service_info_ = |
774 GetAlternativeServiceInfoFor(request_info_, delegate_, stream_type_) | 779 GetAlternativeServiceInfoFor(request_info_, delegate_, stream_type_); |
775 .alternative_service(); | |
776 | 780 |
777 if (is_preconnect_) { | 781 if (is_preconnect_) { |
778 // Due to how the socket pools handle priorities and idle sockets, only IDLE | 782 // Due to how the socket pools handle priorities and idle sockets, only IDLE |
779 // priority currently makes sense for preconnects. The priority for | 783 // priority currently makes sense for preconnects. The priority for |
780 // preconnects is currently ignored (see RequestSocketsForPool()), but could | 784 // preconnects is currently ignored (see RequestSocketsForPool()), but could |
781 // be used at some point for proxy resolution or something. | 785 // be used at some point for proxy resolution or something. |
782 if (alternative_service_.protocol != kProtoUnknown) { | 786 if (alternative_service_info_.protocol() != kProtoUnknown) { |
783 HostPortPair alternative_destination( | 787 HostPortPair alternative_destination( |
784 alternative_service_.host_port_pair()); | 788 alternative_service_info_.host_port_pair()); |
785 ignore_result( | 789 ignore_result( |
786 ApplyHostMappingRules(request_info_.url, &alternative_destination)); | 790 ApplyHostMappingRules(request_info_.url, &alternative_destination)); |
787 main_job_ = job_factory_->CreateAltSvcJob( | 791 main_job_ = job_factory_->CreateAltSvcJob( |
788 this, PRECONNECT, session_, request_info_, IDLE, proxy_info_, | 792 this, PRECONNECT, session_, request_info_, IDLE, proxy_info_, |
789 server_ssl_config_, proxy_ssl_config_, alternative_destination, | 793 server_ssl_config_, proxy_ssl_config_, alternative_destination, |
790 origin_url, alternative_service_.protocol, enable_ip_based_pooling_, | 794 origin_url, alternative_service_info_.protocol(), |
791 session_->net_log()); | 795 enable_ip_based_pooling_, session_->net_log()); |
792 } else { | 796 } else { |
793 main_job_ = job_factory_->CreateMainJob( | 797 main_job_ = job_factory_->CreateMainJob( |
794 this, PRECONNECT, session_, request_info_, IDLE, proxy_info_, | 798 this, PRECONNECT, session_, request_info_, IDLE, proxy_info_, |
795 server_ssl_config_, proxy_ssl_config_, destination, origin_url, | 799 server_ssl_config_, proxy_ssl_config_, destination, origin_url, |
796 enable_ip_based_pooling_, session_->net_log()); | 800 enable_ip_based_pooling_, session_->net_log()); |
797 } | 801 } |
798 main_job_->Preconnect(num_streams_); | 802 main_job_->Preconnect(num_streams_); |
799 return OK; | 803 return OK; |
800 } | 804 } |
801 main_job_ = job_factory_->CreateMainJob( | 805 main_job_ = job_factory_->CreateMainJob( |
802 this, MAIN, session_, request_info_, priority_, proxy_info_, | 806 this, MAIN, session_, request_info_, priority_, proxy_info_, |
803 server_ssl_config_, proxy_ssl_config_, destination, origin_url, | 807 server_ssl_config_, proxy_ssl_config_, destination, origin_url, |
804 enable_ip_based_pooling_, net_log_.net_log()); | 808 enable_ip_based_pooling_, net_log_.net_log()); |
805 // Alternative Service can only be set for HTTPS requests while Alternative | 809 // Alternative Service can only be set for HTTPS requests while Alternative |
806 // Proxy is set for HTTP requests. | 810 // Proxy is set for HTTP requests. |
807 if (alternative_service_.protocol != kProtoUnknown) { | 811 if (alternative_service_info_.protocol() != kProtoUnknown) { |
808 // Never share connection with other jobs for FTP requests. | 812 // Never share connection with other jobs for FTP requests. |
809 DVLOG(1) << "Selected alternative service (host: " | 813 DVLOG(1) << "Selected alternative service (host: " |
810 << alternative_service_.host_port_pair().host() | 814 << alternative_service_info_.host_port_pair().host() |
811 << " port: " << alternative_service_.host_port_pair().port() | 815 << " port: " << alternative_service_info_.host_port_pair().port() |
812 << ")"; | 816 << ")"; |
813 | 817 |
814 DCHECK(!request_info_.url.SchemeIs(url::kFtpScheme)); | 818 DCHECK(!request_info_.url.SchemeIs(url::kFtpScheme)); |
815 HostPortPair alternative_destination(alternative_service_.host_port_pair()); | 819 HostPortPair alternative_destination( |
| 820 alternative_service_info_.host_port_pair()); |
816 ignore_result( | 821 ignore_result( |
817 ApplyHostMappingRules(request_info_.url, &alternative_destination)); | 822 ApplyHostMappingRules(request_info_.url, &alternative_destination)); |
818 | 823 |
819 alternative_job_ = job_factory_->CreateAltSvcJob( | 824 alternative_job_ = job_factory_->CreateAltSvcJob( |
820 this, ALTERNATIVE, session_, request_info_, priority_, proxy_info_, | 825 this, ALTERNATIVE, session_, request_info_, priority_, proxy_info_, |
821 server_ssl_config_, proxy_ssl_config_, alternative_destination, | 826 server_ssl_config_, proxy_ssl_config_, alternative_destination, |
822 origin_url, alternative_service_.protocol, enable_ip_based_pooling_, | 827 origin_url, alternative_service_info_.protocol(), |
823 net_log_.net_log()); | 828 enable_ip_based_pooling_, net_log_.net_log()); |
824 | 829 |
825 main_job_is_blocked_ = true; | 830 main_job_is_blocked_ = true; |
826 alternative_job_->Start(request_->stream_type()); | 831 alternative_job_->Start(request_->stream_type()); |
827 } else { | 832 } else { |
828 ProxyServer alternative_proxy_server; | 833 ProxyServer alternative_proxy_server; |
829 if (ShouldCreateAlternativeProxyServerJob(proxy_info_, request_info_.url, | 834 if (ShouldCreateAlternativeProxyServerJob(proxy_info_, request_info_.url, |
830 &alternative_proxy_server)) { | 835 &alternative_proxy_server)) { |
831 DCHECK(!main_job_is_blocked_); | 836 DCHECK(!main_job_is_blocked_); |
832 ProxyInfo alternative_proxy_info; | 837 ProxyInfo alternative_proxy_info; |
833 alternative_proxy_info.UseProxyServer(alternative_proxy_server); | 838 alternative_proxy_info.UseProxyServer(alternative_proxy_server); |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
941 NextProto negotiated_protocol, | 946 NextProto negotiated_protocol, |
942 bool using_spdy) { | 947 bool using_spdy) { |
943 if (request_) | 948 if (request_) |
944 request_->Complete(was_alpn_negotiated, negotiated_protocol, using_spdy); | 949 request_->Complete(was_alpn_negotiated, negotiated_protocol, using_spdy); |
945 } | 950 } |
946 | 951 |
947 void HttpStreamFactoryImpl::JobController::OnAlternativeServiceJobFailed( | 952 void HttpStreamFactoryImpl::JobController::OnAlternativeServiceJobFailed( |
948 int net_error) { | 953 int net_error) { |
949 DCHECK_EQ(alternative_job_->job_type(), ALTERNATIVE); | 954 DCHECK_EQ(alternative_job_->job_type(), ALTERNATIVE); |
950 DCHECK_NE(OK, net_error); | 955 DCHECK_NE(OK, net_error); |
951 DCHECK_NE(kProtoUnknown, alternative_service_.protocol); | 956 DCHECK_NE(kProtoUnknown, alternative_service_info_.protocol()); |
952 | 957 |
953 alternative_job_net_error_ = net_error; | 958 alternative_job_net_error_ = net_error; |
954 | 959 |
955 if (IsJobOrphaned(alternative_job_.get())) { | 960 if (IsJobOrphaned(alternative_job_.get())) { |
956 // If |request_| is gone then it must have been successfully served by | 961 // If |request_| is gone then it must have been successfully served by |
957 // |main_job_|. | 962 // |main_job_|. |
958 // If |request_| is bound to a different job, then it is being | 963 // If |request_| is bound to a different job, then it is being |
959 // successfully serverd by the main job. | 964 // successfully serverd by the main job. |
960 ReportBrokenAlternativeService(); | 965 ReportBrokenAlternativeService(); |
961 } | 966 } |
962 } | 967 } |
963 | 968 |
964 void HttpStreamFactoryImpl::JobController::OnAlternativeProxyJobFailed( | 969 void HttpStreamFactoryImpl::JobController::OnAlternativeProxyJobFailed( |
965 int net_error) { | 970 int net_error) { |
966 DCHECK_EQ(alternative_job_->job_type(), ALTERNATIVE); | 971 DCHECK_EQ(alternative_job_->job_type(), ALTERNATIVE); |
967 DCHECK_NE(OK, net_error); | 972 DCHECK_NE(OK, net_error); |
968 DCHECK(alternative_job_->alternative_proxy_server().is_valid()); | 973 DCHECK(alternative_job_->alternative_proxy_server().is_valid()); |
969 | 974 |
970 // Need to mark alt proxy as broken regardless whether the job is bound. | 975 // Need to mark alt proxy as broken regardless whether the job is bound. |
971 ProxyDelegate* proxy_delegate = session_->context().proxy_delegate; | 976 ProxyDelegate* proxy_delegate = session_->context().proxy_delegate; |
972 if (proxy_delegate) { | 977 if (proxy_delegate) { |
973 proxy_delegate->OnAlternativeProxyBroken( | 978 proxy_delegate->OnAlternativeProxyBroken( |
974 alternative_job_->alternative_proxy_server()); | 979 alternative_job_->alternative_proxy_server()); |
975 } | 980 } |
976 } | 981 } |
977 | 982 |
978 void HttpStreamFactoryImpl::JobController::ReportBrokenAlternativeService() { | 983 void HttpStreamFactoryImpl::JobController::ReportBrokenAlternativeService() { |
979 DCHECK(alternative_service_.protocol != kProtoUnknown); | 984 DCHECK(alternative_service_info_.protocol() != kProtoUnknown); |
980 DCHECK_NE(OK, alternative_job_net_error_); | 985 DCHECK_NE(OK, alternative_job_net_error_); |
981 | 986 |
982 int error_to_report = alternative_job_net_error_; | 987 int error_to_report = alternative_job_net_error_; |
983 alternative_job_net_error_ = OK; | 988 alternative_job_net_error_ = OK; |
984 UMA_HISTOGRAM_SPARSE_SLOWLY("Net.AlternateServiceFailed", -error_to_report); | 989 UMA_HISTOGRAM_SPARSE_SLOWLY("Net.AlternateServiceFailed", -error_to_report); |
985 | 990 |
986 if (error_to_report == ERR_NETWORK_CHANGED || | 991 if (error_to_report == ERR_NETWORK_CHANGED || |
987 error_to_report == ERR_INTERNET_DISCONNECTED) { | 992 error_to_report == ERR_INTERNET_DISCONNECTED) { |
988 // No need to mark alternative service or proxy as broken. | 993 // No need to mark alternative service or proxy as broken. |
989 return; | 994 return; |
990 } | 995 } |
991 | 996 |
992 HistogramBrokenAlternateProtocolLocation( | 997 HistogramBrokenAlternateProtocolLocation( |
993 BROKEN_ALTERNATE_PROTOCOL_LOCATION_HTTP_STREAM_FACTORY_IMPL_JOB_ALT); | 998 BROKEN_ALTERNATE_PROTOCOL_LOCATION_HTTP_STREAM_FACTORY_IMPL_JOB_ALT); |
994 session_->http_server_properties()->MarkAlternativeServiceBroken( | 999 session_->http_server_properties()->MarkAlternativeServiceBroken( |
995 alternative_service_); | 1000 alternative_service_info_.alternative_service()); |
996 } | 1001 } |
997 | 1002 |
998 void HttpStreamFactoryImpl::JobController::MaybeNotifyFactoryOfCompletion() { | 1003 void HttpStreamFactoryImpl::JobController::MaybeNotifyFactoryOfCompletion() { |
999 if (!request_ && !main_job_ && !alternative_job_) { | 1004 if (!request_ && !main_job_ && !alternative_job_) { |
1000 DCHECK(!bound_job_); | 1005 DCHECK(!bound_job_); |
1001 factory_->OnJobControllerComplete(this); | 1006 factory_->OnJobControllerComplete(this); |
1002 } | 1007 } |
1003 } | 1008 } |
1004 | 1009 |
1005 void HttpStreamFactoryImpl::JobController::NotifyRequestFailed(int rv) { | 1010 void HttpStreamFactoryImpl::JobController::NotifyRequestFailed(int rv) { |
(...skipping 20 matching lines...) Expand all Loading... |
1026 HttpStreamFactoryImpl::JobController::GetAlternativeServiceInfoFor( | 1031 HttpStreamFactoryImpl::JobController::GetAlternativeServiceInfoFor( |
1027 const HttpRequestInfo& request_info, | 1032 const HttpRequestInfo& request_info, |
1028 HttpStreamRequest::Delegate* delegate, | 1033 HttpStreamRequest::Delegate* delegate, |
1029 HttpStreamRequest::StreamType stream_type) { | 1034 HttpStreamRequest::StreamType stream_type) { |
1030 if (!enable_alternative_services_) | 1035 if (!enable_alternative_services_) |
1031 return AlternativeServiceInfo(); | 1036 return AlternativeServiceInfo(); |
1032 | 1037 |
1033 AlternativeServiceInfo alternative_service_info = | 1038 AlternativeServiceInfo alternative_service_info = |
1034 GetAlternativeServiceInfoInternal(request_info, delegate, stream_type); | 1039 GetAlternativeServiceInfoInternal(request_info, delegate, stream_type); |
1035 AlternativeServiceType type; | 1040 AlternativeServiceType type; |
1036 if (alternative_service_info.alternative_service().protocol == | 1041 if (alternative_service_info.protocol() == kProtoUnknown) { |
1037 kProtoUnknown) { | |
1038 type = NO_ALTERNATIVE_SERVICE; | 1042 type = NO_ALTERNATIVE_SERVICE; |
1039 } else if (alternative_service_info.alternative_service().protocol == | 1043 } else if (alternative_service_info.protocol() == kProtoQUIC) { |
1040 kProtoQUIC) { | |
1041 if (request_info.url.host_piece() == | 1044 if (request_info.url.host_piece() == |
1042 alternative_service_info.alternative_service().host) { | 1045 alternative_service_info.alternative_service().host) { |
1043 type = QUIC_SAME_DESTINATION; | 1046 type = QUIC_SAME_DESTINATION; |
1044 } else { | 1047 } else { |
1045 type = QUIC_DIFFERENT_DESTINATION; | 1048 type = QUIC_DIFFERENT_DESTINATION; |
1046 } | 1049 } |
1047 } else { | 1050 } else { |
1048 if (request_info.url.host_piece() == | 1051 if (request_info.url.host_piece() == |
1049 alternative_service_info.alternative_service().host) { | 1052 alternative_service_info.alternative_service().host) { |
1050 type = NOT_QUIC_SAME_DESTINATION; | 1053 type = NOT_QUIC_SAME_DESTINATION; |
(...skipping 25 matching lines...) Expand all Loading... |
1076 return AlternativeServiceInfo(); | 1079 return AlternativeServiceInfo(); |
1077 | 1080 |
1078 bool quic_advertised = false; | 1081 bool quic_advertised = false; |
1079 bool quic_all_broken = true; | 1082 bool quic_all_broken = true; |
1080 | 1083 |
1081 // First alternative service that is not marked as broken. | 1084 // First alternative service that is not marked as broken. |
1082 AlternativeServiceInfo first_alternative_service_info; | 1085 AlternativeServiceInfo first_alternative_service_info; |
1083 | 1086 |
1084 for (const AlternativeServiceInfo& alternative_service_info : | 1087 for (const AlternativeServiceInfo& alternative_service_info : |
1085 alternative_service_info_vector) { | 1088 alternative_service_info_vector) { |
1086 DCHECK(IsAlternateProtocolValid( | 1089 DCHECK(IsAlternateProtocolValid(alternative_service_info.protocol())); |
1087 alternative_service_info.alternative_service().protocol)); | 1090 if (!quic_advertised && alternative_service_info.protocol() == kProtoQUIC) |
1088 if (!quic_advertised && | |
1089 alternative_service_info.alternative_service().protocol == kProtoQUIC) | |
1090 quic_advertised = true; | 1091 quic_advertised = true; |
1091 if (http_server_properties.IsAlternativeServiceBroken( | 1092 if (http_server_properties.IsAlternativeServiceBroken( |
1092 alternative_service_info.alternative_service())) { | 1093 alternative_service_info.alternative_service())) { |
1093 HistogramAlternateProtocolUsage(ALTERNATE_PROTOCOL_USAGE_BROKEN, false); | 1094 HistogramAlternateProtocolUsage(ALTERNATE_PROTOCOL_USAGE_BROKEN, false); |
1094 continue; | 1095 continue; |
1095 } | 1096 } |
1096 | 1097 |
1097 // Some shared unix systems may have user home directories (like | 1098 // Some shared unix systems may have user home directories (like |
1098 // http://foo.com/~mike) which allow users to emit headers. This is a bad | 1099 // http://foo.com/~mike) which allow users to emit headers. This is a bad |
1099 // idea already, but with Alternate-Protocol, it provides the ability for a | 1100 // idea already, but with Alternate-Protocol, it provides the ability for a |
1100 // single user on a multi-user system to hijack the alternate protocol. | 1101 // single user on a multi-user system to hijack the alternate protocol. |
1101 // These systems also enforce ports <1024 as restricted ports. So don't | 1102 // These systems also enforce ports <1024 as restricted ports. So don't |
1102 // allow protocol upgrades to user-controllable ports. | 1103 // allow protocol upgrades to user-controllable ports. |
1103 const int kUnrestrictedPort = 1024; | 1104 const int kUnrestrictedPort = 1024; |
1104 if (!session_->params().enable_user_alternate_protocol_ports && | 1105 if (!session_->params().enable_user_alternate_protocol_ports && |
1105 (alternative_service_info.alternative_service().port >= | 1106 (alternative_service_info.alternative_service().port >= |
1106 kUnrestrictedPort && | 1107 kUnrestrictedPort && |
1107 origin.port() < kUnrestrictedPort)) | 1108 origin.port() < kUnrestrictedPort)) |
1108 continue; | 1109 continue; |
1109 | 1110 |
1110 if (alternative_service_info.alternative_service().protocol == | 1111 if (alternative_service_info.protocol() == kProtoHTTP2) { |
1111 kProtoHTTP2) { | |
1112 if (!session_->params().enable_http2_alternative_service) | 1112 if (!session_->params().enable_http2_alternative_service) |
1113 continue; | 1113 continue; |
1114 | 1114 |
1115 // Cache this entry if we don't have a non-broken Alt-Svc yet. | 1115 // Cache this entry if we don't have a non-broken Alt-Svc yet. |
1116 if (first_alternative_service_info.alternative_service().protocol == | 1116 if (first_alternative_service_info.protocol() == kProtoUnknown) |
1117 kProtoUnknown) | |
1118 first_alternative_service_info = alternative_service_info; | 1117 first_alternative_service_info = alternative_service_info; |
1119 continue; | 1118 continue; |
1120 } | 1119 } |
1121 | 1120 |
1122 DCHECK_EQ(kProtoQUIC, | 1121 DCHECK_EQ(kProtoQUIC, alternative_service_info.protocol()); |
1123 alternative_service_info.alternative_service().protocol); | |
1124 quic_all_broken = false; | 1122 quic_all_broken = false; |
1125 if (!session_->IsQuicEnabled()) | 1123 if (!session_->IsQuicEnabled()) |
1126 continue; | 1124 continue; |
1127 | 1125 |
1128 if (stream_type == HttpStreamRequest::BIDIRECTIONAL_STREAM && | 1126 if (stream_type == HttpStreamRequest::BIDIRECTIONAL_STREAM && |
1129 session_->params().quic_disable_bidirectional_streams) { | 1127 session_->params().quic_disable_bidirectional_streams) { |
1130 continue; | 1128 continue; |
1131 } | 1129 } |
1132 | 1130 |
1133 if (!original_url.SchemeIs(url::kHttpsScheme)) | 1131 if (!original_url.SchemeIs(url::kHttpsScheme)) |
1134 continue; | 1132 continue; |
1135 | 1133 |
1136 // Check whether there is an existing QUIC session to use for this origin. | 1134 // Check whether there is an existing QUIC session to use for this origin. |
1137 HostPortPair mapped_origin(origin.host(), origin.port()); | 1135 HostPortPair mapped_origin(origin.host(), origin.port()); |
1138 ignore_result(ApplyHostMappingRules(original_url, &mapped_origin)); | 1136 ignore_result(ApplyHostMappingRules(original_url, &mapped_origin)); |
1139 QuicServerId server_id(mapped_origin, request_info.privacy_mode); | 1137 QuicServerId server_id(mapped_origin, request_info.privacy_mode); |
1140 | 1138 |
1141 HostPortPair destination( | 1139 HostPortPair destination(alternative_service_info.host_port_pair()); |
1142 alternative_service_info.alternative_service().host_port_pair()); | |
1143 ignore_result(ApplyHostMappingRules(original_url, &destination)); | 1140 ignore_result(ApplyHostMappingRules(original_url, &destination)); |
1144 | 1141 |
1145 if (session_->quic_stream_factory()->CanUseExistingSession(server_id, | 1142 if (session_->quic_stream_factory()->CanUseExistingSession(server_id, |
1146 destination)) { | 1143 destination)) { |
1147 return alternative_service_info; | 1144 return alternative_service_info; |
1148 } | 1145 } |
1149 | 1146 |
1150 // Cache this entry if we don't have a non-broken Alt-Svc yet. | 1147 // Cache this entry if we don't have a non-broken Alt-Svc yet. |
1151 if (first_alternative_service_info.alternative_service().protocol == | 1148 if (first_alternative_service_info.protocol() == kProtoUnknown) |
1152 kProtoUnknown) | |
1153 first_alternative_service_info = alternative_service_info; | 1149 first_alternative_service_info = alternative_service_info; |
1154 } | 1150 } |
1155 | 1151 |
1156 // Ask delegate to mark QUIC as broken for the origin. | 1152 // Ask delegate to mark QUIC as broken for the origin. |
1157 if (quic_advertised && quic_all_broken && delegate != nullptr) | 1153 if (quic_advertised && quic_all_broken && delegate != nullptr) |
1158 delegate->OnQuicBroken(); | 1154 delegate->OnQuicBroken(); |
1159 | 1155 |
1160 return first_alternative_service_info; | 1156 return first_alternative_service_info; |
1161 } | 1157 } |
1162 | 1158 |
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1286 // If ReconsiderProxyAfterError() failed synchronously, it means | 1282 // If ReconsiderProxyAfterError() failed synchronously, it means |
1287 // there was nothing left to fall-back to, so fail the transaction | 1283 // there was nothing left to fall-back to, so fail the transaction |
1288 // with the last connection error we got. | 1284 // with the last connection error we got. |
1289 // TODO(eroman): This is a confusing contract, make it more obvious. | 1285 // TODO(eroman): This is a confusing contract, make it more obvious. |
1290 rv = error; | 1286 rv = error; |
1291 } | 1287 } |
1292 return rv; | 1288 return rv; |
1293 } | 1289 } |
1294 | 1290 |
1295 } // namespace net | 1291 } // namespace net |
OLD | NEW |