Index: chrome/browser/io_thread.cc |
diff --git a/chrome/browser/io_thread.cc b/chrome/browser/io_thread.cc |
index 952964b1b79a7b16d32de582d06b4334a6b7086f..7b318b14893257521fa9abeed178d60434c66a8e 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" |
@@ -533,6 +535,21 @@ net::URLRequestContextGetter* IOThread::system_url_request_context_getter() { |
return system_url_request_context_getter_.get(); |
} |
+void IOThread::GetSSLKeyLogFile(const base::CommandLine& command_line, |
davidben
2015/10/15 19:08:23
This can just be a function defined after line 299
Bryan McQuade
2015/10/15 19:11:12
if this method doesn't depend any IOThread class s
Zhongyi Shi
2015/10/15 19:47:56
Done.
|
+ std::string& ssl_keylog_file){ |
davidben
2015/10/15 19:08:23
Style guide prohibits non-const reference paramete
Zhongyi Shi
2015/10/15 19:47:56
Done.
|
+ if (command_line.HasSwitch(switches::kSSLKeyLogFile)) { |
+ ssl_keylog_file = command_line.GetSwitchValueASCII( |
+ switches::kSSLKeyLogFile); |
+ if (!ssl_keylog_file.empty()) { |
+ return; |
+ } else { |
+ LOG(WARNING) << "ssl-key-log-file argument missing"; |
+ } |
+ } |
+ scoped_ptr<base::Environment> env(base::Environment::Create()); |
+ env->GetVar("SSLKEYLOGFILE", &ssl_keylog_file); |
+} |
+ |
void IOThread::Init() { |
// TODO(erikchen): Remove ScopedTracker below once http://crbug.com/466432 |
// is fixed. |
@@ -553,6 +570,13 @@ void IOThread::Init() { |
const base::CommandLine& command_line = |
*base::CommandLine::ForCurrentProcess(); |
+ // Export ssl keys if log file specified. |
+ std::string ssl_keylog_file; |
+ GetSSLKeyLogFile(command_line, ssl_keylog_file); |
+ if (!ssl_keylog_file.empty()) { |
davidben
2015/10/15 19:08:23
Nit: I actually really dislike this rule and prefe
|
+ net::SSLClientSocket::SetSSLKeyLogFile(ssl_keylog_file); |
+ } |
+ |
DCHECK(!globals_); |
globals_ = new Globals; |