OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 // ClientSocketPoolManager manages access to all ClientSocketPools. It's a | 5 // ClientSocketPoolManager manages access to all ClientSocketPools. It's a |
6 // simple container for all of them. Most importantly, it handles the lifetime | 6 // simple container for all of them. Most importantly, it handles the lifetime |
7 // and destruction order properly. | 7 // and destruction order properly. |
8 | 8 |
9 #include "net/socket/client_socket_pool_manager.h" | 9 #include "net/socket/client_socket_pool_manager.h" |
10 | 10 |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
71 bool force_tunnel, | 71 bool force_tunnel, |
72 const BoundNetLog& net_log, | 72 const BoundNetLog& net_log, |
73 int num_preconnect_streams, | 73 int num_preconnect_streams, |
74 ClientSocketHandle* socket_handle, | 74 ClientSocketHandle* socket_handle, |
75 OldCompletionCallback* callback) { | 75 OldCompletionCallback* callback) { |
76 scoped_refptr<TransportSocketParams> tcp_params; | 76 scoped_refptr<TransportSocketParams> tcp_params; |
77 scoped_refptr<HttpProxySocketParams> http_proxy_params; | 77 scoped_refptr<HttpProxySocketParams> http_proxy_params; |
78 scoped_refptr<SOCKSSocketParams> socks_params; | 78 scoped_refptr<SOCKSSocketParams> socks_params; |
79 scoped_ptr<HostPortPair> proxy_host_port; | 79 scoped_ptr<HostPortPair> proxy_host_port; |
80 | 80 |
81 GURL request_referrer; | |
82 std::string request_referrer_str; | |
83 if (request_extra_headers.GetHeader(HttpRequestHeaders::kReferer, | |
84 &request_referrer_str)) { | |
85 request_referrer = GURL(request_referrer_str); | |
86 } | |
87 | |
88 bool using_ssl = request_url.SchemeIs("https") || force_spdy_over_ssl; | 81 bool using_ssl = request_url.SchemeIs("https") || force_spdy_over_ssl; |
89 | 82 |
90 HostPortPair origin_host_port = | 83 HostPortPair origin_host_port = |
91 HostPortPair(request_url.HostNoBrackets(), | 84 HostPortPair(request_url.HostNoBrackets(), |
92 request_url.EffectiveIntPort()); | 85 request_url.EffectiveIntPort()); |
93 | 86 |
94 bool disable_resolver_cache = | 87 bool disable_resolver_cache = |
95 request_load_flags & LOAD_BYPASS_CACHE || | 88 request_load_flags & LOAD_BYPASS_CACHE || |
96 request_load_flags & LOAD_VALIDATE_CACHE || | 89 request_load_flags & LOAD_VALIDATE_CACHE || |
97 request_load_flags & LOAD_DISABLE_CACHE; | 90 request_load_flags & LOAD_DISABLE_CACHE; |
(...skipping 13 matching lines...) Expand all Loading... |
111 } else { | 104 } else { |
112 prefix = "sslv3/"; | 105 prefix = "sslv3/"; |
113 } | 106 } |
114 connection_group = prefix + connection_group; | 107 connection_group = prefix + connection_group; |
115 } | 108 } |
116 | 109 |
117 bool ignore_limits = (request_load_flags & LOAD_IGNORE_LIMITS) != 0; | 110 bool ignore_limits = (request_load_flags & LOAD_IGNORE_LIMITS) != 0; |
118 if (proxy_info.is_direct()) { | 111 if (proxy_info.is_direct()) { |
119 tcp_params = new TransportSocketParams(origin_host_port, | 112 tcp_params = new TransportSocketParams(origin_host_port, |
120 request_priority, | 113 request_priority, |
121 request_referrer, | |
122 disable_resolver_cache, | 114 disable_resolver_cache, |
123 ignore_limits); | 115 ignore_limits); |
124 } else { | 116 } else { |
125 ProxyServer proxy_server = proxy_info.proxy_server(); | 117 ProxyServer proxy_server = proxy_info.proxy_server(); |
126 proxy_host_port.reset(new HostPortPair(proxy_server.host_port_pair())); | 118 proxy_host_port.reset(new HostPortPair(proxy_server.host_port_pair())); |
127 scoped_refptr<TransportSocketParams> proxy_tcp_params( | 119 scoped_refptr<TransportSocketParams> proxy_tcp_params( |
128 new TransportSocketParams(*proxy_host_port, | 120 new TransportSocketParams(*proxy_host_port, |
129 request_priority, | 121 request_priority, |
130 request_referrer, | |
131 disable_resolver_cache, | 122 disable_resolver_cache, |
132 ignore_limits)); | 123 ignore_limits)); |
133 | 124 |
134 if (proxy_info.is_http() || proxy_info.is_https()) { | 125 if (proxy_info.is_http() || proxy_info.is_https()) { |
135 std::string user_agent; | 126 std::string user_agent; |
136 request_extra_headers.GetHeader(HttpRequestHeaders::kUserAgent, | 127 request_extra_headers.GetHeader(HttpRequestHeaders::kUserAgent, |
137 &user_agent); | 128 &user_agent); |
138 scoped_refptr<SSLSocketParams> ssl_params; | 129 scoped_refptr<SSLSocketParams> ssl_params; |
139 if (proxy_info.is_https()) { | 130 if (proxy_info.is_https()) { |
140 // Set ssl_params, and unset proxy_tcp_params | 131 // Set ssl_params, and unset proxy_tcp_params |
(...skipping 25 matching lines...) Expand all Loading... |
166 if (proxy_server.scheme() == ProxyServer::SCHEME_SOCKS5) | 157 if (proxy_server.scheme() == ProxyServer::SCHEME_SOCKS5) |
167 socks_version = '5'; | 158 socks_version = '5'; |
168 else | 159 else |
169 socks_version = '4'; | 160 socks_version = '4'; |
170 connection_group = base::StringPrintf( | 161 connection_group = base::StringPrintf( |
171 "socks%c/%s", socks_version, connection_group.c_str()); | 162 "socks%c/%s", socks_version, connection_group.c_str()); |
172 | 163 |
173 socks_params = new SOCKSSocketParams(proxy_tcp_params, | 164 socks_params = new SOCKSSocketParams(proxy_tcp_params, |
174 socks_version == '5', | 165 socks_version == '5', |
175 origin_host_port, | 166 origin_host_port, |
176 request_priority, | 167 request_priority); |
177 request_referrer); | |
178 } | 168 } |
179 } | 169 } |
180 | 170 |
181 // Deal with SSL - which layers on top of any given proxy. | 171 // Deal with SSL - which layers on top of any given proxy. |
182 if (using_ssl) { | 172 if (using_ssl) { |
183 scoped_refptr<SSLSocketParams> ssl_params = | 173 scoped_refptr<SSLSocketParams> ssl_params = |
184 new SSLSocketParams(tcp_params, | 174 new SSLSocketParams(tcp_params, |
185 socks_params, | 175 socks_params, |
186 http_proxy_params, | 176 http_proxy_params, |
187 proxy_info.proxy_server().scheme(), | 177 proxy_info.proxy_server().scheme(), |
(...skipping 534 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
722 ssl_config_for_proxy, | 712 ssl_config_for_proxy, |
723 false, | 713 false, |
724 net_log, | 714 net_log, |
725 num_preconnect_streams, | 715 num_preconnect_streams, |
726 NULL, | 716 NULL, |
727 NULL); | 717 NULL); |
728 } | 718 } |
729 | 719 |
730 | 720 |
731 } // namespace net | 721 } // namespace net |
OLD | NEW |