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

Unified Diff: net/http/http_stream_factory_impl.cc

Issue 1310583002: Change |use_alternative_service| not to disable Alternate Protocols. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add tests. Created 5 years, 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/http/http_network_transaction_unittest.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/http/http_stream_factory_impl.cc
diff --git a/net/http/http_stream_factory_impl.cc b/net/http/http_stream_factory_impl.cc
index 68eb6afaf26a967b65b781ca01d5c0d8cf88950a..2a8664e51a6458ed9d087582066a943a03552c27 100644
--- a/net/http/http_stream_factory_impl.cc
+++ b/net/http/http_stream_factory_impl.cc
@@ -152,9 +152,6 @@ const HostMappingRules* HttpStreamFactoryImpl::GetHostMappingRules() const {
AlternativeServiceVector HttpStreamFactoryImpl::GetAlternativeServicesFor(
const GURL& original_url) {
- if (!session_->params().use_alternative_services)
- return AlternativeServiceVector();
-
if (original_url.SchemeIs("ftp"))
return AlternativeServiceVector();
@@ -166,6 +163,9 @@ AlternativeServiceVector HttpStreamFactoryImpl::GetAlternativeServicesFor(
if (alternative_service_vector.empty())
return AlternativeServiceVector();
+ const bool enable_different_host =
+ session_->params().use_alternative_services;
+
AlternativeServiceVector enabled_alternative_service_vector;
for (const AlternativeService& alternative_service :
alternative_service_vector) {
@@ -176,6 +176,9 @@ AlternativeServiceVector HttpStreamFactoryImpl::GetAlternativeServicesFor(
continue;
}
+ if (origin.host() != alternative_service.host && !enable_different_host)
+ continue;
+
// Some shared unix systems may have user home directories (like
// http://foo.com/~mike) which allow users to emit headers. This is a bad
// idea already, but with Alternate-Protocol, it provides the ability for a
« no previous file with comments | « net/http/http_network_transaction_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698