| 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 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 76 | 76 |
| 77 BaseTestServer::SSLOptions::SSLOptions() | 77 BaseTestServer::SSLOptions::SSLOptions() |
| 78 : server_certificate(CERT_OK), | 78 : server_certificate(CERT_OK), |
| 79 ocsp_status(OCSP_OK), | 79 ocsp_status(OCSP_OK), |
| 80 cert_serial(0), | 80 cert_serial(0), |
| 81 request_client_certificate(false), | 81 request_client_certificate(false), |
| 82 key_exchanges(SSLOptions::KEY_EXCHANGE_ANY), | 82 key_exchanges(SSLOptions::KEY_EXCHANGE_ANY), |
| 83 bulk_ciphers(SSLOptions::BULK_CIPHER_ANY), | 83 bulk_ciphers(SSLOptions::BULK_CIPHER_ANY), |
| 84 record_resume(false), | 84 record_resume(false), |
| 85 tls_intolerant(TLS_INTOLERANT_NONE), | 85 tls_intolerant(TLS_INTOLERANT_NONE), |
| 86 reset_on_intolerance(false), |
| 86 fallback_scsv_enabled(false), | 87 fallback_scsv_enabled(false), |
| 87 staple_ocsp_response(false), | 88 staple_ocsp_response(false), |
| 88 enable_npn(false) {} | 89 enable_npn(false) {} |
| 89 | 90 |
| 90 BaseTestServer::SSLOptions::SSLOptions( | 91 BaseTestServer::SSLOptions::SSLOptions( |
| 91 BaseTestServer::SSLOptions::ServerCertificate cert) | 92 BaseTestServer::SSLOptions::ServerCertificate cert) |
| 92 : server_certificate(cert), | 93 : server_certificate(cert), |
| 93 ocsp_status(OCSP_OK), | 94 ocsp_status(OCSP_OK), |
| 94 cert_serial(0), | 95 cert_serial(0), |
| 95 request_client_certificate(false), | 96 request_client_certificate(false), |
| 96 key_exchanges(SSLOptions::KEY_EXCHANGE_ANY), | 97 key_exchanges(SSLOptions::KEY_EXCHANGE_ANY), |
| 97 bulk_ciphers(SSLOptions::BULK_CIPHER_ANY), | 98 bulk_ciphers(SSLOptions::BULK_CIPHER_ANY), |
| 98 record_resume(false), | 99 record_resume(false), |
| 99 tls_intolerant(TLS_INTOLERANT_NONE), | 100 tls_intolerant(TLS_INTOLERANT_NONE), |
| 101 reset_on_intolerance(false), |
| 100 fallback_scsv_enabled(false), | 102 fallback_scsv_enabled(false), |
| 101 staple_ocsp_response(false), | 103 staple_ocsp_response(false), |
| 102 enable_npn(false) {} | 104 enable_npn(false) {} |
| 103 | 105 |
| 104 BaseTestServer::SSLOptions::~SSLOptions() {} | 106 BaseTestServer::SSLOptions::~SSLOptions() {} |
| 105 | 107 |
| 106 base::FilePath BaseTestServer::SSLOptions::GetCertificateFile() const { | 108 base::FilePath BaseTestServer::SSLOptions::GetCertificateFile() const { |
| 107 switch (server_certificate) { | 109 switch (server_certificate) { |
| 108 case CERT_OK: | 110 case CERT_OK: |
| 109 case CERT_MISMATCHED_NAME: | 111 case CERT_MISMATCHED_NAME: |
| (...skipping 321 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 431 scoped_ptr<base::ListValue> bulk_cipher_values(new base::ListValue()); | 433 scoped_ptr<base::ListValue> bulk_cipher_values(new base::ListValue()); |
| 432 GetCiphersList(ssl_options_.bulk_ciphers, bulk_cipher_values.get()); | 434 GetCiphersList(ssl_options_.bulk_ciphers, bulk_cipher_values.get()); |
| 433 if (bulk_cipher_values->GetSize()) | 435 if (bulk_cipher_values->GetSize()) |
| 434 arguments->Set("ssl-bulk-cipher", bulk_cipher_values.release()); | 436 arguments->Set("ssl-bulk-cipher", bulk_cipher_values.release()); |
| 435 if (ssl_options_.record_resume) | 437 if (ssl_options_.record_resume) |
| 436 arguments->Set("https-record-resume", base::Value::CreateNullValue()); | 438 arguments->Set("https-record-resume", base::Value::CreateNullValue()); |
| 437 if (ssl_options_.tls_intolerant != SSLOptions::TLS_INTOLERANT_NONE) { | 439 if (ssl_options_.tls_intolerant != SSLOptions::TLS_INTOLERANT_NONE) { |
| 438 arguments->Set("tls-intolerant", | 440 arguments->Set("tls-intolerant", |
| 439 new base::FundamentalValue(ssl_options_.tls_intolerant)); | 441 new base::FundamentalValue(ssl_options_.tls_intolerant)); |
| 440 } | 442 } |
| 443 if (ssl_options_.reset_on_intolerance) |
| 444 arguments->Set("reset-on-intolerance", base::Value::CreateNullValue()); |
| 441 if (ssl_options_.fallback_scsv_enabled) | 445 if (ssl_options_.fallback_scsv_enabled) |
| 442 arguments->Set("fallback-scsv", base::Value::CreateNullValue()); | 446 arguments->Set("fallback-scsv", base::Value::CreateNullValue()); |
| 443 if (!ssl_options_.signed_cert_timestamps_tls_ext.empty()) { | 447 if (!ssl_options_.signed_cert_timestamps_tls_ext.empty()) { |
| 444 std::string b64_scts_tls_ext; | 448 std::string b64_scts_tls_ext; |
| 445 base::Base64Encode(ssl_options_.signed_cert_timestamps_tls_ext, | 449 base::Base64Encode(ssl_options_.signed_cert_timestamps_tls_ext, |
| 446 &b64_scts_tls_ext); | 450 &b64_scts_tls_ext); |
| 447 arguments->SetString("signed-cert-timestamps-tls-ext", b64_scts_tls_ext); | 451 arguments->SetString("signed-cert-timestamps-tls-ext", b64_scts_tls_ext); |
| 448 } | 452 } |
| 449 if (ssl_options_.staple_ocsp_response) | 453 if (ssl_options_.staple_ocsp_response) |
| 450 arguments->Set("staple-ocsp-response", base::Value::CreateNullValue()); | 454 arguments->Set("staple-ocsp-response", base::Value::CreateNullValue()); |
| 451 if (ssl_options_.enable_npn) | 455 if (ssl_options_.enable_npn) |
| 452 arguments->Set("enable-npn", base::Value::CreateNullValue()); | 456 arguments->Set("enable-npn", base::Value::CreateNullValue()); |
| 453 } | 457 } |
| 454 | 458 |
| 455 return GenerateAdditionalArguments(arguments); | 459 return GenerateAdditionalArguments(arguments); |
| 456 } | 460 } |
| 457 | 461 |
| 458 bool BaseTestServer::GenerateAdditionalArguments( | 462 bool BaseTestServer::GenerateAdditionalArguments( |
| 459 base::DictionaryValue* arguments) const { | 463 base::DictionaryValue* arguments) const { |
| 460 return true; | 464 return true; |
| 461 } | 465 } |
| 462 | 466 |
| 463 } // namespace net | 467 } // namespace net |
| OLD | NEW |