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

Side by Side Diff: net/http/http_stream_factory_impl_job_controller.cc

Issue 2821463002: Disable HTTP/2 Alternative Services. (Closed)
Patch Set: Fix //jingle/glue/. Created 3 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
« no previous file with comments | « net/http/http_network_transaction_unittest.cc ('k') | net/spdy/spdy_test_util_common.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 932 matching lines...) Expand 10 before | Expand all | Expand 10 after
943 } 943 }
944 } else { 944 } else {
945 if (request_info.url.host_piece() == alternative_service.host) { 945 if (request_info.url.host_piece() == alternative_service.host) {
946 type = NOT_QUIC_SAME_DESTINATION; 946 type = NOT_QUIC_SAME_DESTINATION;
947 } else { 947 } else {
948 type = NOT_QUIC_DIFFERENT_DESTINATION; 948 type = NOT_QUIC_DIFFERENT_DESTINATION;
949 } 949 }
950 } 950 }
951 UMA_HISTOGRAM_ENUMERATION("Net.AlternativeServiceTypeForRequest", type, 951 UMA_HISTOGRAM_ENUMERATION("Net.AlternativeServiceTypeForRequest", type,
952 MAX_ALTERNATIVE_SERVICE_TYPE); 952 MAX_ALTERNATIVE_SERVICE_TYPE);
953
954 // TODO(bnc): https://crbug.com/615413 Re-enable HTTP/2 Alternative Services.
955 if (alternative_service.protocol == kProtoHTTP2 &&
956 !session_->params().enable_http2_alternative_service) {
957 return AlternativeService();
958 }
Ryan Hamilton 2017/04/13 21:53:45 I don't understand why we want to move this here i
Bence 2017/04/14 01:10:16 Sure. If it's in GetAlternativeServiceForInternal
Ryan Hamilton 2017/04/14 02:49:13 In that case, perhaps we need a new histogram for
Bence 2017/04/17 11:29:46 Oops, I wasn't aware of that, sorry. Let me just
959
953 return alternative_service; 960 return alternative_service;
954 } 961 }
955 962
956 AlternativeService 963 AlternativeService
957 HttpStreamFactoryImpl::JobController::GetAlternativeServiceForInternal( 964 HttpStreamFactoryImpl::JobController::GetAlternativeServiceForInternal(
958 const HttpRequestInfo& request_info, 965 const HttpRequestInfo& request_info,
959 HttpStreamRequest::Delegate* delegate, 966 HttpStreamRequest::Delegate* delegate,
960 HttpStreamRequest::StreamType stream_type) { 967 HttpStreamRequest::StreamType stream_type) {
961 GURL original_url = request_info.url; 968 GURL original_url = request_info.url;
962 969
(...skipping 18 matching lines...) Expand all
981 alternative_service_vector) { 988 alternative_service_vector) {
982 DCHECK(IsAlternateProtocolValid(alternative_service.protocol)); 989 DCHECK(IsAlternateProtocolValid(alternative_service.protocol));
983 if (!quic_advertised && alternative_service.protocol == kProtoQUIC) 990 if (!quic_advertised && alternative_service.protocol == kProtoQUIC)
984 quic_advertised = true; 991 quic_advertised = true;
985 if (http_server_properties.IsAlternativeServiceBroken( 992 if (http_server_properties.IsAlternativeServiceBroken(
986 alternative_service)) { 993 alternative_service)) {
987 HistogramAlternateProtocolUsage(ALTERNATE_PROTOCOL_USAGE_BROKEN, false); 994 HistogramAlternateProtocolUsage(ALTERNATE_PROTOCOL_USAGE_BROKEN, false);
988 continue; 995 continue;
989 } 996 }
990 997
991
992 // Some shared unix systems may have user home directories (like 998 // 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 999 // 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 1000 // 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. 1001 // 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 1002 // These systems also enforce ports <1024 as restricted ports. So don't
997 // allow protocol upgrades to user-controllable ports. 1003 // allow protocol upgrades to user-controllable ports.
998 const int kUnrestrictedPort = 1024; 1004 const int kUnrestrictedPort = 1024;
999 if (!session_->params().enable_user_alternate_protocol_ports && 1005 if (!session_->params().enable_user_alternate_protocol_ports &&
1000 (alternative_service.port >= kUnrestrictedPort && 1006 (alternative_service.port >= kUnrestrictedPort &&
1001 origin.port() < kUnrestrictedPort)) 1007 origin.port() < kUnrestrictedPort))
1002 continue; 1008 continue;
1003 1009
1004 if (alternative_service.protocol == kProtoHTTP2) { 1010 if (alternative_service.protocol == kProtoHTTP2) {
1005 if (origin.host() != alternative_service.host &&
1006 !session_->params()
1007 .enable_http2_alternative_service_with_different_host) {
1008 continue;
1009 }
1010
1011 // Cache this entry if we don't have a non-broken Alt-Svc yet. 1011 // Cache this entry if we don't have a non-broken Alt-Svc yet.
1012 if (first_alternative_service.protocol == kProtoUnknown) 1012 if (first_alternative_service.protocol == kProtoUnknown)
1013 first_alternative_service = alternative_service; 1013 first_alternative_service = alternative_service;
1014 continue; 1014 continue;
1015 } 1015 }
1016 1016
1017 DCHECK_EQ(kProtoQUIC, alternative_service.protocol); 1017 DCHECK_EQ(kProtoQUIC, alternative_service.protocol);
1018 if (origin.host() != alternative_service.host && 1018 if (origin.host() != alternative_service.host &&
1019 !session_->params() 1019 !session_->params()
1020 .enable_quic_alternative_service_with_different_host) { 1020 .enable_quic_alternative_service_with_different_host) {
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
1159 return; 1159 return;
1160 DCHECK(alternative_job_->alternative_proxy_server().is_valid()); 1160 DCHECK(alternative_job_->alternative_proxy_server().is_valid());
1161 alternative_job_->Start(request_->stream_type()); 1161 alternative_job_->Start(request_->stream_type());
1162 } 1162 }
1163 1163
1164 bool HttpStreamFactoryImpl::JobController::IsJobOrphaned(Job* job) const { 1164 bool HttpStreamFactoryImpl::JobController::IsJobOrphaned(Job* job) const {
1165 return !request_ || (job_bound_ && bound_job_ != job); 1165 return !request_ || (job_bound_ && bound_job_ != job);
1166 } 1166 }
1167 1167
1168 } // namespace net 1168 } // namespace net
OLDNEW
« no previous file with comments | « net/http/http_network_transaction_unittest.cc ('k') | net/spdy/spdy_test_util_common.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698