Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(173)

Side by Side Diff: net/test/spawned_test_server/base_test_server.cc

Issue 280853002: Preserve transport errors for OpenSSL sockets. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rephrase a lot of comments. Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 if (cipher & BaseTestServer::SSLOptions::BULK_CIPHER_RC4) 65 if (cipher & BaseTestServer::SSLOptions::BULK_CIPHER_RC4)
66 values->Append(new base::StringValue("rc4")); 66 values->Append(new base::StringValue("rc4"));
67 if (cipher & BaseTestServer::SSLOptions::BULK_CIPHER_AES128) 67 if (cipher & BaseTestServer::SSLOptions::BULK_CIPHER_AES128)
68 values->Append(new base::StringValue("aes128")); 68 values->Append(new base::StringValue("aes128"));
69 if (cipher & BaseTestServer::SSLOptions::BULK_CIPHER_AES256) 69 if (cipher & BaseTestServer::SSLOptions::BULK_CIPHER_AES256)
70 values->Append(new base::StringValue("aes256")); 70 values->Append(new base::StringValue("aes256"));
71 if (cipher & BaseTestServer::SSLOptions::BULK_CIPHER_3DES) 71 if (cipher & BaseTestServer::SSLOptions::BULK_CIPHER_3DES)
72 values->Append(new base::StringValue("3des")); 72 values->Append(new base::StringValue("3des"));
73 } 73 }
74 74
75 std::string GetTLSIntoleranceType(
76 BaseTestServer::SSLOptions::TLSIntoleranceType type) {
77 switch (type) {
78 case BaseTestServer::SSLOptions::TLS_INTOLERANCE_ALERT:
79 return "alert";
80 case BaseTestServer::SSLOptions::TLS_INTOLERANCE_CLOSE:
81 return "close";
82 case BaseTestServer::SSLOptions::TLS_INTOLERANCE_RESET:
83 return "reset";
84 default:
85 NOTREACHED();
86 return "";
87 }
88 }
89
75 } // namespace 90 } // namespace
76 91
77 BaseTestServer::SSLOptions::SSLOptions() 92 BaseTestServer::SSLOptions::SSLOptions()
78 : server_certificate(CERT_OK), 93 : server_certificate(CERT_OK),
79 ocsp_status(OCSP_OK), 94 ocsp_status(OCSP_OK),
80 cert_serial(0), 95 cert_serial(0),
81 request_client_certificate(false), 96 request_client_certificate(false),
82 key_exchanges(SSLOptions::KEY_EXCHANGE_ANY), 97 key_exchanges(SSLOptions::KEY_EXCHANGE_ANY),
83 bulk_ciphers(SSLOptions::BULK_CIPHER_ANY), 98 bulk_ciphers(SSLOptions::BULK_CIPHER_ANY),
84 record_resume(false), 99 record_resume(false),
85 tls_intolerant(TLS_INTOLERANT_NONE), 100 tls_intolerant(TLS_INTOLERANT_NONE),
101 tls_intolerance_type(TLS_INTOLERANCE_ALERT),
86 fallback_scsv_enabled(false), 102 fallback_scsv_enabled(false),
87 staple_ocsp_response(false), 103 staple_ocsp_response(false),
88 enable_npn(false) {} 104 enable_npn(false) {}
89 105
90 BaseTestServer::SSLOptions::SSLOptions( 106 BaseTestServer::SSLOptions::SSLOptions(
91 BaseTestServer::SSLOptions::ServerCertificate cert) 107 BaseTestServer::SSLOptions::ServerCertificate cert)
92 : server_certificate(cert), 108 : server_certificate(cert),
93 ocsp_status(OCSP_OK), 109 ocsp_status(OCSP_OK),
94 cert_serial(0), 110 cert_serial(0),
95 request_client_certificate(false), 111 request_client_certificate(false),
96 key_exchanges(SSLOptions::KEY_EXCHANGE_ANY), 112 key_exchanges(SSLOptions::KEY_EXCHANGE_ANY),
97 bulk_ciphers(SSLOptions::BULK_CIPHER_ANY), 113 bulk_ciphers(SSLOptions::BULK_CIPHER_ANY),
98 record_resume(false), 114 record_resume(false),
99 tls_intolerant(TLS_INTOLERANT_NONE), 115 tls_intolerant(TLS_INTOLERANT_NONE),
116 tls_intolerance_type(TLS_INTOLERANCE_ALERT),
100 fallback_scsv_enabled(false), 117 fallback_scsv_enabled(false),
101 staple_ocsp_response(false), 118 staple_ocsp_response(false),
102 enable_npn(false) {} 119 enable_npn(false) {}
103 120
104 BaseTestServer::SSLOptions::~SSLOptions() {} 121 BaseTestServer::SSLOptions::~SSLOptions() {}
105 122
106 base::FilePath BaseTestServer::SSLOptions::GetCertificateFile() const { 123 base::FilePath BaseTestServer::SSLOptions::GetCertificateFile() const {
107 switch (server_certificate) { 124 switch (server_certificate) {
108 case CERT_OK: 125 case CERT_OK:
109 case CERT_MISMATCHED_NAME: 126 case CERT_MISMATCHED_NAME:
(...skipping 320 matching lines...) Expand 10 before | Expand all | Expand 10 after
430 // Check bulk cipher argument. 447 // Check bulk cipher argument.
431 scoped_ptr<base::ListValue> bulk_cipher_values(new base::ListValue()); 448 scoped_ptr<base::ListValue> bulk_cipher_values(new base::ListValue());
432 GetCiphersList(ssl_options_.bulk_ciphers, bulk_cipher_values.get()); 449 GetCiphersList(ssl_options_.bulk_ciphers, bulk_cipher_values.get());
433 if (bulk_cipher_values->GetSize()) 450 if (bulk_cipher_values->GetSize())
434 arguments->Set("ssl-bulk-cipher", bulk_cipher_values.release()); 451 arguments->Set("ssl-bulk-cipher", bulk_cipher_values.release());
435 if (ssl_options_.record_resume) 452 if (ssl_options_.record_resume)
436 arguments->Set("https-record-resume", base::Value::CreateNullValue()); 453 arguments->Set("https-record-resume", base::Value::CreateNullValue());
437 if (ssl_options_.tls_intolerant != SSLOptions::TLS_INTOLERANT_NONE) { 454 if (ssl_options_.tls_intolerant != SSLOptions::TLS_INTOLERANT_NONE) {
438 arguments->Set("tls-intolerant", 455 arguments->Set("tls-intolerant",
439 new base::FundamentalValue(ssl_options_.tls_intolerant)); 456 new base::FundamentalValue(ssl_options_.tls_intolerant));
457 arguments->Set("tls-intolerance-type",
458 new base::StringValue(GetTLSIntoleranceType(
459 ssl_options_.tls_intolerance_type)));
440 } 460 }
441 if (ssl_options_.fallback_scsv_enabled) 461 if (ssl_options_.fallback_scsv_enabled)
442 arguments->Set("fallback-scsv", base::Value::CreateNullValue()); 462 arguments->Set("fallback-scsv", base::Value::CreateNullValue());
443 if (!ssl_options_.signed_cert_timestamps_tls_ext.empty()) { 463 if (!ssl_options_.signed_cert_timestamps_tls_ext.empty()) {
444 std::string b64_scts_tls_ext; 464 std::string b64_scts_tls_ext;
445 base::Base64Encode(ssl_options_.signed_cert_timestamps_tls_ext, 465 base::Base64Encode(ssl_options_.signed_cert_timestamps_tls_ext,
446 &b64_scts_tls_ext); 466 &b64_scts_tls_ext);
447 arguments->SetString("signed-cert-timestamps-tls-ext", b64_scts_tls_ext); 467 arguments->SetString("signed-cert-timestamps-tls-ext", b64_scts_tls_ext);
448 } 468 }
449 if (ssl_options_.staple_ocsp_response) 469 if (ssl_options_.staple_ocsp_response)
450 arguments->Set("staple-ocsp-response", base::Value::CreateNullValue()); 470 arguments->Set("staple-ocsp-response", base::Value::CreateNullValue());
451 if (ssl_options_.enable_npn) 471 if (ssl_options_.enable_npn)
452 arguments->Set("enable-npn", base::Value::CreateNullValue()); 472 arguments->Set("enable-npn", base::Value::CreateNullValue());
453 } 473 }
454 474
455 return GenerateAdditionalArguments(arguments); 475 return GenerateAdditionalArguments(arguments);
456 } 476 }
457 477
458 bool BaseTestServer::GenerateAdditionalArguments( 478 bool BaseTestServer::GenerateAdditionalArguments(
459 base::DictionaryValue* arguments) const { 479 base::DictionaryValue* arguments) const {
460 return true; 480 return true;
461 } 481 }
462 482
463 } // namespace net 483 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698