OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/test_server.h" | 5 #include "net/test/test_server.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 324 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
335 FilePath TestServer::GetRootCertificatePath() const { | 335 FilePath TestServer::GetRootCertificatePath() const { |
336 return certificates_dir_.AppendASCII("root_ca_cert.crt"); | 336 return certificates_dir_.AppendASCII("root_ca_cert.crt"); |
337 } | 337 } |
338 | 338 |
339 bool TestServer::LoadTestRootCert() { | 339 bool TestServer::LoadTestRootCert() { |
340 TestRootCerts* root_certs = TestRootCerts::GetInstance(); | 340 TestRootCerts* root_certs = TestRootCerts::GetInstance(); |
341 return root_certs->AddFromFile(GetRootCertificatePath()); | 341 return root_certs->AddFromFile(GetRootCertificatePath()); |
342 } | 342 } |
343 | 343 |
344 bool TestServer::AddCommandLineArguments(CommandLine* command_line) const { | 344 bool TestServer::AddCommandLineArguments(CommandLine* command_line) const { |
345 command_line->AppendSwitchASCII("port", | 345 command_line->AppendArg("--port=" + |
346 base::IntToString(host_port_pair_.port())); | 346 base::IntToString(host_port_pair_.port())); |
347 command_line->AppendSwitchPath("data-dir", document_root_); | 347 command_line->AppendArgNative(FILE_PATH_LITERAL("--data-dir=") + |
| 348 document_root_.value()); |
348 | 349 |
349 if (logging::GetMinLogLevel() == logging::LOG_VERBOSE) { | 350 if (logging::GetMinLogLevel() == logging::LOG_VERBOSE) { |
350 command_line->AppendArg("--log-to-console"); | 351 command_line->AppendArg("--log-to-console"); |
351 } | 352 } |
352 | 353 |
353 if (type_ == TYPE_FTP) { | 354 if (type_ == TYPE_FTP) { |
354 command_line->AppendArg("-f"); | 355 command_line->AppendArg("-f"); |
355 } else if (type_ == TYPE_SYNC) { | 356 } else if (type_ == TYPE_SYNC) { |
356 command_line->AppendArg("--sync"); | 357 command_line->AppendArg("--sync"); |
357 } else if (type_ == TYPE_HTTPS) { | 358 } else if (type_ == TYPE_HTTPS) { |
358 FilePath certificate_path(certificates_dir_); | 359 FilePath certificate_path(certificates_dir_); |
359 certificate_path = certificate_path.Append( | 360 certificate_path = certificate_path.Append( |
360 https_options_.GetCertificateFile()); | 361 https_options_.GetCertificateFile()); |
361 if (!file_util::PathExists(certificate_path)) { | 362 if (!file_util::PathExists(certificate_path)) { |
362 LOG(ERROR) << "Certificate path " << certificate_path.value() | 363 LOG(ERROR) << "Certificate path " << certificate_path.value() |
363 << " doesn't exist. Can't launch https server."; | 364 << " doesn't exist. Can't launch https server."; |
364 return false; | 365 return false; |
365 } | 366 } |
366 command_line->AppendSwitchPath("https", certificate_path); | 367 command_line->AppendArgNative(FILE_PATH_LITERAL("--https=") + |
| 368 certificate_path.value()); |
367 | 369 |
368 if (https_options_.request_client_certificate) | 370 if (https_options_.request_client_certificate) |
369 command_line->AppendSwitch("ssl-client-auth"); | 371 command_line->AppendArg("--ssl-client-auth"); |
370 | 372 |
371 for (std::vector<FilePath>::const_iterator it = | 373 for (std::vector<FilePath>::const_iterator it = |
372 https_options_.client_authorities.begin(); | 374 https_options_.client_authorities.begin(); |
373 it != https_options_.client_authorities.end(); ++it) { | 375 it != https_options_.client_authorities.end(); ++it) { |
374 if (!file_util::PathExists(*it)) { | 376 if (!file_util::PathExists(*it)) { |
375 LOG(ERROR) << "Client authority path " << it->value() | 377 LOG(ERROR) << "Client authority path " << it->value() |
376 << " doesn't exist. Can't launch https server."; | 378 << " doesn't exist. Can't launch https server."; |
377 return false; | 379 return false; |
378 } | 380 } |
379 | 381 |
380 command_line->AppendSwitchPath("ssl-client-ca", *it); | 382 command_line->AppendArgNative(FILE_PATH_LITERAL("--ssl-client-ca=") + |
| 383 it->value()); |
381 } | 384 } |
382 | 385 |
383 const char kBulkCipherSwitch[] = "ssl-bulk-cipher"; | 386 const std::string kBulkCipherSwitch("--ssl-bulk-cipher"); |
384 if (https_options_.bulk_ciphers & HTTPSOptions::BULK_CIPHER_RC4) | 387 if (https_options_.bulk_ciphers & HTTPSOptions::BULK_CIPHER_RC4) |
385 command_line->AppendSwitchASCII(kBulkCipherSwitch, "rc4"); | 388 command_line->AppendArg(kBulkCipherSwitch + "=rc4"); |
386 if (https_options_.bulk_ciphers & HTTPSOptions::BULK_CIPHER_AES128) | 389 if (https_options_.bulk_ciphers & HTTPSOptions::BULK_CIPHER_AES128) |
387 command_line->AppendSwitchASCII(kBulkCipherSwitch, "aes128"); | 390 command_line->AppendArg(kBulkCipherSwitch + "=aes128"); |
388 if (https_options_.bulk_ciphers & HTTPSOptions::BULK_CIPHER_AES256) | 391 if (https_options_.bulk_ciphers & HTTPSOptions::BULK_CIPHER_AES256) |
389 command_line->AppendSwitchASCII(kBulkCipherSwitch, "aes256"); | 392 command_line->AppendArg(kBulkCipherSwitch + "=aes256"); |
390 if (https_options_.bulk_ciphers & HTTPSOptions::BULK_CIPHER_3DES) | 393 if (https_options_.bulk_ciphers & HTTPSOptions::BULK_CIPHER_3DES) |
391 command_line->AppendSwitchASCII(kBulkCipherSwitch, "3des"); | 394 command_line->AppendArg(kBulkCipherSwitch + "=3des"); |
392 } | 395 } |
393 | 396 |
394 return true; | 397 return true; |
395 } | 398 } |
396 | 399 |
397 } // namespace net | 400 } // namespace net |
OLD | NEW |