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

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

Issue 1066613002: Revert of Don't process HSTS/HPKP headers when host is an IP address (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 8 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
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 11 matching lines...) Expand all
22 #include "net/dns/host_resolver.h" 22 #include "net/dns/host_resolver.h"
23 #include "net/log/net_log.h" 23 #include "net/log/net_log.h"
24 #include "url/gurl.h" 24 #include "url/gurl.h"
25 25
26 namespace net { 26 namespace net {
27 27
28 namespace { 28 namespace {
29 29
30 std::string GetHostname(BaseTestServer::Type type, 30 std::string GetHostname(BaseTestServer::Type type,
31 const BaseTestServer::SSLOptions& options) { 31 const BaseTestServer::SSLOptions& options) {
32 if (BaseTestServer::UsingSSL(type)) { 32 if (BaseTestServer::UsingSSL(type) &&
33 if (options.server_certificate == 33 options.server_certificate ==
34 BaseTestServer::SSLOptions::CERT_MISMATCHED_NAME || 34 BaseTestServer::SSLOptions::CERT_MISMATCHED_NAME) {
35 options.server_certificate == 35 // Return a different hostname string that resolves to the same hostname.
36 BaseTestServer::SSLOptions::CERT_OK_FOR_LOCALHOST) { 36 return "localhost";
37 // For |CERT_MISMATCHED_NAME|, return a different hostname string
38 // that resolves to the same hostname. For
39 // |CERT_OK_FOR_LOCALHOST|, the certificate is issued for
40 // "localhost" instead of "127.0.0.1".
41 return "localhost";
42 }
43 } 37 }
44 38
45 // Use the 127.0.0.1 as default. 39 // Use the 127.0.0.1 as default.
46 return BaseTestServer::kLocalhost; 40 return BaseTestServer::kLocalhost;
47 } 41 }
48 42
49 std::string GetClientCertType(SSLClientCertType type) { 43 std::string GetClientCertType(SSLClientCertType type) {
50 switch (type) { 44 switch (type) {
51 case CLIENT_CERT_RSA_SIGN: 45 case CLIENT_CERT_RSA_SIGN:
52 return "rsa_sign"; 46 return "rsa_sign";
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
132 alert_after_handshake(false) { 126 alert_after_handshake(false) {
133 } 127 }
134 128
135 BaseTestServer::SSLOptions::~SSLOptions() {} 129 BaseTestServer::SSLOptions::~SSLOptions() {}
136 130
137 base::FilePath BaseTestServer::SSLOptions::GetCertificateFile() const { 131 base::FilePath BaseTestServer::SSLOptions::GetCertificateFile() const {
138 switch (server_certificate) { 132 switch (server_certificate) {
139 case CERT_OK: 133 case CERT_OK:
140 case CERT_MISMATCHED_NAME: 134 case CERT_MISMATCHED_NAME:
141 return base::FilePath(FILE_PATH_LITERAL("ok_cert.pem")); 135 return base::FilePath(FILE_PATH_LITERAL("ok_cert.pem"));
142 case CERT_OK_FOR_LOCALHOST:
143 return base::FilePath(FILE_PATH_LITERAL("localhost_cert.pem"));
144 case CERT_EXPIRED: 136 case CERT_EXPIRED:
145 return base::FilePath(FILE_PATH_LITERAL("expired_cert.pem")); 137 return base::FilePath(FILE_PATH_LITERAL("expired_cert.pem"));
146 case CERT_CHAIN_WRONG_ROOT: 138 case CERT_CHAIN_WRONG_ROOT:
147 // This chain uses its own dedicated test root certificate to avoid 139 // This chain uses its own dedicated test root certificate to avoid
148 // side-effects that may affect testing. 140 // side-effects that may affect testing.
149 return base::FilePath(FILE_PATH_LITERAL("redundant-server-chain.pem")); 141 return base::FilePath(FILE_PATH_LITERAL("redundant-server-chain.pem"));
150 case CERT_AUTO: 142 case CERT_AUTO:
151 return base::FilePath(); 143 return base::FilePath();
152 default: 144 default:
153 NOTREACHED(); 145 NOTREACHED();
(...skipping 346 matching lines...) Expand 10 before | Expand all | Expand 10 after
500 492
501 return GenerateAdditionalArguments(arguments); 493 return GenerateAdditionalArguments(arguments);
502 } 494 }
503 495
504 bool BaseTestServer::GenerateAdditionalArguments( 496 bool BaseTestServer::GenerateAdditionalArguments(
505 base::DictionaryValue* arguments) const { 497 base::DictionaryValue* arguments) const {
506 return true; 498 return true;
507 } 499 }
508 500
509 } // namespace net 501 } // namespace net
OLDNEW
« no previous file with comments | « net/test/spawned_test_server/base_test_server.h ('k') | net/url_request/url_request_http_job.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698