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 "base/values.h" | 10 #include "base/values.h" |
(...skipping 900 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
911 // idea already, but with Alternate-Protocol, it provides the ability for a | 911 // idea already, but with Alternate-Protocol, it provides the ability for a |
912 // single user on a multi-user system to hijack the alternate protocol. | 912 // single user on a multi-user system to hijack the alternate protocol. |
913 // These systems also enforce ports <1024 as restricted ports. So don't | 913 // These systems also enforce ports <1024 as restricted ports. So don't |
914 // allow protocol upgrades to user-controllable ports. | 914 // allow protocol upgrades to user-controllable ports. |
915 const int kUnrestrictedPort = 1024; | 915 const int kUnrestrictedPort = 1024; |
916 if (!session_->params().enable_user_alternate_protocol_ports && | 916 if (!session_->params().enable_user_alternate_protocol_ports && |
917 (alternative_service.port >= kUnrestrictedPort && | 917 (alternative_service.port >= kUnrestrictedPort && |
918 origin.port() < kUnrestrictedPort)) | 918 origin.port() < kUnrestrictedPort)) |
919 continue; | 919 continue; |
920 | 920 |
921 if (alternative_service.protocol >= NPN_SPDY_MINIMUM_VERSION && | 921 if (alternative_service.protocol == NPN_HTTP_2) { |
922 alternative_service.protocol <= NPN_SPDY_MAXIMUM_VERSION) { | |
923 if (origin.host() != alternative_service.host && | 922 if (origin.host() != alternative_service.host && |
924 !session_->params() | 923 !session_->params() |
925 .enable_http2_alternative_service_with_different_host) { | 924 .enable_http2_alternative_service_with_different_host) { |
926 continue; | 925 continue; |
927 } | 926 } |
928 | 927 |
929 // Cache this entry if we don't have a non-broken Alt-Svc yet. | 928 // Cache this entry if we don't have a non-broken Alt-Svc yet. |
930 if (first_alternative_service.protocol == | 929 if (first_alternative_service.protocol == |
931 UNINITIALIZED_ALTERNATE_PROTOCOL) | 930 UNINITIALIZED_ALTERNATE_PROTOCOL) |
932 first_alternative_service = alternative_service; | 931 first_alternative_service = alternative_service; |
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1084 } | 1083 } |
1085 | 1084 |
1086 void HttpStreamFactoryImpl::JobController::StartAlternativeProxyServerJob() { | 1085 void HttpStreamFactoryImpl::JobController::StartAlternativeProxyServerJob() { |
1087 if (!alternative_job_ || !request_) | 1086 if (!alternative_job_ || !request_) |
1088 return; | 1087 return; |
1089 DCHECK(alternative_job_->alternative_proxy_server().is_valid()); | 1088 DCHECK(alternative_job_->alternative_proxy_server().is_valid()); |
1090 alternative_job_->Start(request_->stream_type()); | 1089 alternative_job_->Start(request_->stream_type()); |
1091 } | 1090 } |
1092 | 1091 |
1093 } // namespace net | 1092 } // namespace net |
OLD | NEW |