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 <memory> | 7 #include <memory> |
8 #include <string> | 8 #include <string> |
9 #include <utility> | 9 #include <utility> |
10 | 10 |
(...skipping 970 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
981 alternative_service_vector) { | 981 alternative_service_vector) { |
982 DCHECK(IsAlternateProtocolValid(alternative_service.protocol)); | 982 DCHECK(IsAlternateProtocolValid(alternative_service.protocol)); |
983 if (!quic_advertised && alternative_service.protocol == kProtoQUIC) | 983 if (!quic_advertised && alternative_service.protocol == kProtoQUIC) |
984 quic_advertised = true; | 984 quic_advertised = true; |
985 if (http_server_properties.IsAlternativeServiceBroken( | 985 if (http_server_properties.IsAlternativeServiceBroken( |
986 alternative_service)) { | 986 alternative_service)) { |
987 HistogramAlternateProtocolUsage(ALTERNATE_PROTOCOL_USAGE_BROKEN, false); | 987 HistogramAlternateProtocolUsage(ALTERNATE_PROTOCOL_USAGE_BROKEN, false); |
988 continue; | 988 continue; |
989 } | 989 } |
990 | 990 |
991 | |
992 // Some shared unix systems may have user home directories (like | 991 // Some shared unix systems may have user home directories (like |
993 // http://foo.com/~mike) which allow users to emit headers. This is a bad | 992 // http://foo.com/~mike) which allow users to emit headers. This is a bad |
994 // idea already, but with Alternate-Protocol, it provides the ability for a | 993 // idea already, but with Alternate-Protocol, it provides the ability for a |
995 // single user on a multi-user system to hijack the alternate protocol. | 994 // single user on a multi-user system to hijack the alternate protocol. |
996 // These systems also enforce ports <1024 as restricted ports. So don't | 995 // These systems also enforce ports <1024 as restricted ports. So don't |
997 // allow protocol upgrades to user-controllable ports. | 996 // allow protocol upgrades to user-controllable ports. |
998 const int kUnrestrictedPort = 1024; | 997 const int kUnrestrictedPort = 1024; |
999 if (!session_->params().enable_user_alternate_protocol_ports && | 998 if (!session_->params().enable_user_alternate_protocol_ports && |
1000 (alternative_service.port >= kUnrestrictedPort && | 999 (alternative_service.port >= kUnrestrictedPort && |
1001 origin.port() < kUnrestrictedPort)) | 1000 origin.port() < kUnrestrictedPort)) |
1002 continue; | 1001 continue; |
1003 | 1002 |
1004 if (alternative_service.protocol == kProtoHTTP2) { | 1003 if (alternative_service.protocol == kProtoHTTP2) { |
1005 if (origin.host() != alternative_service.host && | 1004 if (!session_->params().enable_http2_alternative_service) |
1006 !session_->params() | |
1007 .enable_http2_alternative_service_with_different_host) { | |
1008 continue; | 1005 continue; |
1009 } | |
1010 | 1006 |
1011 // Cache this entry if we don't have a non-broken Alt-Svc yet. | 1007 // Cache this entry if we don't have a non-broken Alt-Svc yet. |
1012 if (first_alternative_service.protocol == kProtoUnknown) | 1008 if (first_alternative_service.protocol == kProtoUnknown) |
1013 first_alternative_service = alternative_service; | 1009 first_alternative_service = alternative_service; |
1014 continue; | 1010 continue; |
1015 } | 1011 } |
1016 | 1012 |
1017 DCHECK_EQ(kProtoQUIC, alternative_service.protocol); | 1013 DCHECK_EQ(kProtoQUIC, alternative_service.protocol); |
1018 if (origin.host() != alternative_service.host && | 1014 if (origin.host() != alternative_service.host && |
1019 !session_->params() | 1015 !session_->params() |
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1159 return; | 1155 return; |
1160 DCHECK(alternative_job_->alternative_proxy_server().is_valid()); | 1156 DCHECK(alternative_job_->alternative_proxy_server().is_valid()); |
1161 alternative_job_->Start(request_->stream_type()); | 1157 alternative_job_->Start(request_->stream_type()); |
1162 } | 1158 } |
1163 | 1159 |
1164 bool HttpStreamFactoryImpl::JobController::IsJobOrphaned(Job* job) const { | 1160 bool HttpStreamFactoryImpl::JobController::IsJobOrphaned(Job* job) const { |
1165 return !request_ || (job_bound_ && bound_job_ != job); | 1161 return !request_ || (job_bound_ && bound_job_ != job); |
1166 } | 1162 } |
1167 | 1163 |
1168 } // namespace net | 1164 } // namespace net |
OLD | NEW |