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

Side by Side Diff: net/http/http_proxy_client_socket_pool.cc

Issue 517693002: Add embedder-specific headers to HTTP CONNECT tunnel request (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Reworked HaveAuth test Created 6 years, 3 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
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 "net/http/http_proxy_client_socket_pool.h" 5 #include "net/http/http_proxy_client_socket_pool.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/compiler_specific.h" 9 #include "base/compiler_specific.h"
10 #include "base/time/time.h" 10 #include "base/time/time.h"
(...skipping 19 matching lines...) Expand all
30 30
31 HttpProxySocketParams::HttpProxySocketParams( 31 HttpProxySocketParams::HttpProxySocketParams(
32 const scoped_refptr<TransportSocketParams>& transport_params, 32 const scoped_refptr<TransportSocketParams>& transport_params,
33 const scoped_refptr<SSLSocketParams>& ssl_params, 33 const scoped_refptr<SSLSocketParams>& ssl_params,
34 const GURL& request_url, 34 const GURL& request_url,
35 const std::string& user_agent, 35 const std::string& user_agent,
36 const HostPortPair& endpoint, 36 const HostPortPair& endpoint,
37 HttpAuthCache* http_auth_cache, 37 HttpAuthCache* http_auth_cache,
38 HttpAuthHandlerFactory* http_auth_handler_factory, 38 HttpAuthHandlerFactory* http_auth_handler_factory,
39 SpdySessionPool* spdy_session_pool, 39 SpdySessionPool* spdy_session_pool,
40 bool tunnel) 40 bool tunnel,
41 ProxyDelegate* proxy_delegate)
41 : transport_params_(transport_params), 42 : transport_params_(transport_params),
42 ssl_params_(ssl_params), 43 ssl_params_(ssl_params),
43 spdy_session_pool_(spdy_session_pool), 44 spdy_session_pool_(spdy_session_pool),
44 request_url_(request_url), 45 request_url_(request_url),
45 user_agent_(user_agent), 46 user_agent_(user_agent),
46 endpoint_(endpoint), 47 endpoint_(endpoint),
47 http_auth_cache_(tunnel ? http_auth_cache : NULL), 48 http_auth_cache_(tunnel ? http_auth_cache : NULL),
48 http_auth_handler_factory_(tunnel ? http_auth_handler_factory : NULL), 49 http_auth_handler_factory_(tunnel ? http_auth_handler_factory : NULL),
49 tunnel_(tunnel) { 50 tunnel_(tunnel),
51 proxy_delegate_(proxy_delegate) {
50 DCHECK((transport_params.get() == NULL && ssl_params.get() != NULL) || 52 DCHECK((transport_params.get() == NULL && ssl_params.get() != NULL) ||
51 (transport_params.get() != NULL && ssl_params.get() == NULL)); 53 (transport_params.get() != NULL && ssl_params.get() == NULL));
52 if (transport_params_.get()) { 54 if (transport_params_.get()) {
53 ignore_limits_ = transport_params->ignore_limits(); 55 ignore_limits_ = transport_params->ignore_limits();
54 } else { 56 } else {
55 ignore_limits_ = ssl_params->ignore_limits(); 57 ignore_limits_ = ssl_params->ignore_limits();
56 } 58 }
57 } 59 }
58 60
59 const HostResolver::RequestInfo& HttpProxySocketParams::destination() const { 61 const HostResolver::RequestInfo& HttpProxySocketParams::destination() const {
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after
284 new HttpProxyClientSocket(transport_socket_handle_.release(), 286 new HttpProxyClientSocket(transport_socket_handle_.release(),
285 params_->request_url(), 287 params_->request_url(),
286 params_->user_agent(), 288 params_->user_agent(),
287 params_->endpoint(), 289 params_->endpoint(),
288 proxy_server, 290 proxy_server,
289 params_->http_auth_cache(), 291 params_->http_auth_cache(),
290 params_->http_auth_handler_factory(), 292 params_->http_auth_handler_factory(),
291 params_->tunnel(), 293 params_->tunnel(),
292 using_spdy_, 294 using_spdy_,
293 protocol_negotiated_, 295 protocol_negotiated_,
296 params_->proxy_delegate(),
294 params_->ssl_params().get() != NULL)); 297 params_->ssl_params().get() != NULL));
295 return transport_socket_->Connect(callback_); 298 return transport_socket_->Connect(callback_);
296 } 299 }
297 300
298 int HttpProxyConnectJob::DoHttpProxyConnectComplete(int result) { 301 int HttpProxyConnectJob::DoHttpProxyConnectComplete(int result) {
299 if (result == OK || result == ERR_PROXY_AUTH_REQUESTED || 302 if (result == OK || result == ERR_PROXY_AUTH_REQUESTED ||
300 result == ERR_HTTPS_PROXY_TUNNEL_RESPONSE) { 303 result == ERR_HTTPS_PROXY_TUNNEL_RESPONSE) {
301 SetSocket(transport_socket_.PassAs<StreamSocket>()); 304 SetSocket(transport_socket_.PassAs<StreamSocket>());
302 } 305 }
303 306
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
365 next_state_ = STATE_SSL_CONNECT; 368 next_state_ = STATE_SSL_CONNECT;
366 } 369 }
367 return DoLoop(OK); 370 return DoLoop(OK);
368 } 371 }
369 372
370 HttpProxyClientSocketPool:: 373 HttpProxyClientSocketPool::
371 HttpProxyConnectJobFactory::HttpProxyConnectJobFactory( 374 HttpProxyConnectJobFactory::HttpProxyConnectJobFactory(
372 TransportClientSocketPool* transport_pool, 375 TransportClientSocketPool* transport_pool,
373 SSLClientSocketPool* ssl_pool, 376 SSLClientSocketPool* ssl_pool,
374 HostResolver* host_resolver, 377 HostResolver* host_resolver,
378 const ProxyDelegate* proxy_delegate,
375 NetLog* net_log) 379 NetLog* net_log)
376 : transport_pool_(transport_pool), 380 : transport_pool_(transport_pool),
377 ssl_pool_(ssl_pool), 381 ssl_pool_(ssl_pool),
378 host_resolver_(host_resolver), 382 host_resolver_(host_resolver),
383 proxy_delegate_(proxy_delegate),
379 net_log_(net_log) { 384 net_log_(net_log) {
380 base::TimeDelta max_pool_timeout = base::TimeDelta(); 385 base::TimeDelta max_pool_timeout = base::TimeDelta();
381 386
382 #if (defined(OS_ANDROID) || defined(OS_IOS)) && defined(SPDY_PROXY_AUTH_ORIGIN) 387 #if (defined(OS_ANDROID) || defined(OS_IOS)) && defined(SPDY_PROXY_AUTH_ORIGIN)
383 #else 388 #else
384 if (transport_pool_) 389 if (transport_pool_)
385 max_pool_timeout = transport_pool_->ConnectionTimeout(); 390 max_pool_timeout = transport_pool_->ConnectionTimeout();
386 if (ssl_pool_) 391 if (ssl_pool_)
387 max_pool_timeout = std::max(max_pool_timeout, 392 max_pool_timeout = std::max(max_pool_timeout,
388 ssl_pool_->ConnectionTimeout()); 393 ssl_pool_->ConnectionTimeout());
(...skipping 25 matching lines...) Expand all
414 return timeout_; 419 return timeout_;
415 } 420 }
416 421
417 HttpProxyClientSocketPool::HttpProxyClientSocketPool( 422 HttpProxyClientSocketPool::HttpProxyClientSocketPool(
418 int max_sockets, 423 int max_sockets,
419 int max_sockets_per_group, 424 int max_sockets_per_group,
420 ClientSocketPoolHistograms* histograms, 425 ClientSocketPoolHistograms* histograms,
421 HostResolver* host_resolver, 426 HostResolver* host_resolver,
422 TransportClientSocketPool* transport_pool, 427 TransportClientSocketPool* transport_pool,
423 SSLClientSocketPool* ssl_pool, 428 SSLClientSocketPool* ssl_pool,
429 const ProxyDelegate* proxy_delegate,
424 NetLog* net_log) 430 NetLog* net_log)
425 : transport_pool_(transport_pool), 431 : transport_pool_(transport_pool),
426 ssl_pool_(ssl_pool), 432 ssl_pool_(ssl_pool),
427 base_(this, max_sockets, max_sockets_per_group, histograms, 433 base_(this, max_sockets, max_sockets_per_group, histograms,
428 ClientSocketPool::unused_idle_socket_timeout(), 434 ClientSocketPool::unused_idle_socket_timeout(),
429 ClientSocketPool::used_idle_socket_timeout(), 435 ClientSocketPool::used_idle_socket_timeout(),
430 new HttpProxyConnectJobFactory(transport_pool, 436 new HttpProxyConnectJobFactory(transport_pool,
431 ssl_pool, 437 ssl_pool,
432 host_resolver, 438 host_resolver,
439 proxy_delegate,
433 net_log)) { 440 net_log)) {
434 // We should always have a |transport_pool_| except in unit tests. 441 // We should always have a |transport_pool_| except in unit tests.
435 if (transport_pool_) 442 if (transport_pool_)
436 base_.AddLowerLayeredPool(transport_pool_); 443 base_.AddLowerLayeredPool(transport_pool_);
437 if (ssl_pool_) 444 if (ssl_pool_)
438 base_.AddLowerLayeredPool(ssl_pool_); 445 base_.AddLowerLayeredPool(ssl_pool_);
439 } 446 }
440 447
441 HttpProxyClientSocketPool::~HttpProxyClientSocketPool() { 448 HttpProxyClientSocketPool::~HttpProxyClientSocketPool() {
442 } 449 }
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
541 base_.RemoveHigherLayeredPool(higher_pool); 548 base_.RemoveHigherLayeredPool(higher_pool);
542 } 549 }
543 550
544 bool HttpProxyClientSocketPool::CloseOneIdleConnection() { 551 bool HttpProxyClientSocketPool::CloseOneIdleConnection() {
545 if (base_.CloseOneIdleSocket()) 552 if (base_.CloseOneIdleSocket())
546 return true; 553 return true;
547 return base_.CloseOneIdleConnectionInHigherLayeredPool(); 554 return base_.CloseOneIdleConnectionInHigherLayeredPool();
548 } 555 }
549 556
550 } // namespace net 557 } // namespace net
OLDNEW
« no previous file with comments | « net/http/http_proxy_client_socket_pool.h ('k') | net/http/http_proxy_client_socket_pool_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698