| 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 <stdint.h> | 7 #include <stdint.h> |
| 8 #include <limits> | 8 #include <limits> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <utility> | 10 #include <utility> |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 57 case CLIENT_CERT_ECDSA_SIGN: | 57 case CLIENT_CERT_ECDSA_SIGN: |
| 58 return "ecdsa_sign"; | 58 return "ecdsa_sign"; |
| 59 default: | 59 default: |
| 60 NOTREACHED(); | 60 NOTREACHED(); |
| 61 return ""; | 61 return ""; |
| 62 } | 62 } |
| 63 } | 63 } |
| 64 | 64 |
| 65 void GetKeyExchangesList(int key_exchange, base::ListValue* values) { | 65 void GetKeyExchangesList(int key_exchange, base::ListValue* values) { |
| 66 if (key_exchange & BaseTestServer::SSLOptions::KEY_EXCHANGE_RSA) | 66 if (key_exchange & BaseTestServer::SSLOptions::KEY_EXCHANGE_RSA) |
| 67 values->Append(new base::StringValue("rsa")); | 67 values->AppendString("rsa"); |
| 68 if (key_exchange & BaseTestServer::SSLOptions::KEY_EXCHANGE_DHE_RSA) | 68 if (key_exchange & BaseTestServer::SSLOptions::KEY_EXCHANGE_DHE_RSA) |
| 69 values->Append(new base::StringValue("dhe_rsa")); | 69 values->AppendString("dhe_rsa"); |
| 70 if (key_exchange & BaseTestServer::SSLOptions::KEY_EXCHANGE_ECDHE_RSA) | 70 if (key_exchange & BaseTestServer::SSLOptions::KEY_EXCHANGE_ECDHE_RSA) |
| 71 values->Append(new base::StringValue("ecdhe_rsa")); | 71 values->AppendString("ecdhe_rsa"); |
| 72 } | 72 } |
| 73 | 73 |
| 74 void GetCiphersList(int cipher, base::ListValue* values) { | 74 void GetCiphersList(int cipher, base::ListValue* values) { |
| 75 if (cipher & BaseTestServer::SSLOptions::BULK_CIPHER_RC4) | 75 if (cipher & BaseTestServer::SSLOptions::BULK_CIPHER_RC4) |
| 76 values->Append(new base::StringValue("rc4")); | 76 values->AppendString("rc4"); |
| 77 if (cipher & BaseTestServer::SSLOptions::BULK_CIPHER_AES128) | 77 if (cipher & BaseTestServer::SSLOptions::BULK_CIPHER_AES128) |
| 78 values->Append(new base::StringValue("aes128")); | 78 values->AppendString("aes128"); |
| 79 if (cipher & BaseTestServer::SSLOptions::BULK_CIPHER_AES256) | 79 if (cipher & BaseTestServer::SSLOptions::BULK_CIPHER_AES256) |
| 80 values->Append(new base::StringValue("aes256")); | 80 values->AppendString("aes256"); |
| 81 if (cipher & BaseTestServer::SSLOptions::BULK_CIPHER_3DES) | 81 if (cipher & BaseTestServer::SSLOptions::BULK_CIPHER_3DES) |
| 82 values->Append(new base::StringValue("3des")); | 82 values->AppendString("3des"); |
| 83 if (cipher & BaseTestServer::SSLOptions::BULK_CIPHER_AES128GCM) | 83 if (cipher & BaseTestServer::SSLOptions::BULK_CIPHER_AES128GCM) |
| 84 values->Append(new base::StringValue("aes128gcm")); | 84 values->AppendString("aes128gcm"); |
| 85 } | 85 } |
| 86 | 86 |
| 87 base::StringValue* GetTLSIntoleranceType( | 87 base::StringValue* GetTLSIntoleranceType( |
| 88 BaseTestServer::SSLOptions::TLSIntoleranceType type) { | 88 BaseTestServer::SSLOptions::TLSIntoleranceType type) { |
| 89 switch (type) { | 89 switch (type) { |
| 90 case BaseTestServer::SSLOptions::TLS_INTOLERANCE_ALERT: | 90 case BaseTestServer::SSLOptions::TLS_INTOLERANCE_ALERT: |
| 91 return new base::StringValue("alert"); | 91 return new base::StringValue("alert"); |
| 92 case BaseTestServer::SSLOptions::TLS_INTOLERANCE_CLOSE: | 92 case BaseTestServer::SSLOptions::TLS_INTOLERANCE_CLOSE: |
| 93 return new base::StringValue("close"); | 93 return new base::StringValue("close"); |
| 94 case BaseTestServer::SSLOptions::TLS_INTOLERANCE_RESET: | 94 case BaseTestServer::SSLOptions::TLS_INTOLERANCE_RESET: |
| (...skipping 16 matching lines...) Expand all Loading... |
| 111 return false; | 111 return false; |
| 112 | 112 |
| 113 *local_certificates_dir = src_dir.Append(certificates_dir); | 113 *local_certificates_dir = src_dir.Append(certificates_dir); |
| 114 return true; | 114 return true; |
| 115 } | 115 } |
| 116 | 116 |
| 117 std::unique_ptr<base::ListValue> GetTokenBindingParams( | 117 std::unique_ptr<base::ListValue> GetTokenBindingParams( |
| 118 std::vector<int> params) { | 118 std::vector<int> params) { |
| 119 std::unique_ptr<base::ListValue> values(new base::ListValue()); | 119 std::unique_ptr<base::ListValue> values(new base::ListValue()); |
| 120 for (int param : params) { | 120 for (int param : params) { |
| 121 values->Append(new base::FundamentalValue(param)); | 121 values->AppendInteger(param); |
| 122 } | 122 } |
| 123 return values; | 123 return values; |
| 124 } | 124 } |
| 125 | 125 |
| 126 } // namespace | 126 } // namespace |
| 127 | 127 |
| 128 BaseTestServer::SSLOptions::SSLOptions() | 128 BaseTestServer::SSLOptions::SSLOptions() |
| 129 : server_certificate(CERT_OK), | 129 : server_certificate(CERT_OK), |
| 130 ocsp_status(OCSP_OK), | 130 ocsp_status(OCSP_OK), |
| 131 cert_serial(0), | 131 cert_serial(0), |
| (...skipping 363 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 495 std::unique_ptr<base::ListValue> ssl_client_certs(new base::ListValue()); | 495 std::unique_ptr<base::ListValue> ssl_client_certs(new base::ListValue()); |
| 496 | 496 |
| 497 std::vector<base::FilePath>::const_iterator it; | 497 std::vector<base::FilePath>::const_iterator it; |
| 498 for (it = ssl_options_.client_authorities.begin(); | 498 for (it = ssl_options_.client_authorities.begin(); |
| 499 it != ssl_options_.client_authorities.end(); ++it) { | 499 it != ssl_options_.client_authorities.end(); ++it) { |
| 500 if (it->IsAbsolute() && !base::PathExists(*it)) { | 500 if (it->IsAbsolute() && !base::PathExists(*it)) { |
| 501 LOG(ERROR) << "Client authority path " << it->value() | 501 LOG(ERROR) << "Client authority path " << it->value() |
| 502 << " doesn't exist. Can't launch https server."; | 502 << " doesn't exist. Can't launch https server."; |
| 503 return false; | 503 return false; |
| 504 } | 504 } |
| 505 ssl_client_certs->Append(new base::StringValue(it->value())); | 505 ssl_client_certs->AppendString(it->value()); |
| 506 } | 506 } |
| 507 | 507 |
| 508 if (ssl_client_certs->GetSize()) | 508 if (ssl_client_certs->GetSize()) |
| 509 arguments->Set("ssl-client-ca", ssl_client_certs.release()); | 509 arguments->Set("ssl-client-ca", ssl_client_certs.release()); |
| 510 | 510 |
| 511 std::unique_ptr<base::ListValue> client_cert_types(new base::ListValue()); | 511 std::unique_ptr<base::ListValue> client_cert_types(new base::ListValue()); |
| 512 for (size_t i = 0; i < ssl_options_.client_cert_types.size(); i++) { | 512 for (size_t i = 0; i < ssl_options_.client_cert_types.size(); i++) { |
| 513 client_cert_types->Append(new base::StringValue( | 513 client_cert_types->AppendString( |
| 514 GetClientCertType(ssl_options_.client_cert_types[i]))); | 514 GetClientCertType(ssl_options_.client_cert_types[i])); |
| 515 } | 515 } |
| 516 if (client_cert_types->GetSize()) | 516 if (client_cert_types->GetSize()) |
| 517 arguments->Set("ssl-client-cert-type", client_cert_types.release()); | 517 arguments->Set("ssl-client-cert-type", client_cert_types.release()); |
| 518 } | 518 } |
| 519 | 519 |
| 520 if (type_ == TYPE_HTTPS) { | 520 if (type_ == TYPE_HTTPS) { |
| 521 arguments->Set("https", base::Value::CreateNullValue()); | 521 arguments->Set("https", base::Value::CreateNullValue()); |
| 522 | 522 |
| 523 std::string ocsp_arg = ssl_options_.GetOCSPArgument(); | 523 std::string ocsp_arg = ssl_options_.GetOCSPArgument(); |
| 524 if (!ocsp_arg.empty()) | 524 if (!ocsp_arg.empty()) |
| (...skipping 30 matching lines...) Expand all Loading... |
| 555 } | 555 } |
| 556 if (ssl_options_.staple_ocsp_response) | 556 if (ssl_options_.staple_ocsp_response) |
| 557 arguments->Set("staple-ocsp-response", base::Value::CreateNullValue()); | 557 arguments->Set("staple-ocsp-response", base::Value::CreateNullValue()); |
| 558 if (ssl_options_.ocsp_server_unavailable) { | 558 if (ssl_options_.ocsp_server_unavailable) { |
| 559 arguments->Set("ocsp-server-unavailable", | 559 arguments->Set("ocsp-server-unavailable", |
| 560 base::Value::CreateNullValue()); | 560 base::Value::CreateNullValue()); |
| 561 } | 561 } |
| 562 if (!ssl_options_.npn_protocols.empty()) { | 562 if (!ssl_options_.npn_protocols.empty()) { |
| 563 std::unique_ptr<base::ListValue> npn_protocols(new base::ListValue()); | 563 std::unique_ptr<base::ListValue> npn_protocols(new base::ListValue()); |
| 564 for (const std::string& proto : ssl_options_.npn_protocols) { | 564 for (const std::string& proto : ssl_options_.npn_protocols) { |
| 565 npn_protocols->Append(new base::StringValue(proto)); | 565 npn_protocols->AppendString(proto); |
| 566 } | 566 } |
| 567 arguments->Set("npn-protocols", std::move(npn_protocols)); | 567 arguments->Set("npn-protocols", std::move(npn_protocols)); |
| 568 } | 568 } |
| 569 if (ssl_options_.alert_after_handshake) | 569 if (ssl_options_.alert_after_handshake) |
| 570 arguments->Set("alert-after-handshake", base::Value::CreateNullValue()); | 570 arguments->Set("alert-after-handshake", base::Value::CreateNullValue()); |
| 571 | 571 |
| 572 if (ssl_options_.disable_channel_id) | 572 if (ssl_options_.disable_channel_id) |
| 573 arguments->Set("disable-channel-id", base::Value::CreateNullValue()); | 573 arguments->Set("disable-channel-id", base::Value::CreateNullValue()); |
| 574 if (ssl_options_.disable_extended_master_secret) { | 574 if (ssl_options_.disable_extended_master_secret) { |
| 575 arguments->Set("disable-extended-master-secret", | 575 arguments->Set("disable-extended-master-secret", |
| (...skipping 10 matching lines...) Expand all Loading... |
| 586 | 586 |
| 587 return GenerateAdditionalArguments(arguments); | 587 return GenerateAdditionalArguments(arguments); |
| 588 } | 588 } |
| 589 | 589 |
| 590 bool BaseTestServer::GenerateAdditionalArguments( | 590 bool BaseTestServer::GenerateAdditionalArguments( |
| 591 base::DictionaryValue* arguments) const { | 591 base::DictionaryValue* arguments) const { |
| 592 return true; | 592 return true; |
| 593 } | 593 } |
| 594 | 594 |
| 595 } // namespace net | 595 } // namespace net |
| OLD | NEW |