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 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
201 case OCSP_UNAUTHORIZED: | 201 case OCSP_UNAUTHORIZED: |
202 return "unauthorized"; | 202 return "unauthorized"; |
203 case OCSP_UNKNOWN: | 203 case OCSP_UNKNOWN: |
204 return "unknown"; | 204 return "unknown"; |
205 default: | 205 default: |
206 NOTREACHED(); | 206 NOTREACHED(); |
207 return std::string(); | 207 return std::string(); |
208 } | 208 } |
209 } | 209 } |
210 | 210 |
| 211 std::string BaseTestServer::SSLOptions::GetOCSPDateArgument() const { |
| 212 if (server_certificate != CERT_AUTO) |
| 213 return std::string(); |
| 214 |
| 215 switch (ocsp_date) { |
| 216 case OCSP_VALID: |
| 217 return "valid"; |
| 218 case OCSP_OLD: |
| 219 return "old"; |
| 220 case OCSP_YOUNG: |
| 221 return "young"; |
| 222 case OCSP_LONG: |
| 223 return "long"; |
| 224 default: |
| 225 NOTREACHED(); |
| 226 return std::string(); |
| 227 } |
| 228 } |
| 229 |
211 const char BaseTestServer::kLocalhost[] = "127.0.0.1"; | 230 const char BaseTestServer::kLocalhost[] = "127.0.0.1"; |
212 | 231 |
213 BaseTestServer::BaseTestServer(Type type, const std::string& host) | 232 BaseTestServer::BaseTestServer(Type type, const std::string& host) |
214 : type_(type), | 233 : type_(type), |
215 started_(false), | 234 started_(false), |
216 log_to_console_(false), | 235 log_to_console_(false), |
217 ws_basic_auth_(false), | 236 ws_basic_auth_(false), |
218 no_anonymous_ftp_user_(false) { | 237 no_anonymous_ftp_user_(false) { |
219 Init(host); | 238 Init(host); |
220 } | 239 } |
(...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
517 arguments->Set("ssl-client-cert-type", client_cert_types.release()); | 536 arguments->Set("ssl-client-cert-type", client_cert_types.release()); |
518 } | 537 } |
519 | 538 |
520 if (type_ == TYPE_HTTPS) { | 539 if (type_ == TYPE_HTTPS) { |
521 arguments->Set("https", base::Value::CreateNullValue()); | 540 arguments->Set("https", base::Value::CreateNullValue()); |
522 | 541 |
523 std::string ocsp_arg = ssl_options_.GetOCSPArgument(); | 542 std::string ocsp_arg = ssl_options_.GetOCSPArgument(); |
524 if (!ocsp_arg.empty()) | 543 if (!ocsp_arg.empty()) |
525 arguments->SetString("ocsp", ocsp_arg); | 544 arguments->SetString("ocsp", ocsp_arg); |
526 | 545 |
| 546 std::string ocsp_date_arg = ssl_options_.GetOCSPDateArgument(); |
| 547 if (!ocsp_date_arg.empty()) |
| 548 arguments->SetString("ocsp-date", ocsp_date_arg); |
| 549 |
527 if (ssl_options_.cert_serial != 0) { | 550 if (ssl_options_.cert_serial != 0) { |
528 arguments->SetInteger("cert-serial", ssl_options_.cert_serial); | 551 arguments->SetInteger("cert-serial", ssl_options_.cert_serial); |
529 } | 552 } |
530 | 553 |
531 // Check key exchange argument. | 554 // Check key exchange argument. |
532 std::unique_ptr<base::ListValue> key_exchange_values(new base::ListValue()); | 555 std::unique_ptr<base::ListValue> key_exchange_values(new base::ListValue()); |
533 GetKeyExchangesList(ssl_options_.key_exchanges, key_exchange_values.get()); | 556 GetKeyExchangesList(ssl_options_.key_exchanges, key_exchange_values.get()); |
534 if (key_exchange_values->GetSize()) | 557 if (key_exchange_values->GetSize()) |
535 arguments->Set("ssl-key-exchange", key_exchange_values.release()); | 558 arguments->Set("ssl-key-exchange", key_exchange_values.release()); |
536 // Check bulk cipher argument. | 559 // Check bulk cipher argument. |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
586 | 609 |
587 return GenerateAdditionalArguments(arguments); | 610 return GenerateAdditionalArguments(arguments); |
588 } | 611 } |
589 | 612 |
590 bool BaseTestServer::GenerateAdditionalArguments( | 613 bool BaseTestServer::GenerateAdditionalArguments( |
591 base::DictionaryValue* arguments) const { | 614 base::DictionaryValue* arguments) const { |
592 return true; | 615 return true; |
593 } | 616 } |
594 | 617 |
595 } // namespace net | 618 } // namespace net |
OLD | NEW |