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 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
84 connection_(new ClientSocketHandle), | 84 connection_(new ClientSocketHandle), |
85 session_(session), | 85 session_(session), |
86 stream_factory_(stream_factory), | 86 stream_factory_(stream_factory), |
87 next_state_(STATE_NONE), | 87 next_state_(STATE_NONE), |
88 pac_request_(NULL), | 88 pac_request_(NULL), |
89 blocking_job_(NULL), | 89 blocking_job_(NULL), |
90 waiting_job_(NULL), | 90 waiting_job_(NULL), |
91 using_ssl_(false), | 91 using_ssl_(false), |
92 using_spdy_(false), | 92 using_spdy_(false), |
93 using_quic_(false), | 93 using_quic_(false), |
94 using_quic_proxy_(false), | |
94 quic_request_(session_->quic_stream_factory()), | 95 quic_request_(session_->quic_stream_factory()), |
95 using_existing_quic_session_(false), | 96 using_existing_quic_session_(false), |
96 spdy_certificate_error_(OK), | 97 spdy_certificate_error_(OK), |
97 establishing_tunnel_(false), | 98 establishing_tunnel_(false), |
98 was_npn_negotiated_(false), | 99 was_npn_negotiated_(false), |
99 protocol_negotiated_(kProtoUnknown), | 100 protocol_negotiated_(kProtoUnknown), |
100 num_streams_(0), | 101 num_streams_(0), |
101 spdy_session_direct_(false), | 102 spdy_session_direct_(false), |
102 job_status_(STATUS_RUNNING), | 103 job_status_(STATUS_RUNNING), |
103 other_job_status_(STATUS_RUNNING), | 104 other_job_status_(STATUS_RUNNING), |
(...skipping 560 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
664 return session_->proxy_service()->ResolveProxy( | 665 return session_->proxy_service()->ResolveProxy( |
665 request_info_.url, request_info_.load_flags, &proxy_info_, io_callback_, | 666 request_info_.url, request_info_.load_flags, &proxy_info_, io_callback_, |
666 &pac_request_, session_->network_delegate(), net_log_); | 667 &pac_request_, session_->network_delegate(), net_log_); |
667 } | 668 } |
668 | 669 |
669 int HttpStreamFactoryImpl::Job::DoResolveProxyComplete(int result) { | 670 int HttpStreamFactoryImpl::Job::DoResolveProxyComplete(int result) { |
670 pac_request_ = NULL; | 671 pac_request_ = NULL; |
671 | 672 |
672 if (result == OK) { | 673 if (result == OK) { |
673 // Remove unsupported proxies from the list. | 674 // Remove unsupported proxies from the list. |
674 proxy_info_.RemoveProxiesWithoutScheme( | 675 int supported_proxies = |
675 ProxyServer::SCHEME_DIRECT | ProxyServer::SCHEME_QUIC | | 676 ProxyServer::SCHEME_DIRECT | ProxyServer::SCHEME_HTTP | |
676 ProxyServer::SCHEME_HTTP | ProxyServer::SCHEME_HTTPS | | 677 ProxyServer::SCHEME_HTTPS | ProxyServer::SCHEME_SOCKS4 | |
677 ProxyServer::SCHEME_SOCKS4 | ProxyServer::SCHEME_SOCKS5); | 678 ProxyServer::SCHEME_SOCKS5; |
679 | |
680 if (session_->params().enable_quic_for_proxies) | |
681 supported_proxies |= ProxyServer::SCHEME_QUIC; | |
682 | |
683 proxy_info_.RemoveProxiesWithoutScheme(supported_proxies); | |
678 | 684 |
679 if (proxy_info_.is_empty()) { | 685 if (proxy_info_.is_empty()) { |
680 // No proxies/direct to choose from. This happens when we don't support | 686 // No proxies/direct to choose from. This happens when we don't support |
681 // any of the proxies in the returned list. | 687 // any of the proxies in the returned list. |
682 result = ERR_NO_SUPPORTED_PROXIES; | 688 result = ERR_NO_SUPPORTED_PROXIES; |
683 } else if (using_quic_ && | 689 } else if (using_quic_ && |
684 (!proxy_info_.is_quic() && !proxy_info_.is_direct())) { | 690 (!proxy_info_.is_quic() && !proxy_info_.is_direct())) { |
685 // QUIC can not be spoken to non-QUIC proxies. This error should not be | 691 // QUIC can not be spoken to non-QUIC proxies. This error should not be |
686 // user visible, because the non-alternate job should be resumed. | 692 // user visible, because the non-alternate job should be resumed. |
687 result = ERR_NO_SUPPORTED_PROXIES; | 693 result = ERR_NO_SUPPORTED_PROXIES; |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
740 DCHECK(proxy_info_.proxy_server().is_valid()); | 746 DCHECK(proxy_info_.proxy_server().is_valid()); |
741 next_state_ = STATE_INIT_CONNECTION_COMPLETE; | 747 next_state_ = STATE_INIT_CONNECTION_COMPLETE; |
742 | 748 |
743 using_ssl_ = request_info_.url.SchemeIs("https") || | 749 using_ssl_ = request_info_.url.SchemeIs("https") || |
744 request_info_.url.SchemeIs("wss") || ShouldForceSpdySSL(); | 750 request_info_.url.SchemeIs("wss") || ShouldForceSpdySSL(); |
745 using_spdy_ = false; | 751 using_spdy_ = false; |
746 | 752 |
747 if (ShouldForceQuic()) | 753 if (ShouldForceQuic()) |
748 using_quic_ = true; | 754 using_quic_ = true; |
749 | 755 |
750 if (proxy_info_.is_quic()) | 756 DCHECK(!using_quic_ || session_->params().enable_quic); |
757 | |
758 if (proxy_info_.is_quic()) { | |
751 using_quic_ = true; | 759 using_quic_ = true; |
760 using_quic_proxy_ = true; | |
Ryan Hamilton
2015/02/17 02:53:55
Is this member read anywhere? If not, can you remo
tbansal1
2015/02/17 17:27:49
Done.
| |
761 DCHECK(session_->params().enable_quic_for_proxies); | |
762 } | |
752 | 763 |
753 if (using_quic_) { | 764 if (using_quic_) { |
754 DCHECK(session_->params().enable_quic); | |
755 if (proxy_info_.is_quic() && !request_info_.url.SchemeIs("http")) { | 765 if (proxy_info_.is_quic() && !request_info_.url.SchemeIs("http")) { |
756 NOTREACHED(); | 766 NOTREACHED(); |
757 // TODO(rch): support QUIC proxies for HTTPS urls. | 767 // TODO(rch): support QUIC proxies for HTTPS urls. |
758 return ERR_NOT_IMPLEMENTED; | 768 return ERR_NOT_IMPLEMENTED; |
759 } | 769 } |
760 HostPortPair destination = proxy_info_.is_quic() ? | 770 HostPortPair destination = proxy_info_.is_quic() ? |
761 proxy_info_.proxy_server().host_port_pair() : origin_; | 771 proxy_info_.proxy_server().host_port_pair() : origin_; |
762 next_state_ = STATE_INIT_CONNECTION_COMPLETE; | 772 next_state_ = STATE_INIT_CONNECTION_COMPLETE; |
763 bool secure_quic = using_ssl_ || proxy_info_.is_quic(); | 773 bool secure_quic = using_ssl_ || proxy_info_.is_quic(); |
764 int rv = quic_request_.Request( | 774 int rv = quic_request_.Request( |
(...skipping 716 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1481 | 1491 |
1482 if (job_status_ == STATUS_SUCCEEDED && other_job_status_ == STATUS_BROKEN) { | 1492 if (job_status_ == STATUS_SUCCEEDED && other_job_status_ == STATUS_BROKEN) { |
1483 HistogramBrokenAlternateProtocolLocation( | 1493 HistogramBrokenAlternateProtocolLocation( |
1484 BROKEN_ALTERNATE_PROTOCOL_LOCATION_HTTP_STREAM_FACTORY_IMPL_JOB_MAIN); | 1494 BROKEN_ALTERNATE_PROTOCOL_LOCATION_HTTP_STREAM_FACTORY_IMPL_JOB_MAIN); |
1485 session_->http_server_properties()->SetBrokenAlternateProtocol( | 1495 session_->http_server_properties()->SetBrokenAlternateProtocol( |
1486 HostPortPair::FromURL(request_info_.url)); | 1496 HostPortPair::FromURL(request_info_.url)); |
1487 } | 1497 } |
1488 } | 1498 } |
1489 | 1499 |
1490 } // namespace net | 1500 } // namespace net |
OLD | NEW |