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 #include "jingle/glue/proxy_resolving_client_socket.h" | 5 #include "jingle/glue/proxy_resolving_client_socket.h" |
6 | 6 |
7 #include <stdint.h> | 7 #include <stdint.h> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
132 | 132 |
133 int ProxyResolvingClientSocket::Connect( | 133 int ProxyResolvingClientSocket::Connect( |
134 const net::CompletionCallback& callback) { | 134 const net::CompletionCallback& callback) { |
135 DCHECK(user_connect_callback_.is_null()); | 135 DCHECK(user_connect_callback_.is_null()); |
136 | 136 |
137 tried_direct_connect_fallback_ = false; | 137 tried_direct_connect_fallback_ = false; |
138 | 138 |
139 // First we try and resolve the proxy. | 139 // First we try and resolve the proxy. |
140 int status = network_session_->proxy_service()->ResolveProxy( | 140 int status = network_session_->proxy_service()->ResolveProxy( |
141 proxy_url_, | 141 proxy_url_, |
142 std::string(), | |
bengr
2016/02/26 23:43:33
#include <string>
| |
142 net::LOAD_NORMAL, | 143 net::LOAD_NORMAL, |
143 &proxy_info_, | 144 &proxy_info_, |
144 proxy_resolve_callback_, | 145 proxy_resolve_callback_, |
145 &pac_request_, | 146 &pac_request_, |
146 NULL, | 147 NULL, |
147 bound_net_log_); | 148 bound_net_log_); |
148 if (status != net::ERR_IO_PENDING) { | 149 if (status != net::ERR_IO_PENDING) { |
149 // We defer execution of ProcessProxyResolveDone instead of calling it | 150 // We defer execution of ProcessProxyResolveDone instead of calling it |
150 // directly here for simplicity. From the caller's point of view, | 151 // directly here for simplicity. From the caller's point of view, |
151 // the connect always happens asynchronously. | 152 // the connect always happens asynchronously. |
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
283 default: | 284 default: |
284 return error; | 285 return error; |
285 } | 286 } |
286 | 287 |
287 if (proxy_info_.is_https() && ssl_config_.send_client_cert) { | 288 if (proxy_info_.is_https() && ssl_config_.send_client_cert) { |
288 network_session_->ssl_client_auth_cache()->Remove( | 289 network_session_->ssl_client_auth_cache()->Remove( |
289 proxy_info_.proxy_server().host_port_pair()); | 290 proxy_info_.proxy_server().host_port_pair()); |
290 } | 291 } |
291 | 292 |
292 int rv = network_session_->proxy_service()->ReconsiderProxyAfterError( | 293 int rv = network_session_->proxy_service()->ReconsiderProxyAfterError( |
293 proxy_url_, net::LOAD_NORMAL, error, &proxy_info_, | 294 proxy_url_, std::string(), net::LOAD_NORMAL, error, &proxy_info_, |
294 proxy_resolve_callback_, &pac_request_, NULL, bound_net_log_); | 295 proxy_resolve_callback_, &pac_request_, NULL, bound_net_log_); |
295 if (rv == net::OK || rv == net::ERR_IO_PENDING) { | 296 if (rv == net::OK || rv == net::ERR_IO_PENDING) { |
296 CloseTransportSocket(); | 297 CloseTransportSocket(); |
297 } else { | 298 } else { |
298 // If ReconsiderProxyAfterError() failed synchronously, it means | 299 // If ReconsiderProxyAfterError() failed synchronously, it means |
299 // there was nothing left to fall-back to, so fail the transaction | 300 // there was nothing left to fall-back to, so fail the transaction |
300 // with the last connection error we got. | 301 // with the last connection error we got. |
301 rv = error; | 302 rv = error; |
302 } | 303 } |
303 | 304 |
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
431 return 0; | 432 return 0; |
432 } | 433 } |
433 | 434 |
434 void ProxyResolvingClientSocket::CloseTransportSocket() { | 435 void ProxyResolvingClientSocket::CloseTransportSocket() { |
435 if (transport_.get() && transport_->socket()) | 436 if (transport_.get() && transport_->socket()) |
436 transport_->socket()->Disconnect(); | 437 transport_->socket()->Disconnect(); |
437 transport_.reset(); | 438 transport_.reset(); |
438 } | 439 } |
439 | 440 |
440 } // namespace jingle_glue | 441 } // namespace jingle_glue |
OLD | NEW |