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 } |
356 } | |
357 | |
358 if (type_ == TYPE_HTTPS) { | |
359 // TODO(toyoshim): TYPE_WSS should support client auth, too. | |
Ryan Sleevi
2012/10/15 16:51:54
Do you have a BUG # to track this?
| |
360 arguments->Set("https", base::Value::CreateNullValue()); | |
358 | 361 |
359 std::string ocsp_arg = ssl_options_.GetOCSPArgument(); | 362 std::string ocsp_arg = ssl_options_.GetOCSPArgument(); |
360 if (!ocsp_arg.empty()) | 363 if (!ocsp_arg.empty()) |
361 arguments->SetString("ocsp", ocsp_arg); | 364 arguments->SetString("ocsp", ocsp_arg); |
362 | 365 |
363 // Check the client certificate related arguments. | 366 // Check the client certificate related arguments. |
364 if (ssl_options_.request_client_certificate) | 367 if (ssl_options_.request_client_certificate) |
365 arguments->Set("ssl-client-auth", base::Value::CreateNullValue()); | 368 arguments->Set("ssl-client-auth", base::Value::CreateNullValue()); |
366 scoped_ptr<base::ListValue> ssl_client_certs(new base::ListValue()); | 369 scoped_ptr<base::ListValue> ssl_client_certs(new base::ListValue()); |
367 | 370 |
(...skipping 20 matching lines...) Expand all Loading... | |
388 arguments->Set("https-record-resume", base::Value::CreateNullValue()); | 391 arguments->Set("https-record-resume", base::Value::CreateNullValue()); |
389 if (ssl_options_.tls_intolerant != SSLOptions::TLS_INTOLERANT_NONE) { | 392 if (ssl_options_.tls_intolerant != SSLOptions::TLS_INTOLERANT_NONE) { |
390 arguments->Set("tls-intolerant", | 393 arguments->Set("tls-intolerant", |
391 base::Value::CreateIntegerValue(ssl_options_.tls_intolerant)); | 394 base::Value::CreateIntegerValue(ssl_options_.tls_intolerant)); |
392 } | 395 } |
393 } | 396 } |
394 return true; | 397 return true; |
395 } | 398 } |
396 | 399 |
397 } // namespace net | 400 } // namespace net |
OLD | NEW |