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 #ifndef NET_TEST_TEST_SERVER_H_ | 5 #ifndef NET_TEST_TEST_SERVER_H_ |
6 #define NET_TEST_TEST_SERVER_H_ | 6 #define NET_TEST_TEST_SERVER_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 #include <utility> | 10 #include <utility> |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
55 struct HTTPSOptions { | 55 struct HTTPSOptions { |
56 enum ServerCertificate { | 56 enum ServerCertificate { |
57 CERT_OK, | 57 CERT_OK, |
58 CERT_MISMATCHED_NAME, | 58 CERT_MISMATCHED_NAME, |
59 CERT_EXPIRED, | 59 CERT_EXPIRED, |
60 // Cross-signed certificate to test PKIX path building. Contains an | 60 // Cross-signed certificate to test PKIX path building. Contains an |
61 // intermediate cross-signed by an unknown root, while the client (via | 61 // intermediate cross-signed by an unknown root, while the client (via |
62 // TestRootStore) is expected to have a self-signed version of the | 62 // TestRootStore) is expected to have a self-signed version of the |
63 // intermediate. | 63 // intermediate. |
64 CERT_CHAIN_WRONG_ROOT, | 64 CERT_CHAIN_WRONG_ROOT, |
| 65 // OCSP_* causes TestServer to run both an HTTPS and HTTP server. The |
| 66 // HTTP server answers OCSP queries for the HTTPS certificate, which is |
| 67 // generated on the fly. |
| 68 OCSP_OK, |
| 69 OCSP_REVOKED, |
| 70 OCSP_INVALID, |
65 }; | 71 }; |
66 | 72 |
67 // Bitmask of bulk encryption algorithms that the test server supports | 73 // Bitmask of bulk encryption algorithms that the test server supports |
68 // and that can be selectively enabled or disabled. | 74 // and that can be selectively enabled or disabled. |
69 enum BulkCipher { | 75 enum BulkCipher { |
70 // Special value used to indicate that any algorithm the server supports | 76 // Special value used to indicate that any algorithm the server supports |
71 // is acceptable. Preferred over explicitly OR-ing all ciphers. | 77 // is acceptable. Preferred over explicitly OR-ing all ciphers. |
72 BULK_CIPHER_ANY = 0, | 78 BULK_CIPHER_ANY = 0, |
73 | 79 |
74 BULK_CIPHER_RC4 = (1 << 0), | 80 BULK_CIPHER_RC4 = (1 << 0), |
(...skipping 10 matching lines...) Expand all Loading... |
85 HTTPSOptions(); | 91 HTTPSOptions(); |
86 | 92 |
87 // Initialize a new HTTPSOptions that will use the specified certificate. | 93 // Initialize a new HTTPSOptions that will use the specified certificate. |
88 explicit HTTPSOptions(ServerCertificate cert); | 94 explicit HTTPSOptions(ServerCertificate cert); |
89 ~HTTPSOptions(); | 95 ~HTTPSOptions(); |
90 | 96 |
91 // Returns the relative filename of the file that contains the | 97 // Returns the relative filename of the file that contains the |
92 // |server_certificate|. | 98 // |server_certificate|. |
93 FilePath GetCertificateFile() const; | 99 FilePath GetCertificateFile() const; |
94 | 100 |
| 101 // If the certificate is a magic string, rather than a file on disk, this |
| 102 // returns the string to use. Otherwise it returns an empty string. |
| 103 std::string GetSpecialCertificateString() const; |
| 104 |
95 // The certificate to use when serving requests. | 105 // The certificate to use when serving requests. |
96 ServerCertificate server_certificate; | 106 ServerCertificate server_certificate; |
97 | 107 |
98 // True if a CertificateRequest should be sent to the client during | 108 // True if a CertificateRequest should be sent to the client during |
99 // handshaking. | 109 // handshaking. |
100 bool request_client_certificate; | 110 bool request_client_certificate; |
101 | 111 |
102 // If |request_client_certificate| is true, an optional list of files, | 112 // If |request_client_certificate| is true, an optional list of files, |
103 // each containing a single, PEM-encoded X.509 certificates. The subject | 113 // each containing a single, PEM-encoded X.509 certificates. The subject |
104 // from each certificate will be added to the certificate_authorities | 114 // from each certificate will be added to the certificate_authorities |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
226 | 236 |
227 // Enables logging of the server to the console. | 237 // Enables logging of the server to the console. |
228 bool log_to_console_; | 238 bool log_to_console_; |
229 | 239 |
230 DISALLOW_COPY_AND_ASSIGN(TestServer); | 240 DISALLOW_COPY_AND_ASSIGN(TestServer); |
231 }; | 241 }; |
232 | 242 |
233 } // namespace net | 243 } // namespace net |
234 | 244 |
235 #endif // NET_TEST_TEST_SERVER_H_ | 245 #endif // NET_TEST_TEST_SERVER_H_ |
OLD | NEW |