Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(76)

Side by Side Diff: net/http/http_stream_factory_impl_job.cc

Issue 903213003: Enable QUIC for proxies based on Finch config and command line switch. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed comments, added more tests Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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
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
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 if (using_quic_)
757 DCHECK(session_->params().enable_quic);
758
759 if (proxy_info_.is_quic()) {
751 using_quic_ = true; 760 using_quic_ = true;
761 using_quic_proxy_ = true;
762 }
752 763
753 if (using_quic_) { 764 if (using_quic_) {
754 DCHECK(session_->params().enable_quic); 765 if (using_quic_proxy_)
766 DCHECK(session_->params().enable_quic_for_proxies);
Ryan Hamilton 2015/02/11 00:20:32 Is this the only place using_quic_proxy_ is used?
tbansal1 2015/02/11 01:25:26 Done.
767
755 if (proxy_info_.is_quic() && !request_info_.url.SchemeIs("http")) { 768 if (proxy_info_.is_quic() && !request_info_.url.SchemeIs("http")) {
756 NOTREACHED(); 769 NOTREACHED();
757 // TODO(rch): support QUIC proxies for HTTPS urls. 770 // TODO(rch): support QUIC proxies for HTTPS urls.
758 return ERR_NOT_IMPLEMENTED; 771 return ERR_NOT_IMPLEMENTED;
759 } 772 }
760 HostPortPair destination = proxy_info_.is_quic() ? 773 HostPortPair destination = proxy_info_.is_quic() ?
761 proxy_info_.proxy_server().host_port_pair() : origin_; 774 proxy_info_.proxy_server().host_port_pair() : origin_;
762 next_state_ = STATE_INIT_CONNECTION_COMPLETE; 775 next_state_ = STATE_INIT_CONNECTION_COMPLETE;
763 bool secure_quic = using_ssl_ || proxy_info_.is_quic(); 776 bool secure_quic = using_ssl_ || proxy_info_.is_quic();
764 int rv = quic_request_.Request( 777 int rv = quic_request_.Request(
(...skipping 716 matching lines...) Expand 10 before | Expand all | Expand 10 after
1481 1494
1482 if (job_status_ == STATUS_SUCCEEDED && other_job_status_ == STATUS_BROKEN) { 1495 if (job_status_ == STATUS_SUCCEEDED && other_job_status_ == STATUS_BROKEN) {
1483 HistogramBrokenAlternateProtocolLocation( 1496 HistogramBrokenAlternateProtocolLocation(
1484 BROKEN_ALTERNATE_PROTOCOL_LOCATION_HTTP_STREAM_FACTORY_IMPL_JOB_MAIN); 1497 BROKEN_ALTERNATE_PROTOCOL_LOCATION_HTTP_STREAM_FACTORY_IMPL_JOB_MAIN);
1485 session_->http_server_properties()->SetBrokenAlternateProtocol( 1498 session_->http_server_properties()->SetBrokenAlternateProtocol(
1486 HostPortPair::FromURL(request_info_.url)); 1499 HostPortPair::FromURL(request_info_.url));
1487 } 1500 }
1488 } 1501 }
1489 1502
1490 } // namespace net 1503 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698