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

Side by Side Diff: net/socket/ssl_client_socket_pool.cc

Issue 3039028: Make HttpAuthController not reference counted. (Closed)
Patch Set: Created 10 years, 4 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
« no previous file with comments | « net/socket/socket_test_util.cc ('k') | net/socket/ssl_client_socket_pool_unittest.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) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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/socket/ssl_client_socket_pool.h" 5 #include "net/socket/ssl_client_socket_pool.h"
6 6
7 #include "net/base/net_errors.h" 7 #include "net/base/net_errors.h"
8 #include "net/socket/client_socket_factory.h" 8 #include "net/socket/client_socket_factory.h"
9 #include "net/socket/client_socket_handle.h" 9 #include "net/socket/client_socket_handle.h"
10 10
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after
221 http_proxy_pool_, net_log()); 221 http_proxy_pool_, net_log());
222 } 222 }
223 223
224 int SSLConnectJob::DoTunnelConnectComplete(int result) { 224 int SSLConnectJob::DoTunnelConnectComplete(int result) {
225 ClientSocket* socket = transport_socket_handle_->socket(); 225 ClientSocket* socket = transport_socket_handle_->socket();
226 HttpProxyClientSocket* tunnel_socket = 226 HttpProxyClientSocket* tunnel_socket =
227 static_cast<HttpProxyClientSocket*>(socket); 227 static_cast<HttpProxyClientSocket*>(socket);
228 228
229 if (result == ERR_RETRY_CONNECTION) { 229 if (result == ERR_RETRY_CONNECTION) {
230 DetermineFirstState(); 230 DetermineFirstState();
231 params_->http_proxy_params()->set_auth_controller(
232 tunnel_socket->ReleaseAuthController());
231 transport_socket_handle_->socket()->Disconnect(); 233 transport_socket_handle_->socket()->Disconnect();
232 return OK; 234 return OK;
233 } 235 }
234 236
235 // Extract the information needed to prompt for the proxy authentication. 237 // Extract the information needed to prompt for the proxy authentication.
236 // so that when ClientSocketPoolBaseHelper calls |GetAdditionalErrorState|, 238 // so that when ClientSocketPoolBaseHelper calls |GetAdditionalErrorState|,
237 // we can easily set the state. 239 // we can easily set the state.
238 if (result == ERR_PROXY_AUTH_REQUESTED) 240 if (result == ERR_PROXY_AUTH_REQUESTED)
239 error_response_info_ = *tunnel_socket->GetResponseInfo(); 241 error_response_info_ = *tunnel_socket->GetResponseInfo();
240 242
241 if (result < 0) 243 if (result < 0)
242 return result; 244 return result;
243 245
244 if (tunnel_socket->NeedsRestartWithAuth()) { 246 if (tunnel_socket->NeedsRestartWithAuth()) {
245 // We must have gotten an 'idle' tunnel socket that is waiting for auth. 247 // We must have gotten an 'idle' tunnel socket that is waiting for auth.
246 // The HttpAuthController should have new credentials, we just need 248 // The HttpAuthController should have new credentials, we just need
247 // to retry. 249 // to retry.
248 next_state_ = STATE_TUNNEL_CONNECT_COMPLETE; 250 next_state_ = STATE_TUNNEL_CONNECT_COMPLETE;
249 return tunnel_socket->RestartWithAuth(&callback_); 251 scoped_ptr<HttpAuthController> auth(
252 params_->http_proxy_params()->ReleaseAuthController());
253 const HttpAuth::Identity& auth_credentials = auth->AuthIdentity();
254 DCHECK_EQ(auth_credentials.source, HttpAuth::IDENT_SRC_EXTERNAL);
255 DCHECK(!auth_credentials.invalid);
256 return tunnel_socket->RestartWithAuth(auth_credentials.username,
257 auth_credentials.password,
258 &callback_);
250 } 259 }
251 260
252 next_state_ = STATE_SSL_CONNECT; 261 next_state_ = STATE_SSL_CONNECT;
253 return result; 262 return result;
254 } 263 }
255 264
256 void SSLConnectJob::GetAdditionalErrorState(ClientSocketHandle * handle) { 265 void SSLConnectJob::GetAdditionalErrorState(ClientSocketHandle * handle) {
257 handle->set_ssl_error_response_info(error_response_info_); 266 handle->set_ssl_error_response_info(error_response_info_);
258 if (!ssl_connect_start_time_.is_null()) 267 if (!ssl_connect_start_time_.is_null())
259 handle->set_is_ssl_error(true); 268 handle->set_is_ssl_error(true);
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
417 const std::string& group_name) const { 426 const std::string& group_name) const {
418 return base_.IdleSocketCountInGroup(group_name); 427 return base_.IdleSocketCountInGroup(group_name);
419 } 428 }
420 429
421 LoadState SSLClientSocketPool::GetLoadState( 430 LoadState SSLClientSocketPool::GetLoadState(
422 const std::string& group_name, const ClientSocketHandle* handle) const { 431 const std::string& group_name, const ClientSocketHandle* handle) const {
423 return base_.GetLoadState(group_name, handle); 432 return base_.GetLoadState(group_name, handle);
424 } 433 }
425 434
426 } // namespace net 435 } // namespace net
OLDNEW
« no previous file with comments | « net/socket/socket_test_util.cc ('k') | net/socket/ssl_client_socket_pool_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698