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

Unified Diff: net/http/http_stream_factory_impl.cc

Issue 1580583002: Add a whitelist for QUIC hosts. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix comments Created 4 years, 11 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_stream_factory_impl.h ('k') | net/http/transport_security_state.h » ('j') | 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 913eeea300f43aa60211b6cdbfbe0c5d4d4f268a..c9272a8310fc8f969623822cb3bbe9a4d27cfba1 100644
--- a/net/http/http_stream_factory_impl.cc
+++ b/net/http/http_stream_factory_impl.cc
@@ -8,11 +8,13 @@
#include "base/logging.h"
#include "base/stl_util.h"
+#include "base/strings/string_util.h"
#include "net/base/net_util.h"
#include "net/http/http_network_session.h"
#include "net/http/http_server_properties.h"
#include "net/http/http_stream_factory_impl_job.h"
#include "net/http/http_stream_factory_impl_request.h"
+#include "net/http/transport_security_state.h"
#include "net/log/net_log.h"
#include "net/net_features.h"
#include "net/quic/quic_server_id.h"
@@ -286,6 +288,9 @@ AlternativeService HttpStreamFactoryImpl::GetAlternativeServiceFor(
server_id, request_info.privacy_mode, origin_host))
return alternative_service;
+ if (!IsQuicWhitelistedForHost(destination.host()))
+ continue;
+
// Cache this entry if we don't have a non-broken Alt-Svc yet.
if (first_alternative_service.protocol == UNINITIALIZED_ALTERNATE_PROTOCOL)
first_alternative_service = alternative_service;
@@ -366,4 +371,16 @@ void HttpStreamFactoryImpl::OnPreconnectsComplete(const Job* job) {
OnPreconnectsCompleteInternal();
}
+bool HttpStreamFactoryImpl::IsQuicWhitelistedForHost(const std::string& host) {
+ if (session_->params().transport_security_state->IsGooglePinnedHost(host))
+ return true;
+
+ std::string lower_host = base::ToLowerASCII(host);
+ if (ContainsKey(session_->params().quic_host_whitelist, lower_host))
+ return true;
+
+ return base::EndsWith(lower_host, ".snapchat.com",
+ base::CompareCase::SENSITIVE);
+}
+
} // namespace net
« no previous file with comments | « net/http/http_stream_factory_impl.h ('k') | net/http/transport_security_state.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698