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 "base/stringprintf.h" |
(...skipping 462 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
473 scoped_refptr<SOCKSSocketParams> socks_params; | 473 scoped_refptr<SOCKSSocketParams> socks_params; |
474 scoped_ptr<HostPortPair> proxy_host_port; | 474 scoped_ptr<HostPortPair> proxy_host_port; |
475 | 475 |
476 if (proxy_info()->is_direct()) { | 476 if (proxy_info()->is_direct()) { |
477 tcp_params = new TCPSocketParams(endpoint_, request_info().priority, | 477 tcp_params = new TCPSocketParams(endpoint_, request_info().priority, |
478 request_info().referrer, | 478 request_info().referrer, |
479 disable_resolver_cache); | 479 disable_resolver_cache); |
480 } else { | 480 } else { |
481 ProxyServer proxy_server = proxy_info()->proxy_server(); | 481 ProxyServer proxy_server = proxy_info()->proxy_server(); |
482 proxy_host_port.reset(new HostPortPair(proxy_server.host_port_pair())); | 482 proxy_host_port.reset(new HostPortPair(proxy_server.host_port_pair())); |
483 scoped_refptr<TCPSocketParams> proxy_tcp_params = | 483 scoped_refptr<TCPSocketParams> proxy_tcp_params( |
484 new TCPSocketParams(*proxy_host_port, request_info().priority, | 484 new TCPSocketParams(*proxy_host_port, request_info().priority, |
485 request_info().referrer, disable_resolver_cache); | 485 request_info().referrer, disable_resolver_cache)); |
486 | 486 |
487 if (proxy_info()->is_http() || proxy_info()->is_https()) { | 487 if (proxy_info()->is_http() || proxy_info()->is_https()) { |
488 GURL authentication_url = request_info().url; | 488 GURL authentication_url = request_info().url; |
489 if (using_ssl_ && !authentication_url.SchemeIs("https")) { | 489 if (using_ssl_ && !authentication_url.SchemeIs("https")) { |
490 // If a proxy tunnel connection needs to be established due to | 490 // If a proxy tunnel connection needs to be established due to |
491 // an Alternate-Protocol, the URL needs to be changed to indicate | 491 // an Alternate-Protocol, the URL needs to be changed to indicate |
492 // https or digest authentication attempts will fail. | 492 // https or digest authentication attempts will fail. |
493 // For example, suppose the initial request was for | 493 // For example, suppose the initial request was for |
494 // "http://www.example.com/index.html". If this is an SSL | 494 // "http://www.example.com/index.html". If this is an SSL |
495 // upgrade due to alternate protocol, the digest authorization | 495 // upgrade due to alternate protocol, the digest authorization |
(...skipping 354 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
850 if (HttpStreamFactory::ignore_certificate_errors()) | 850 if (HttpStreamFactory::ignore_certificate_errors()) |
851 load_flags |= LOAD_IGNORE_ALL_CERT_ERRORS; | 851 load_flags |= LOAD_IGNORE_ALL_CERT_ERRORS; |
852 if (request_info().load_flags & LOAD_VERIFY_EV_CERT) | 852 if (request_info().load_flags & LOAD_VERIFY_EV_CERT) |
853 ssl_config()->verify_ev_cert = true; | 853 ssl_config()->verify_ev_cert = true; |
854 | 854 |
855 if (proxy_info()->proxy_server().scheme() == ProxyServer::SCHEME_HTTP || | 855 if (proxy_info()->proxy_server().scheme() == ProxyServer::SCHEME_HTTP || |
856 proxy_info()->proxy_server().scheme() == ProxyServer::SCHEME_HTTPS) { | 856 proxy_info()->proxy_server().scheme() == ProxyServer::SCHEME_HTTPS) { |
857 ssl_config()->mitm_proxies_allowed = true; | 857 ssl_config()->mitm_proxies_allowed = true; |
858 } | 858 } |
859 | 859 |
860 scoped_refptr<SSLSocketParams> ssl_params = | 860 scoped_refptr<SSLSocketParams> ssl_params( |
861 new SSLSocketParams(tcp_params, socks_params, http_proxy_params, | 861 new SSLSocketParams(tcp_params, socks_params, http_proxy_params, |
862 proxy_scheme, hostname, | 862 proxy_scheme, hostname, |
863 *ssl_config(), load_flags, | 863 *ssl_config(), load_flags, |
864 force_spdy_always_ && force_spdy_over_ssl_, | 864 force_spdy_always_ && force_spdy_over_ssl_, |
865 want_spdy_over_npn); | 865 want_spdy_over_npn)); |
866 | 866 |
867 return ssl_params; | 867 return ssl_params; |
868 } | 868 } |
869 | 869 |
870 | 870 |
871 void HttpStreamRequest::MarkBrokenAlternateProtocolAndFallback() { | 871 void HttpStreamRequest::MarkBrokenAlternateProtocolAndFallback() { |
872 // We have to: | 872 // We have to: |
873 // * Reset the endpoint to be the unmodified URL specified destination. | 873 // * Reset the endpoint to be the unmodified URL specified destination. |
874 // * Mark the endpoint as broken so we don't try again. | 874 // * Mark the endpoint as broken so we don't try again. |
875 // * Set the alternate protocol mode to kDoNotUseAlternateProtocol so we | 875 // * Set the alternate protocol mode to kDoNotUseAlternateProtocol so we |
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1039 base::TimeDelta::FromMinutes(6), | 1039 base::TimeDelta::FromMinutes(6), |
1040 100); | 1040 100); |
1041 break; | 1041 break; |
1042 default: | 1042 default: |
1043 NOTREACHED(); | 1043 NOTREACHED(); |
1044 break; | 1044 break; |
1045 } | 1045 } |
1046 } | 1046 } |
1047 | 1047 |
1048 } // namespace net | 1048 } // namespace net |
OLD | NEW |