| OLD | NEW |
| 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/http/http_stream_request.h" | 5 #include "net/http/http_stream_request.h" |
| 6 | 6 |
| 7 #include "base/stl_util-inl.h" | 7 #include "base/stl_util-inl.h" |
| 8 #include "base/string_number_conversions.h" | 8 #include "base/string_number_conversions.h" |
| 9 #include "base/string_util.h" | 9 #include "base/string_util.h" |
| 10 #include "base/stringprintf.h" |
| 10 #include "net/base/connection_type_histograms.h" | 11 #include "net/base/connection_type_histograms.h" |
| 11 #include "net/base/net_log.h" | 12 #include "net/base/net_log.h" |
| 12 #include "net/base/net_util.h" | 13 #include "net/base/net_util.h" |
| 13 #include "net/base/ssl_cert_request_info.h" | 14 #include "net/base/ssl_cert_request_info.h" |
| 14 #include "net/http/http_basic_stream.h" | 15 #include "net/http/http_basic_stream.h" |
| 15 #include "net/http/http_network_session.h" | 16 #include "net/http/http_network_session.h" |
| 16 #include "net/http/http_proxy_client_socket.h" | 17 #include "net/http/http_proxy_client_socket.h" |
| 17 #include "net/http/http_request_info.h" | 18 #include "net/http/http_request_info.h" |
| 19 #include "net/socket/client_socket_handle.h" |
| 20 #include "net/socket/ssl_client_socket.h" |
| 18 #include "net/spdy/spdy_http_stream.h" | 21 #include "net/spdy/spdy_http_stream.h" |
| 19 #include "net/spdy/spdy_session.h" | 22 #include "net/spdy/spdy_session.h" |
| 20 #include "net/spdy/spdy_session_pool.h" | 23 #include "net/spdy/spdy_session_pool.h" |
| 21 #include "net/socket/client_socket_handle.h" | |
| 22 #include "net/socket/ssl_client_socket.h" | |
| 23 | 24 |
| 24 namespace net { | 25 namespace net { |
| 25 | 26 |
| 26 namespace { | 27 namespace { |
| 27 | 28 |
| 28 GURL UpgradeUrlToHttps(const GURL& original_url) { | 29 GURL UpgradeUrlToHttps(const GURL& original_url) { |
| 29 GURL::Replacements replacements; | 30 GURL::Replacements replacements; |
| 30 // new_sheme and new_port need to be in scope here because GURL::Replacements | 31 // new_sheme and new_port need to be in scope here because GURL::Replacements |
| 31 // references the memory contained by them directly. | 32 // references the memory contained by them directly. |
| 32 const std::string new_scheme = "https"; | 33 const std::string new_scheme = "https"; |
| (...skipping 410 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 443 return OK; | 444 return OK; |
| 444 } | 445 } |
| 445 } | 446 } |
| 446 | 447 |
| 447 // Build the string used to uniquely identify connections of this type. | 448 // Build the string used to uniquely identify connections of this type. |
| 448 // Determine the host and port to connect to. | 449 // Determine the host and port to connect to. |
| 449 std::string connection_group = endpoint_.ToString(); | 450 std::string connection_group = endpoint_.ToString(); |
| 450 DCHECK(!connection_group.empty()); | 451 DCHECK(!connection_group.empty()); |
| 451 | 452 |
| 452 if (using_ssl_) | 453 if (using_ssl_) |
| 453 connection_group = StringPrintf("ssl/%s", connection_group.c_str()); | 454 connection_group = base::StringPrintf("ssl/%s", connection_group.c_str()); |
| 454 | 455 |
| 455 // If the user is refreshing the page, bypass the host cache. | 456 // If the user is refreshing the page, bypass the host cache. |
| 456 bool disable_resolver_cache = | 457 bool disable_resolver_cache = |
| 457 request_info().load_flags & LOAD_BYPASS_CACHE || | 458 request_info().load_flags & LOAD_BYPASS_CACHE || |
| 458 request_info().load_flags & LOAD_VALIDATE_CACHE || | 459 request_info().load_flags & LOAD_VALIDATE_CACHE || |
| 459 request_info().load_flags & LOAD_DISABLE_CACHE; | 460 request_info().load_flags & LOAD_DISABLE_CACHE; |
| 460 | 461 |
| 461 // Build up the connection parameters. | 462 // Build up the connection parameters. |
| 462 scoped_refptr<TCPSocketParams> tcp_params; | 463 scoped_refptr<TCPSocketParams> tcp_params; |
| 463 scoped_refptr<HttpProxySocketParams> http_proxy_params; | 464 scoped_refptr<HttpProxySocketParams> http_proxy_params; |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 511 session_->auth_cache(), | 512 session_->auth_cache(), |
| 512 session_->http_auth_handler_factory(), | 513 session_->http_auth_handler_factory(), |
| 513 using_ssl_); | 514 using_ssl_); |
| 514 } else { | 515 } else { |
| 515 DCHECK(proxy_info()->is_socks()); | 516 DCHECK(proxy_info()->is_socks()); |
| 516 char socks_version; | 517 char socks_version; |
| 517 if (proxy_server.scheme() == ProxyServer::SCHEME_SOCKS5) | 518 if (proxy_server.scheme() == ProxyServer::SCHEME_SOCKS5) |
| 518 socks_version = '5'; | 519 socks_version = '5'; |
| 519 else | 520 else |
| 520 socks_version = '4'; | 521 socks_version = '4'; |
| 521 connection_group = | 522 connection_group = base::StringPrintf( |
| 522 StringPrintf("socks%c/%s", socks_version, connection_group.c_str()); | 523 "socks%c/%s", socks_version, connection_group.c_str()); |
| 523 | 524 |
| 524 socks_params = new SOCKSSocketParams(proxy_tcp_params, | 525 socks_params = new SOCKSSocketParams(proxy_tcp_params, |
| 525 socks_version == '5', | 526 socks_version == '5', |
| 526 endpoint_, | 527 endpoint_, |
| 527 request_info().priority, | 528 request_info().priority, |
| 528 request_info().referrer); | 529 request_info().referrer); |
| 529 } | 530 } |
| 530 } | 531 } |
| 531 | 532 |
| 532 // Deal with SSL - which layers on top of any given proxy. | 533 // Deal with SSL - which layers on top of any given proxy. |
| (...skipping 444 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 977 base::TimeDelta::FromMinutes(6), | 978 base::TimeDelta::FromMinutes(6), |
| 978 100); | 979 100); |
| 979 break; | 980 break; |
| 980 default: | 981 default: |
| 981 NOTREACHED(); | 982 NOTREACHED(); |
| 982 break; | 983 break; |
| 983 } | 984 } |
| 984 } | 985 } |
| 985 | 986 |
| 986 } // namespace net | 987 } // namespace net |
| OLD | NEW |