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 "net/http/http_stream_factory_impl_job.h" | 5 #include "net/http/http_stream_factory_impl_job.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
224 !alternative_proxy_server_.is_valid()) || | 224 !alternative_proxy_server_.is_valid()) || |
225 (job_type_ == ALTERNATIVE || job_type_ == PRECONNECT)); | 225 (job_type_ == ALTERNATIVE || job_type_ == PRECONNECT)); |
226 // If the alternative proxy server is valid, then the job type must be | 226 // If the alternative proxy server is valid, then the job type must be |
227 // set to ALTERNATIVE. | 227 // set to ALTERNATIVE. |
228 DCHECK(!alternative_proxy_server_.is_valid() || job_type_ == ALTERNATIVE); | 228 DCHECK(!alternative_proxy_server_.is_valid() || job_type_ == ALTERNATIVE); |
229 | 229 |
230 if (IsSpdyAlternative()) { | 230 if (IsSpdyAlternative()) { |
231 DCHECK(origin_url_.SchemeIs(url::kHttpsScheme)); | 231 DCHECK(origin_url_.SchemeIs(url::kHttpsScheme)); |
232 } | 232 } |
233 if (IsQuicAlternative()) { | 233 if (IsQuicAlternative()) { |
234 DCHECK(session_->params().enable_quic); | 234 DCHECK(session_->IsQuicEnabled()); |
235 using_quic_ = true; | 235 using_quic_ = true; |
236 } | 236 } |
237 } | 237 } |
238 | 238 |
239 HttpStreamFactoryImpl::Job::~Job() { | 239 HttpStreamFactoryImpl::Job::~Job() { |
240 net_log_.EndEvent(NetLogEventType::HTTP_STREAM_JOB); | 240 net_log_.EndEvent(NetLogEventType::HTTP_STREAM_JOB); |
241 | 241 |
242 // When we're in a partially constructed state, waiting for the user to | 242 // When we're in a partially constructed state, waiting for the user to |
243 // provide certificate handling information or authentication, we can't reuse | 243 // provide certificate handling information or authentication, we can't reuse |
244 // this stream at all. | 244 // this stream at all. |
(...skipping 485 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
730 int HttpStreamFactoryImpl::Job::DoResolveProxyComplete(int result) { | 730 int HttpStreamFactoryImpl::Job::DoResolveProxyComplete(int result) { |
731 pac_request_ = NULL; | 731 pac_request_ = NULL; |
732 | 732 |
733 if (result == OK) { | 733 if (result == OK) { |
734 // Remove unsupported proxies from the list. | 734 // Remove unsupported proxies from the list. |
735 int supported_proxies = | 735 int supported_proxies = |
736 ProxyServer::SCHEME_DIRECT | ProxyServer::SCHEME_HTTP | | 736 ProxyServer::SCHEME_DIRECT | ProxyServer::SCHEME_HTTP | |
737 ProxyServer::SCHEME_HTTPS | ProxyServer::SCHEME_SOCKS4 | | 737 ProxyServer::SCHEME_HTTPS | ProxyServer::SCHEME_SOCKS4 | |
738 ProxyServer::SCHEME_SOCKS5; | 738 ProxyServer::SCHEME_SOCKS5; |
739 | 739 |
740 if (session_->params().enable_quic) | 740 if (session_->IsQuicEnabled()) |
741 supported_proxies |= ProxyServer::SCHEME_QUIC; | 741 supported_proxies |= ProxyServer::SCHEME_QUIC; |
742 | 742 |
743 proxy_info_.RemoveProxiesWithoutScheme(supported_proxies); | 743 proxy_info_.RemoveProxiesWithoutScheme(supported_proxies); |
744 | 744 |
745 if (proxy_info_.is_empty()) { | 745 if (proxy_info_.is_empty()) { |
746 // No proxies/direct to choose from. This happens when we don't support | 746 // No proxies/direct to choose from. This happens when we don't support |
747 // any of the proxies in the returned list. | 747 // any of the proxies in the returned list. |
748 result = ERR_NO_SUPPORTED_PROXIES; | 748 result = ERR_NO_SUPPORTED_PROXIES; |
749 } else if (using_quic_ && | 749 } else if (using_quic_ && |
750 (!proxy_info_.is_quic() && !proxy_info_.is_direct())) { | 750 (!proxy_info_.is_quic() && !proxy_info_.is_direct())) { |
(...skipping 10 matching lines...) Expand all Loading... |
761 next_state_ = STATE_WAIT; | 761 next_state_ = STATE_WAIT; |
762 | 762 |
763 delegate_->OnResolveProxyComplete(this, request_info_, priority_, | 763 delegate_->OnResolveProxyComplete(this, request_info_, priority_, |
764 server_ssl_config_, proxy_ssl_config_, | 764 server_ssl_config_, proxy_ssl_config_, |
765 stream_type_); | 765 stream_type_); |
766 | 766 |
767 return OK; | 767 return OK; |
768 } | 768 } |
769 | 769 |
770 bool HttpStreamFactoryImpl::Job::ShouldForceQuic() const { | 770 bool HttpStreamFactoryImpl::Job::ShouldForceQuic() const { |
771 return session_->params().enable_quic && | 771 return session_->IsQuicEnabled() && |
772 (base::ContainsKey(session_->params().origins_to_force_quic_on, | 772 (base::ContainsKey(session_->params().origins_to_force_quic_on, |
773 HostPortPair()) || | 773 HostPortPair()) || |
774 base::ContainsKey(session_->params().origins_to_force_quic_on, | 774 base::ContainsKey(session_->params().origins_to_force_quic_on, |
775 destination_)) && | 775 destination_)) && |
776 proxy_info_.is_direct() && origin_url_.SchemeIs(url::kHttpsScheme); | 776 proxy_info_.is_direct() && origin_url_.SchemeIs(url::kHttpsScheme); |
777 } | 777 } |
778 | 778 |
779 int HttpStreamFactoryImpl::Job::DoWait() { | 779 int HttpStreamFactoryImpl::Job::DoWait() { |
780 next_state_ = STATE_WAIT_COMPLETE; | 780 next_state_ = STATE_WAIT_COMPLETE; |
781 if (delegate_->ShouldWait(this)) | 781 if (delegate_->ShouldWait(this)) |
(...skipping 30 matching lines...) Expand all Loading... |
812 return OK; | 812 return OK; |
813 } | 813 } |
814 | 814 |
815 using_ssl_ = origin_url_.SchemeIs(url::kHttpsScheme) || | 815 using_ssl_ = origin_url_.SchemeIs(url::kHttpsScheme) || |
816 origin_url_.SchemeIs(url::kWssScheme); | 816 origin_url_.SchemeIs(url::kWssScheme); |
817 using_spdy_ = false; | 817 using_spdy_ = false; |
818 | 818 |
819 if (ShouldForceQuic()) | 819 if (ShouldForceQuic()) |
820 using_quic_ = true; | 820 using_quic_ = true; |
821 | 821 |
822 DCHECK(!using_quic_ || session_->params().enable_quic); | 822 DCHECK(!using_quic_ || session_->IsQuicEnabled()); |
823 | 823 |
824 if (proxy_info_.is_quic()) { | 824 if (proxy_info_.is_quic()) { |
825 using_quic_ = true; | 825 using_quic_ = true; |
826 DCHECK(session_->params().enable_quic); | 826 DCHECK(session_->IsQuicEnabled()); |
827 } | 827 } |
828 | 828 |
829 if (proxy_info_.is_https() || proxy_info_.is_quic()) { | 829 if (proxy_info_.is_https() || proxy_info_.is_quic()) { |
830 InitSSLConfig(&proxy_ssl_config_, /*is_proxy=*/true); | 830 InitSSLConfig(&proxy_ssl_config_, /*is_proxy=*/true); |
831 // Disable revocation checking for HTTPS proxies since the revocation | 831 // Disable revocation checking for HTTPS proxies since the revocation |
832 // requests are probably going to need to go through the proxy too. | 832 // requests are probably going to need to go through the proxy too. |
833 proxy_ssl_config_.rev_checking_enabled = false; | 833 proxy_ssl_config_.rev_checking_enabled = false; |
834 } | 834 } |
835 if (using_ssl_) { | 835 if (using_ssl_) { |
836 InitSSLConfig(&server_ssl_config_, /*is_proxy=*/false); | 836 InitSSLConfig(&server_ssl_config_, /*is_proxy=*/false); |
(...skipping 668 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1505 | 1505 |
1506 ConnectionAttempts socket_attempts = connection_->connection_attempts(); | 1506 ConnectionAttempts socket_attempts = connection_->connection_attempts(); |
1507 if (connection_->socket()) { | 1507 if (connection_->socket()) { |
1508 connection_->socket()->GetConnectionAttempts(&socket_attempts); | 1508 connection_->socket()->GetConnectionAttempts(&socket_attempts); |
1509 } | 1509 } |
1510 | 1510 |
1511 delegate_->AddConnectionAttemptsToRequest(this, socket_attempts); | 1511 delegate_->AddConnectionAttemptsToRequest(this, socket_attempts); |
1512 } | 1512 } |
1513 | 1513 |
1514 } // namespace net | 1514 } // namespace net |
OLD | NEW |