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

Unified Diff: chrome/browser/io_thread.cc

Issue 1403863002: Enable exporting SSLKEYLOGFILE on Android w/ command line arguments (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: handle env in io_thread Created 5 years, 2 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 | « no previous file | chrome/common/chrome_switches.h » ('j') | net/socket/ssl_client_socket.h » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/io_thread.cc
diff --git a/chrome/browser/io_thread.cc b/chrome/browser/io_thread.cc
index 952964b1b79a7b16d32de582d06b4334a6b7086f..fe2ef5ab49fb2759e80606a2e777ddac09b96e4c 100644
--- a/chrome/browser/io_thread.cc
+++ b/chrome/browser/io_thread.cc
@@ -12,6 +12,7 @@
#include "base/command_line.h"
#include "base/compiler_specific.h"
#include "base/debug/leak_tracker.h"
+#include "base/environment.h"
#include "base/logging.h"
#include "base/metrics/field_trial.h"
#include "base/prefs/pref_registry_simple.h"
@@ -80,6 +81,7 @@
#include "net/quic/crypto/crypto_protocol.h"
#include "net/quic/quic_protocol.h"
#include "net/quic/quic_utils.h"
+#include "net/socket/ssl_client_socket.h"
#include "net/socket/tcp_client_socket.h"
#include "net/spdy/spdy_session.h"
#include "net/ssl/channel_id_service.h"
@@ -553,6 +555,36 @@ void IOThread::Init() {
const base::CommandLine& command_line =
*base::CommandLine::ForCurrentProcess();
+ std::string ssl_keylog_file;
+ scoped_ptr<base::Environment> env(base::Environment::Create());
+
+ if (command_line.HasSwitch(switches::kSSLKeyLogFile)) {
+ ssl_keylog_file = command_line.GetSwitchValueASCII(
+ switches::kSSLKeyLogFile);
+
+ std::string env_keylog_file;
+ if (env->GetVar("SSLKEYLOGFILE", &env_keylog_file) &&
Bryan McQuade 2015/10/15 01:05:26 let's avoid looking up the env var twice. how abou
Zhongyi Shi 2015/10/15 02:02:04 Done.
+ !env_keylog_file.empty()) {
+ if (ssl_keylog_file.empty()) {
+ LOG(WARNING) << "Commandline ssl-key-log-file argument empty, ignored.";
+ ssl_keylog_file = env_keylog_file;
+ } else {
+ LOG(WARNING) <<
+ "Environment variable SSLKEYLOGFILE is set but ignored.";
+ }
+ }
+ } else {
+ env->GetVar("SSLKEYLOGFILE", &ssl_keylog_file);
+ }
+
+ if (!ssl_keylog_file.empty()) {
+ #if defined(USE_OPENSSL)
+ net::SSLClientSocket::SetSSLKeyLogFile(ssl_keylog_file);
+ #else
+ DVLOG(1) << "Platform does not support openssl";
+ #endif
+ }
+
DCHECK(!globals_);
globals_ = new Globals;
« no previous file with comments | « no previous file | chrome/common/chrome_switches.h » ('j') | net/socket/ssl_client_socket.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698