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

Side by Side Diff: net/tools/fetch/fetch_client.cc

Issue 16501002: Give more request types a TransportSecurityState. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Enforce CalledOnValidThread in all non-static methods. Created 7 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
« no previous file with comments | « net/spdy/spdy_test_util_common.cc ('k') | net/url_request/url_request_test_util.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 #include "build/build_config.h" 5 #include "build/build_config.h"
6 6
7 #include "base/at_exit.h" 7 #include "base/at_exit.h"
8 #include "base/bind.h" 8 #include "base/bind.h"
9 #include "base/bind_helpers.h" 9 #include "base/bind_helpers.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
11 #include "base/lazy_instance.h" 11 #include "base/lazy_instance.h"
12 #include "base/message_loop.h" 12 #include "base/message_loop.h"
13 #include "base/metrics/stats_counters.h" 13 #include "base/metrics/stats_counters.h"
14 #include "base/strings/string_number_conversions.h" 14 #include "base/strings/string_number_conversions.h"
15 #include "base/strings/string_util.h" 15 #include "base/strings/string_util.h"
16 #include "net/base/completion_callback.h" 16 #include "net/base/completion_callback.h"
17 #include "net/base/io_buffer.h" 17 #include "net/base/io_buffer.h"
18 #include "net/base/net_errors.h" 18 #include "net/base/net_errors.h"
19 #include "net/base/request_priority.h" 19 #include "net/base/request_priority.h"
20 #include "net/cert/cert_verifier.h" 20 #include "net/cert/cert_verifier.h"
21 #include "net/dns/host_resolver.h" 21 #include "net/dns/host_resolver.h"
22 #include "net/http/http_auth_handler_factory.h" 22 #include "net/http/http_auth_handler_factory.h"
23 #include "net/http/http_cache.h" 23 #include "net/http/http_cache.h"
24 #include "net/http/http_network_layer.h" 24 #include "net/http/http_network_layer.h"
25 #include "net/http/http_network_session.h" 25 #include "net/http/http_network_session.h"
26 #include "net/http/http_request_info.h" 26 #include "net/http/http_request_info.h"
27 #include "net/http/http_server_properties_impl.h" 27 #include "net/http/http_server_properties_impl.h"
28 #include "net/http/http_transaction.h" 28 #include "net/http/http_transaction.h"
29 #include "net/http/transport_security_state.h"
29 #include "net/proxy/proxy_service.h" 30 #include "net/proxy/proxy_service.h"
30 #include "net/ssl/ssl_config_service_defaults.h" 31 #include "net/ssl/ssl_config_service_defaults.h"
31 32
32 void usage(const char* program_name) { 33 void usage(const char* program_name) {
33 printf("usage: %s --url=<url> [--n=<clients>] [--stats] [--use_cache]\n", 34 printf("usage: %s --url=<url> [--n=<clients>] [--stats] [--use_cache]\n",
34 program_name); 35 program_name);
35 exit(1); 36 exit(1);
36 } 37 }
37 38
38 // Test Driver 39 // Test Driver
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
139 } 140 }
140 bool use_cache = parsed_command_line.HasSwitch("use-cache"); 141 bool use_cache = parsed_command_line.HasSwitch("use-cache");
141 142
142 // Do work here. 143 // Do work here.
143 base::MessageLoop loop(base::MessageLoop::TYPE_IO); 144 base::MessageLoop loop(base::MessageLoop::TYPE_IO);
144 145
145 scoped_ptr<net::HostResolver> host_resolver( 146 scoped_ptr<net::HostResolver> host_resolver(
146 net::HostResolver::CreateDefaultResolver(NULL)); 147 net::HostResolver::CreateDefaultResolver(NULL));
147 scoped_ptr<net::CertVerifier> cert_verifier( 148 scoped_ptr<net::CertVerifier> cert_verifier(
148 net::CertVerifier::CreateDefault()); 149 net::CertVerifier::CreateDefault());
150 scoped_ptr<net::TransportSecurityState> transport_security_state(
151 new net::TransportSecurityState);
149 scoped_ptr<net::ProxyService> proxy_service( 152 scoped_ptr<net::ProxyService> proxy_service(
150 net::ProxyService::CreateDirect()); 153 net::ProxyService::CreateDirect());
151 scoped_refptr<net::SSLConfigService> ssl_config_service( 154 scoped_refptr<net::SSLConfigService> ssl_config_service(
152 new net::SSLConfigServiceDefaults); 155 new net::SSLConfigServiceDefaults);
153 net::HttpTransactionFactory* factory = NULL; 156 net::HttpTransactionFactory* factory = NULL;
154 scoped_ptr<net::HttpAuthHandlerFactory> http_auth_handler_factory( 157 scoped_ptr<net::HttpAuthHandlerFactory> http_auth_handler_factory(
155 net::HttpAuthHandlerFactory::CreateDefault(host_resolver.get())); 158 net::HttpAuthHandlerFactory::CreateDefault(host_resolver.get()));
156 net::HttpServerPropertiesImpl http_server_properties; 159 net::HttpServerPropertiesImpl http_server_properties;
157 160
158 net::HttpNetworkSession::Params session_params; 161 net::HttpNetworkSession::Params session_params;
159 session_params.host_resolver = host_resolver.get(); 162 session_params.host_resolver = host_resolver.get();
160 session_params.cert_verifier = cert_verifier.get(); 163 session_params.cert_verifier = cert_verifier.get();
164 session_params.transport_security_state = transport_security_state.get();
161 session_params.proxy_service = proxy_service.get(); 165 session_params.proxy_service = proxy_service.get();
162 session_params.http_auth_handler_factory = http_auth_handler_factory.get(); 166 session_params.http_auth_handler_factory = http_auth_handler_factory.get();
163 session_params.http_server_properties = &http_server_properties; 167 session_params.http_server_properties = &http_server_properties;
164 session_params.ssl_config_service = ssl_config_service.get(); 168 session_params.ssl_config_service = ssl_config_service.get();
165 169
166 scoped_refptr<net::HttpNetworkSession> network_session( 170 scoped_refptr<net::HttpNetworkSession> network_session(
167 new net::HttpNetworkSession(session_params)); 171 new net::HttpNetworkSession(session_params));
168 if (use_cache) { 172 if (use_cache) {
169 factory = new net::HttpCache(network_session.get(), 173 factory = new net::HttpCache(network_session.get(),
170 net::HttpCache::DefaultBackend::InMemory(0)); 174 net::HttpCache::DefaultBackend::InMemory(0));
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
215 std::string name(table.GetRowName(index)); 219 std::string name(table.GetRowName(index));
216 if (name.length() > 0) { 220 if (name.length() > 0) {
217 int value = table.GetRowValue(index); 221 int value = table.GetRowValue(index);
218 printf("%s:\t%d\n", name.c_str(), value); 222 printf("%s:\t%d\n", name.c_str(), value);
219 } 223 }
220 } 224 }
221 printf("</stats>\n"); 225 printf("</stats>\n");
222 } 226 }
223 return 0; 227 return 0;
224 } 228 }
OLDNEW
« no previous file with comments | « net/spdy/spdy_test_util_common.cc ('k') | net/url_request/url_request_test_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698