| 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 "base/basictypes.h" | 7 #include "base/basictypes.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/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
| 11 #include "base/logging.h" | 11 #include "base/logging.h" |
| 12 #include "net/base/io_buffer.h" | 12 #include "net/base/io_buffer.h" |
| 13 #include "net/base/load_flags.h" | 13 #include "net/base/load_flags.h" |
| 14 #include "net/base/net_errors.h" | 14 #include "net/base/net_errors.h" |
| 15 #include "net/http/http_auth_controller.h" |
| 15 #include "net/http/http_network_session.h" | 16 #include "net/http/http_network_session.h" |
| 17 #include "net/http/proxy_client_socket.h" |
| 16 #include "net/socket/client_socket_handle.h" | 18 #include "net/socket/client_socket_handle.h" |
| 17 #include "net/socket/client_socket_pool_manager.h" | 19 #include "net/socket/client_socket_pool_manager.h" |
| 18 #include "net/url_request/url_request_context.h" | 20 #include "net/url_request/url_request_context.h" |
| 19 #include "net/url_request/url_request_context_getter.h" | 21 #include "net/url_request/url_request_context_getter.h" |
| 20 | 22 |
| 21 namespace jingle_glue { | 23 namespace jingle_glue { |
| 22 | 24 |
| 23 ProxyResolvingClientSocket::ProxyResolvingClientSocket( | 25 ProxyResolvingClientSocket::ProxyResolvingClientSocket( |
| 24 net::ClientSocketFactory* socket_factory, | 26 net::ClientSocketFactory* socket_factory, |
| 25 const scoped_refptr<net::URLRequestContextGetter>& request_context_getter, | 27 const scoped_refptr<net::URLRequestContextGetter>& request_context_getter, |
| (...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 263 case net::ERR_SOCKS_CONNECTION_HOST_UNREACHABLE: | 265 case net::ERR_SOCKS_CONNECTION_HOST_UNREACHABLE: |
| 264 // Remap the SOCKS-specific "host unreachable" error to a more | 266 // Remap the SOCKS-specific "host unreachable" error to a more |
| 265 // generic error code (this way consumers like the link doctor | 267 // generic error code (this way consumers like the link doctor |
| 266 // know to substitute their error page). | 268 // know to substitute their error page). |
| 267 // | 269 // |
| 268 // Note that if the host resolving was done by the SOCSK5 proxy, we can't | 270 // Note that if the host resolving was done by the SOCSK5 proxy, we can't |
| 269 // differentiate between a proxy-side "host not found" versus a proxy-side | 271 // differentiate between a proxy-side "host not found" versus a proxy-side |
| 270 // "address unreachable" error, and will report both of these failures as | 272 // "address unreachable" error, and will report both of these failures as |
| 271 // ERR_ADDRESS_UNREACHABLE. | 273 // ERR_ADDRESS_UNREACHABLE. |
| 272 return net::ERR_ADDRESS_UNREACHABLE; | 274 return net::ERR_ADDRESS_UNREACHABLE; |
| 275 case net::ERR_PROXY_AUTH_REQUESTED: { |
| 276 net::ProxyClientSocket* proxy_socket = |
| 277 static_cast<net::ProxyClientSocket*>(transport_->socket()); |
| 278 |
| 279 if (proxy_socket->GetAuthController()->HaveAuth()) |
| 280 return proxy_socket->RestartWithAuth(connect_callback_); |
| 281 |
| 282 return error; |
| 283 } |
| 273 default: | 284 default: |
| 274 return error; | 285 return error; |
| 275 } | 286 } |
| 276 | 287 |
| 277 if (proxy_info_.is_https() && ssl_config_.send_client_cert) { | 288 if (proxy_info_.is_https() && ssl_config_.send_client_cert) { |
| 278 network_session_->ssl_client_auth_cache()->Remove( | 289 network_session_->ssl_client_auth_cache()->Remove( |
| 279 proxy_info_.proxy_server().host_port_pair()); | 290 proxy_info_.proxy_server().host_port_pair()); |
| 280 } | 291 } |
| 281 | 292 |
| 282 int rv = network_session_->proxy_service()->ReconsiderProxyAfterError( | 293 int rv = network_session_->proxy_service()->ReconsiderProxyAfterError( |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 399 return false; | 410 return false; |
| 400 } | 411 } |
| 401 | 412 |
| 402 void ProxyResolvingClientSocket::CloseTransportSocket() { | 413 void ProxyResolvingClientSocket::CloseTransportSocket() { |
| 403 if (transport_.get() && transport_->socket()) | 414 if (transport_.get() && transport_->socket()) |
| 404 transport_->socket()->Disconnect(); | 415 transport_->socket()->Disconnect(); |
| 405 transport_.reset(); | 416 transport_.reset(); |
| 406 } | 417 } |
| 407 | 418 |
| 408 } // namespace jingle_glue | 419 } // namespace jingle_glue |
| OLD | NEW |