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

Side by Side Diff: net/tools/transport_security_state_generator/input_file_parsers.cc

Issue 2924583002: Handle Windows style line-endings in transport_security_state_static.pins. (Closed)
Patch Set: Created 3 years, 6 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 unified diff | Download patch
« no previous file with comments | « no previous file | net/tools/transport_security_state_generator/input_file_parsers_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2017 The Chromium Authors. All rights reserved. 1 // Copyright 2017 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "net/tools/transport_security_state_generator/input_file_parsers.h" 5 #include "net/tools/transport_security_state_generator/input_file_parsers.h"
6 6
7 #include <sstream> 7 #include <sstream>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/json/json_reader.h" 10 #include "base/json/json_reader.h"
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after
171 CertificateParserState current_state = CertificateParserState::PRE_NAME; 171 CertificateParserState current_state = CertificateParserState::PRE_NAME;
172 172
173 const base::CompareCase& compare_mode = base::CompareCase::INSENSITIVE_ASCII; 173 const base::CompareCase& compare_mode = base::CompareCase::INSENSITIVE_ASCII;
174 std::string name; 174 std::string name;
175 std::string buffer; 175 std::string buffer;
176 std::string subject_name; 176 std::string subject_name;
177 bssl::UniquePtr<X509> certificate; 177 bssl::UniquePtr<X509> certificate;
178 SPKIHash hash; 178 SPKIHash hash;
179 179
180 for (const base::StringPiece& line : SplitStringPiece( 180 for (const base::StringPiece& line : SplitStringPiece(
181 certs_input, "\n", base::KEEP_WHITESPACE, base::SPLIT_WANT_ALL)) { 181 certs_input, "\n", base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL)) {
182 if (line[0] == '#') { 182 if (line[0] == '#') {
183 continue; 183 continue;
184 } 184 }
185 185
186 if (line.empty() && current_state == CertificateParserState::PRE_NAME) { 186 if (line.empty() && current_state == CertificateParserState::PRE_NAME) {
187 continue; 187 continue;
188 } 188 }
189 189
190 switch (current_state) { 190 switch (current_state) {
191 case CertificateParserState::PRE_NAME: 191 case CertificateParserState::PRE_NAME:
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after
368 368
369 pinsets->RegisterPinset(std::move(pinset)); 369 pinsets->RegisterPinset(std::move(pinset));
370 } 370 }
371 371
372 return true; 372 return true;
373 } 373 }
374 374
375 } // namespace transport_security_state 375 } // namespace transport_security_state
376 376
377 } // namespace net 377 } // namespace net
OLDNEW
« no previous file with comments | « no previous file | net/tools/transport_security_state_generator/input_file_parsers_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698