Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/base_test_server.h" | 5 #include "net/test/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 321 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 332 bool BaseTestServer::GenerateArguments(base::DictionaryValue* arguments) const { | 332 bool BaseTestServer::GenerateArguments(base::DictionaryValue* arguments) const { |
| 333 DCHECK(arguments); | 333 DCHECK(arguments); |
| 334 | 334 |
| 335 arguments->SetString("host", host_port_pair_.host()); | 335 arguments->SetString("host", host_port_pair_.host()); |
| 336 arguments->SetInteger("port", host_port_pair_.port()); | 336 arguments->SetInteger("port", host_port_pair_.port()); |
| 337 arguments->SetString("data-dir", document_root_.value()); | 337 arguments->SetString("data-dir", document_root_.value()); |
| 338 | 338 |
| 339 if (VLOG_IS_ON(1) || log_to_console_) | 339 if (VLOG_IS_ON(1) || log_to_console_) |
| 340 arguments->Set("log-to-console", base::Value::CreateNullValue()); | 340 arguments->Set("log-to-console", base::Value::CreateNullValue()); |
| 341 | 341 |
| 342 if (type_ == TYPE_HTTPS) { | 342 if (UsingSSL(type_)) { |
| 343 arguments->Set("https", base::Value::CreateNullValue()); | |
| 344 | |
| 345 // Check the certificate arguments of the HTTPS server. | 343 // Check the certificate arguments of the HTTPS server. |
| 346 FilePath certificate_path(certificates_dir_); | 344 FilePath certificate_path(certificates_dir_); |
| 347 FilePath certificate_file(ssl_options_.GetCertificateFile()); | 345 FilePath certificate_file(ssl_options_.GetCertificateFile()); |
| 348 if (!certificate_file.value().empty()) { | 346 if (!certificate_file.value().empty()) { |
| 349 certificate_path = certificate_path.Append(certificate_file); | 347 certificate_path = certificate_path.Append(certificate_file); |
| 350 if (certificate_path.IsAbsolute() && | 348 if (certificate_path.IsAbsolute() && |
| 351 !file_util::PathExists(certificate_path)) { | 349 !file_util::PathExists(certificate_path)) { |
| 352 LOG(ERROR) << "Certificate path " << certificate_path.value() | 350 LOG(ERROR) << "Certificate path " << certificate_path.value() |
| 353 << " doesn't exist. Can't launch https server."; | 351 << " doesn't exist. Can't launch https server."; |
| 354 return false; | 352 return false; |
| 355 } | 353 } |
| 356 arguments->SetString("cert-and-key-file", certificate_path.value()); | 354 arguments->SetString("cert-and-key-file", certificate_path.value()); |
| 357 } | 355 } |
| 358 | 356 |
| 359 std::string ocsp_arg = ssl_options_.GetOCSPArgument(); | |
| 360 if (!ocsp_arg.empty()) | |
| 361 arguments->SetString("ocsp", ocsp_arg); | |
| 362 | |
| 363 // Check the client certificate related arguments. | 357 // Check the client certificate related arguments. |
| 364 if (ssl_options_.request_client_certificate) | 358 if (ssl_options_.request_client_certificate) |
| 365 arguments->Set("ssl-client-auth", base::Value::CreateNullValue()); | 359 arguments->Set("ssl-client-auth", base::Value::CreateNullValue()); |
| 366 scoped_ptr<base::ListValue> ssl_client_certs(new base::ListValue()); | 360 scoped_ptr<base::ListValue> ssl_client_certs(new base::ListValue()); |
| 367 | 361 |
| 368 std::vector<FilePath>::const_iterator it; | 362 std::vector<FilePath>::const_iterator it; |
| 369 for (it = ssl_options_.client_authorities.begin(); | 363 for (it = ssl_options_.client_authorities.begin(); |
| 370 it != ssl_options_.client_authorities.end(); ++it) { | 364 it != ssl_options_.client_authorities.end(); ++it) { |
| 371 if (it->IsAbsolute() && !file_util::PathExists(*it)) { | 365 if (it->IsAbsolute() && !file_util::PathExists(*it)) { |
| 372 LOG(ERROR) << "Client authority path " << it->value() | 366 LOG(ERROR) << "Client authority path " << it->value() |
| 373 << " doesn't exist. Can't launch https server."; | 367 << " doesn't exist. Can't launch https server."; |
| 374 return false; | 368 return false; |
| 375 } | 369 } |
| 376 ssl_client_certs->Append(base::Value::CreateStringValue(it->value())); | 370 ssl_client_certs->Append(base::Value::CreateStringValue(it->value())); |
| 377 } | 371 } |
| 378 | 372 |
| 379 if (ssl_client_certs->GetSize()) | 373 if (ssl_client_certs->GetSize()) |
| 380 arguments->Set("ssl-client-ca", ssl_client_certs.release()); | 374 arguments->Set("ssl-client-ca", ssl_client_certs.release()); |
| 375 } | |
| 376 | |
| 377 if (type_ == TYPE_HTTPS) { | |
|
Ryan Sleevi
2012/10/15 17:04:52
Seems you have duplicated this change on other CLs
Takashi Toyoshima
2012/10/16 08:23:10
OK, I split changes on testserver.py and base_test
| |
| 378 arguments->Set("https", base::Value::CreateNullValue()); | |
| 379 | |
| 380 std::string ocsp_arg = ssl_options_.GetOCSPArgument(); | |
| 381 if (!ocsp_arg.empty()) | |
| 382 arguments->SetString("ocsp", ocsp_arg); | |
| 381 | 383 |
| 382 // Check bulk cipher argument. | 384 // Check bulk cipher argument. |
| 383 scoped_ptr<base::ListValue> bulk_cipher_values(new base::ListValue()); | 385 scoped_ptr<base::ListValue> bulk_cipher_values(new base::ListValue()); |
| 384 GetCiphersList(ssl_options_.bulk_ciphers, bulk_cipher_values.get()); | 386 GetCiphersList(ssl_options_.bulk_ciphers, bulk_cipher_values.get()); |
| 385 if (bulk_cipher_values->GetSize()) | 387 if (bulk_cipher_values->GetSize()) |
| 386 arguments->Set("ssl-bulk-cipher", bulk_cipher_values.release()); | 388 arguments->Set("ssl-bulk-cipher", bulk_cipher_values.release()); |
| 387 if (ssl_options_.record_resume) | 389 if (ssl_options_.record_resume) |
| 388 arguments->Set("https-record-resume", base::Value::CreateNullValue()); | 390 arguments->Set("https-record-resume", base::Value::CreateNullValue()); |
| 389 if (ssl_options_.tls_intolerant != SSLOptions::TLS_INTOLERANT_NONE) { | 391 if (ssl_options_.tls_intolerant != SSLOptions::TLS_INTOLERANT_NONE) { |
| 390 arguments->Set("tls-intolerant", | 392 arguments->Set("tls-intolerant", |
| 391 base::Value::CreateIntegerValue(ssl_options_.tls_intolerant)); | 393 base::Value::CreateIntegerValue(ssl_options_.tls_intolerant)); |
| 392 } | 394 } |
| 393 } | 395 } |
| 394 return true; | 396 return true; |
| 395 } | 397 } |
| 396 | 398 |
| 397 } // namespace net | 399 } // namespace net |
| OLD | NEW |