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 657 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
668 return session_->proxy_service()->ResolveProxy( | 668 return session_->proxy_service()->ResolveProxy( |
669 request_info_.url, &proxy_info_, io_callback_, &pac_request_, net_log_); | 669 request_info_.url, &proxy_info_, io_callback_, &pac_request_, net_log_); |
670 } | 670 } |
671 | 671 |
672 int HttpStreamFactoryImpl::Job::DoResolveProxyComplete(int result) { | 672 int HttpStreamFactoryImpl::Job::DoResolveProxyComplete(int result) { |
673 pac_request_ = NULL; | 673 pac_request_ = NULL; |
674 | 674 |
675 if (result == OK) { | 675 if (result == OK) { |
676 // Remove unsupported proxies from the list. | 676 // Remove unsupported proxies from the list. |
677 proxy_info_.RemoveProxiesWithoutScheme( | 677 proxy_info_.RemoveProxiesWithoutScheme( |
678 ProxyServer::SCHEME_DIRECT | | 678 ProxyServer::SCHEME_DIRECT | ProxyServer::SCHEME_QUIC | |
679 ProxyServer::SCHEME_HTTP | ProxyServer::SCHEME_HTTPS | | 679 ProxyServer::SCHEME_HTTP | ProxyServer::SCHEME_HTTPS | |
680 ProxyServer::SCHEME_SOCKS4 | ProxyServer::SCHEME_SOCKS5); | 680 ProxyServer::SCHEME_SOCKS4 | ProxyServer::SCHEME_SOCKS5); |
681 | 681 |
682 if (proxy_info_.is_empty()) { | 682 if (proxy_info_.is_empty()) { |
683 // No proxies/direct to choose from. This happens when we don't support | 683 // No proxies/direct to choose from. This happens when we don't support |
684 // any of the proxies in the returned list. | 684 // any of the proxies in the returned list. |
685 result = ERR_NO_SUPPORTED_PROXIES; | 685 result = ERR_NO_SUPPORTED_PROXIES; |
686 } | 686 } |
687 } | 687 } |
688 | 688 |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
736 DCHECK(proxy_info_.proxy_server().is_valid()); | 736 DCHECK(proxy_info_.proxy_server().is_valid()); |
737 next_state_ = STATE_INIT_CONNECTION_COMPLETE; | 737 next_state_ = STATE_INIT_CONNECTION_COMPLETE; |
738 | 738 |
739 using_ssl_ = request_info_.url.SchemeIs("https") || | 739 using_ssl_ = request_info_.url.SchemeIs("https") || |
740 request_info_.url.SchemeIs("wss") || ShouldForceSpdySSL(); | 740 request_info_.url.SchemeIs("wss") || ShouldForceSpdySSL(); |
741 using_spdy_ = false; | 741 using_spdy_ = false; |
742 | 742 |
743 if (ShouldForceQuic()) | 743 if (ShouldForceQuic()) |
744 using_quic_ = true; | 744 using_quic_ = true; |
745 | 745 |
| 746 if (proxy_info_.is_quic()) |
| 747 using_quic_ = true; |
| 748 |
746 if (using_quic_) { | 749 if (using_quic_) { |
747 DCHECK(session_->params().enable_quic); | 750 DCHECK(session_->params().enable_quic); |
748 if (!proxy_info_.is_direct()) { | 751 if (proxy_info_.is_quic() && !request_info_.url.SchemeIs("http")) { |
749 NOTREACHED(); | 752 NOTREACHED(); |
750 // TODO(rch): support QUIC proxies. | 753 // TODO(rch): support QUIC proxies for HTTPS urls. |
751 return ERR_NOT_IMPLEMENTED; | 754 return ERR_NOT_IMPLEMENTED; |
752 } | 755 } |
| 756 HostPortProxyPair destination; |
| 757 destination.first = proxy_info_.is_quic() ? |
| 758 proxy_info_.proxy_server().host_port_pair() : origin_; |
| 759 destination.second = ProxyServer::Direct(); |
753 next_state_ = STATE_INIT_CONNECTION_COMPLETE; | 760 next_state_ = STATE_INIT_CONNECTION_COMPLETE; |
754 const ProxyServer& proxy_server = proxy_info_.proxy_server(); | 761 bool secure_quic = using_ssl_ || proxy_info_.is_quic(); |
755 int rv = quic_request_.Request(HostPortProxyPair(origin_, proxy_server), | 762 int rv = quic_request_.Request( |
756 using_ssl_, session_->cert_verifier(), | 763 destination, secure_quic, session_->cert_verifier(), net_log_, |
757 net_log_, io_callback_); | 764 io_callback_); |
758 if (rv != OK) { | 765 if (rv != OK) { |
759 // OK, there's no available QUIC session. Let |waiting_job_| resume | 766 // OK, there's no available QUIC session. Let |waiting_job_| resume |
760 // if it's paused. | 767 // if it's paused. |
761 if (waiting_job_) { | 768 if (waiting_job_) { |
762 waiting_job_->Resume(this); | 769 waiting_job_->Resume(this); |
763 waiting_job_ = NULL; | 770 waiting_job_ = NULL; |
764 } | 771 } |
765 } | 772 } |
766 return rv; | 773 return rv; |
767 } | 774 } |
(...skipping 701 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1469 (net::LOAD_MAIN_FRAME | net::LOAD_SUB_FRAME | net::LOAD_PREFETCH | | 1476 (net::LOAD_MAIN_FRAME | net::LOAD_SUB_FRAME | net::LOAD_PREFETCH | |
1470 net::LOAD_IS_DOWNLOAD)) { | 1477 net::LOAD_IS_DOWNLOAD)) { |
1471 // Avoid pipelining resources that may be streamed for a long time. | 1478 // Avoid pipelining resources that may be streamed for a long time. |
1472 return false; | 1479 return false; |
1473 } | 1480 } |
1474 return stream_factory_->http_pipelined_host_pool_.IsKeyEligibleForPipelining( | 1481 return stream_factory_->http_pipelined_host_pool_.IsKeyEligibleForPipelining( |
1475 *http_pipelining_key_.get()); | 1482 *http_pipelining_key_.get()); |
1476 } | 1483 } |
1477 | 1484 |
1478 } // namespace net | 1485 } // namespace net |
OLD | NEW |