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 "base/metrics/histogram_macros.h" | 7 #include "base/metrics/histogram_macros.h" |
8 #include "base/strings/string_number_conversions.h" | 8 #include "base/strings/string_number_conversions.h" |
9 #include "base/strings/string_util.h" | 9 #include "base/strings/string_util.h" |
10 #include "net/base/host_mapping_rules.h" | 10 #include "net/base/host_mapping_rules.h" |
(...skipping 689 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
700 return alternative_service; | 700 return alternative_service; |
701 } | 701 } |
702 | 702 |
703 AlternativeService | 703 AlternativeService |
704 HttpStreamFactoryImpl::JobController::GetAlternativeServiceForInternal( | 704 HttpStreamFactoryImpl::JobController::GetAlternativeServiceForInternal( |
705 const HttpRequestInfo& request_info, | 705 const HttpRequestInfo& request_info, |
706 HttpStreamRequest::Delegate* delegate, | 706 HttpStreamRequest::Delegate* delegate, |
707 HttpStreamRequest::StreamType stream_type) { | 707 HttpStreamRequest::StreamType stream_type) { |
708 GURL original_url = request_info.url; | 708 GURL original_url = request_info.url; |
709 | 709 |
710 if (original_url.SchemeIs("ftp")) | 710 if (!original_url.SchemeIs("https")) |
711 return AlternativeService(); | |
712 | |
713 if (!session_->params().enable_alternative_service_for_insecure_origins && | |
714 !original_url.SchemeIs("https")) | |
715 return AlternativeService(); | 711 return AlternativeService(); |
716 | 712 |
717 url::SchemeHostPort origin(original_url); | 713 url::SchemeHostPort origin(original_url); |
718 HttpServerProperties& http_server_properties = | 714 HttpServerProperties& http_server_properties = |
719 *session_->http_server_properties(); | 715 *session_->http_server_properties(); |
720 const AlternativeServiceVector alternative_service_vector = | 716 const AlternativeServiceVector alternative_service_vector = |
721 http_server_properties.GetAlternativeServices(origin); | 717 http_server_properties.GetAlternativeServices(origin); |
722 if (alternative_service_vector.empty()) | 718 if (alternative_service_vector.empty()) |
723 return AlternativeService(); | 719 return AlternativeService(); |
724 | 720 |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
814 first_alternative_service = alternative_service; | 810 first_alternative_service = alternative_service; |
815 } | 811 } |
816 | 812 |
817 // Ask delegate to mark QUIC as broken for the origin. | 813 // Ask delegate to mark QUIC as broken for the origin. |
818 if (quic_advertised && quic_all_broken && delegate != nullptr) | 814 if (quic_advertised && quic_all_broken && delegate != nullptr) |
819 delegate->OnQuicBroken(); | 815 delegate->OnQuicBroken(); |
820 | 816 |
821 return first_alternative_service; | 817 return first_alternative_service; |
822 } | 818 } |
823 } | 819 } |
OLD | NEW |