OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/test/spawned_test_server/base_test_server.h" | 5 #include "net/test/spawned_test_server/base_test_server.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/base64.h" | 10 #include "base/base64.h" |
(...skipping 322 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
333 if (VLOG_IS_ON(1) || log_to_console_) | 333 if (VLOG_IS_ON(1) || log_to_console_) |
334 arguments->Set("log-to-console", base::Value::CreateNullValue()); | 334 arguments->Set("log-to-console", base::Value::CreateNullValue()); |
335 | 335 |
336 if (UsingSSL(type_)) { | 336 if (UsingSSL(type_)) { |
337 // Check the certificate arguments of the HTTPS server. | 337 // Check the certificate arguments of the HTTPS server. |
338 base::FilePath certificate_path(certificates_dir_); | 338 base::FilePath certificate_path(certificates_dir_); |
339 base::FilePath certificate_file(ssl_options_.GetCertificateFile()); | 339 base::FilePath certificate_file(ssl_options_.GetCertificateFile()); |
340 if (!certificate_file.value().empty()) { | 340 if (!certificate_file.value().empty()) { |
341 certificate_path = certificate_path.Append(certificate_file); | 341 certificate_path = certificate_path.Append(certificate_file); |
342 if (certificate_path.IsAbsolute() && | 342 if (certificate_path.IsAbsolute() && |
343 !file_util::PathExists(certificate_path)) { | 343 !base::PathExists(certificate_path)) { |
344 LOG(ERROR) << "Certificate path " << certificate_path.value() | 344 LOG(ERROR) << "Certificate path " << certificate_path.value() |
345 << " doesn't exist. Can't launch https server."; | 345 << " doesn't exist. Can't launch https server."; |
346 return false; | 346 return false; |
347 } | 347 } |
348 arguments->SetString("cert-and-key-file", certificate_path.value()); | 348 arguments->SetString("cert-and-key-file", certificate_path.value()); |
349 } | 349 } |
350 | 350 |
351 // Check the client certificate related arguments. | 351 // Check the client certificate related arguments. |
352 if (ssl_options_.request_client_certificate) | 352 if (ssl_options_.request_client_certificate) |
353 arguments->Set("ssl-client-auth", base::Value::CreateNullValue()); | 353 arguments->Set("ssl-client-auth", base::Value::CreateNullValue()); |
354 scoped_ptr<base::ListValue> ssl_client_certs(new base::ListValue()); | 354 scoped_ptr<base::ListValue> ssl_client_certs(new base::ListValue()); |
355 | 355 |
356 std::vector<base::FilePath>::const_iterator it; | 356 std::vector<base::FilePath>::const_iterator it; |
357 for (it = ssl_options_.client_authorities.begin(); | 357 for (it = ssl_options_.client_authorities.begin(); |
358 it != ssl_options_.client_authorities.end(); ++it) { | 358 it != ssl_options_.client_authorities.end(); ++it) { |
359 if (it->IsAbsolute() && !file_util::PathExists(*it)) { | 359 if (it->IsAbsolute() && !base::PathExists(*it)) { |
360 LOG(ERROR) << "Client authority path " << it->value() | 360 LOG(ERROR) << "Client authority path " << it->value() |
361 << " doesn't exist. Can't launch https server."; | 361 << " doesn't exist. Can't launch https server."; |
362 return false; | 362 return false; |
363 } | 363 } |
364 ssl_client_certs->Append(new base::StringValue(it->value())); | 364 ssl_client_certs->Append(new base::StringValue(it->value())); |
365 } | 365 } |
366 | 366 |
367 if (ssl_client_certs->GetSize()) | 367 if (ssl_client_certs->GetSize()) |
368 arguments->Set("ssl-client-ca", ssl_client_certs.release()); | 368 arguments->Set("ssl-client-ca", ssl_client_certs.release()); |
369 } | 369 } |
(...skipping 20 matching lines...) Expand all Loading... |
390 | 390 |
391 return GenerateAdditionalArguments(arguments); | 391 return GenerateAdditionalArguments(arguments); |
392 } | 392 } |
393 | 393 |
394 bool BaseTestServer::GenerateAdditionalArguments( | 394 bool BaseTestServer::GenerateAdditionalArguments( |
395 base::DictionaryValue* arguments) const { | 395 base::DictionaryValue* arguments) const { |
396 return true; | 396 return true; |
397 } | 397 } |
398 | 398 |
399 } // namespace net | 399 } // namespace net |
OLD | NEW |