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

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: wrapping up 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
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;

Powered by Google App Engine
This is Rietveld 408576698