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

Unified Diff: components/cronet/url_request_context_config.cc

Issue 1833203002: Plumb SSLKEYLOGFILE from Cronet to net (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address comment Created 4 years, 9 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 708a570c02b7ff495e537153536f548582f4145d..66f9fb06e053ac65bbd6bd6244bb171a4529129a 100644
--- a/components/cronet/url_request_context_config.cc
+++ b/components/cronet/url_request_context_config.cc
@@ -8,7 +8,7 @@
#include "base/json/json_reader.h"
#include "base/logging.h"
-#include "base/memory/scoped_ptr.h"
+#include "base/sequenced_task_runner.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/string_piece.h"
#include "base/strings/string_split.h"
@@ -18,6 +18,7 @@
#include "net/http/http_server_properties.h"
#include "net/quic/quic_protocol.h"
#include "net/quic/quic_utils.h"
+#include "net/socket/ssl_client_socket.h"
#include "net/url_request/url_request_context_builder.h"
namespace cronet {
@@ -52,10 +53,13 @@ const char kAsyncDnsFieldTrialName[] = "AsyncDNS";
// Name of boolean to enable AsyncDNS experiment.
const char kAsyncDnsEnable[] = "enable";
+const char kSSLKeyLogFile[] = "ssl_key_log_file";
+
void ParseAndSetExperimentalOptions(
const std::string& experimental_options,
net::URLRequestContextBuilder* context_builder,
- net::NetLog* net_log) {
+ net::NetLog* net_log,
+ const scoped_refptr<base::SequencedTaskRunner>& file_task_runner) {
if (experimental_options.empty())
return;
@@ -194,6 +198,20 @@ void ParseAndSetExperimentalOptions(
}
}
}
+
+ std::string ssl_key_log_file_string;
+ if (dict->GetString(kSSLKeyLogFile, &ssl_key_log_file_string)) {
+ DCHECK(file_task_runner);
+ base::FilePath ssl_key_log_file(ssl_key_log_file_string);
+ if (!ssl_key_log_file.empty() && file_task_runner) {
+ // SetSSLKeyLogFile is only safe to call before any SSLClientSockets are
+ // created. This should not be used if there are multiple CronetEngine.
+ // TODO(xunjieli): Expose this as a stable API after crbug.com/458365 is
+ // resolved.
+ net::SSLClientSocket::SetSSLKeyLogFile(ssl_key_log_file,
+ file_task_runner);
+ }
+ }
}
} // namespace
@@ -251,7 +269,8 @@ URLRequestContextConfig::~URLRequestContextConfig() {}
void URLRequestContextConfig::ConfigureURLRequestContextBuilder(
net::URLRequestContextBuilder* context_builder,
- net::NetLog* net_log) {
+ net::NetLog* net_log,
+ const scoped_refptr<base::SequencedTaskRunner>& file_task_runner) {
std::string config_cache;
if (http_cache != DISABLED) {
net::URLRequestContextBuilder::HttpCacheParams cache_params;
@@ -273,8 +292,8 @@ void URLRequestContextConfig::ConfigureURLRequestContextBuilder(
if (enable_quic)
context_builder->set_quic_user_agent_id(quic_user_agent_id);
- ParseAndSetExperimentalOptions(experimental_options, context_builder,
- net_log);
+ ParseAndSetExperimentalOptions(experimental_options, context_builder, net_log,
+ file_task_runner);
if (mock_cert_verifier)
context_builder->SetCertVerifier(std::move(mock_cert_verifier));
« no previous file with comments | « components/cronet/url_request_context_config.h ('k') | components/cronet/url_request_context_config_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698