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

Unified Diff: chrome/browser/io_thread.cc

Issue 148283002: Certificate Transparency: Enhance the CT log flag for multiple logs (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Amending comment Created 6 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
« no previous file with comments | « no previous file | chrome/common/chrome_switches.cc » ('j') | chrome/common/chrome_switches.cc » ('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 314f9657909acd4e2339faa1387b7a7aab7f92ce..94f0a92e150a61171850bd8cb88566c7306d99df 100644
--- a/chrome/browser/io_thread.cc
+++ b/chrome/browser/io_thread.cc
@@ -562,19 +562,31 @@ void IOThread::InitAsync() {
if (command_line.HasSwitch(switches::kCertificateTransparencyLog)) {
std::string switch_value = command_line.GetSwitchValueASCII(
switches::kCertificateTransparencyLog);
- size_t delim_pos = switch_value.find(":");
- CHECK(delim_pos != std::string::npos)
+ size_t log_delim_pos = switch_value.find(";");
Lei Zhang 2014/01/27 19:46:06 Would it be slightly easier / readable to do this
Eran M. (Google) 2014/01/28 09:13:02 Done.
+ while (!switch_value.empty()) {
+ std::string curr_log = switch_value.substr(0, log_delim_pos);
+ size_t delim_pos = curr_log.find(":");
+ CHECK(delim_pos != std::string::npos)
<< "CT log description not provided (switch format"
- " is 'description:base64_key')";
- std::string log_description(switch_value.substr(0, delim_pos));
- std::string ct_public_key_data;
- CHECK(base::Base64Decode(
- switch_value.substr(delim_pos + 1),
- &ct_public_key_data)) << "Unable to decode CT public key.";
- scoped_ptr<net::CTLogVerifier> external_log_verifier(
- net::CTLogVerifier::Create(ct_public_key_data, log_description));
- CHECK(external_log_verifier) << "Unable to parse CT public key.";
- ct_verifier->AddLog(external_log_verifier.Pass());
+ " is 'description:base64_key')";
+ std::string log_description(curr_log.substr(0, delim_pos));
+ std::string ct_public_key_data;
+ CHECK(base::Base64Decode(
+ curr_log.substr(delim_pos + 1),
+ &ct_public_key_data)) << "Unable to decode CT public key.";
+ scoped_ptr<net::CTLogVerifier> external_log_verifier(
+ net::CTLogVerifier::Create(ct_public_key_data, log_description));
+ CHECK(external_log_verifier) << "Unable to parse CT public key.";
+ VLOG(1) << "Adding log with description " << log_description;
+ ct_verifier->AddLog(external_log_verifier.Pass());
+
+ if (log_delim_pos == std::string::npos) {
+ switch_value = "";
+ } else {
+ switch_value = switch_value.substr(log_delim_pos + 1);
+ }
+ log_delim_pos = switch_value.find(";");
+ }
}
#else
if (command_line.HasSwitch(switches::kCertificateTransparencyLog)) {
« no previous file with comments | « no previous file | chrome/common/chrome_switches.cc » ('j') | chrome/common/chrome_switches.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698