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

Unified Diff: components/cronet/url_request_context_config.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
Index: components/cronet/url_request_context_config.cc
diff --git a/components/cronet/url_request_context_config.cc b/components/cronet/url_request_context_config.cc
index 892fd578dc341e083e50130329dcd210bc285f9a..cb19efcf5b249211fc599d6597c0a15980860334 100644
--- a/components/cronet/url_request_context_config.cc
+++ b/components/cronet/url_request_context_config.cc
@@ -11,6 +11,7 @@
#include "base/memory/scoped_ptr.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/string_piece.h"
+#include "base/strings/string_split.h"
#include "base/values.h"
#include "net/cert/cert_verifier.h"
#include "net/dns/host_resolver.h"
@@ -33,6 +34,7 @@ const char kQuicMaxNumberOfLossyConnections[] =
const char kQuicPacketLossThreshold[] = "packet_loss_threshold";
const char kQuicIdleConnectionTimeoutSeconds[] =
"idle_connection_timeout_seconds";
+const char kQuicHostWhitelist[] = "host_whitelist";
// AsyncDNS experiment dictionary name.
const char kAsyncDnsFieldTrialName[] = "AsyncDNS";
@@ -106,6 +108,17 @@ void ParseAndSetExperimentalOptions(
context_builder->set_quic_idle_connection_timeout_seconds(
quic_idle_connection_timeout_seconds);
}
+
+ std::string quic_host_whitelist;
+ if (quic_args->GetString(kQuicHostWhitelist, &quic_host_whitelist)) {
+ std::unordered_set<std::string> hosts;
+ for (const std::string& host :
+ base::SplitString(quic_host_whitelist, ",", base::TRIM_WHITESPACE,
+ base::SPLIT_WANT_ALL)) {
+ hosts.insert(host);
+ }
+ context_builder->set_quic_host_whitelist(hosts);
+ }
}
const base::DictionaryValue* async_dns_args = nullptr;
« no previous file with comments | « components/cronet/android/test/javatests/src/org/chromium/net/QuicTest.java ('k') | net/http/http_network_session.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698