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

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: Added comment 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
« no previous file with comments | « net/http/http_network_session.cc ('k') | net/http/http_stream_factory_impl_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 653 matching lines...) Expand 10 before | Expand all | Expand 10 after
664 return session_->proxy_service()->ResolveProxy( 664 return session_->proxy_service()->ResolveProxy(
665 request_info_.url, request_info_.load_flags, &proxy_info_, io_callback_, 665 request_info_.url, request_info_.load_flags, &proxy_info_, io_callback_,
666 &pac_request_, session_->network_delegate(), net_log_); 666 &pac_request_, session_->network_delegate(), net_log_);
667 } 667 }
668 668
669 int HttpStreamFactoryImpl::Job::DoResolveProxyComplete(int result) { 669 int HttpStreamFactoryImpl::Job::DoResolveProxyComplete(int result) {
670 pac_request_ = NULL; 670 pac_request_ = NULL;
671 671
672 if (result == OK) { 672 if (result == OK) {
673 // Remove unsupported proxies from the list. 673 // Remove unsupported proxies from the list.
674 proxy_info_.RemoveProxiesWithoutScheme( 674 int supported_proxies =
675 ProxyServer::SCHEME_DIRECT | ProxyServer::SCHEME_QUIC | 675 ProxyServer::SCHEME_DIRECT | ProxyServer::SCHEME_HTTP |
676 ProxyServer::SCHEME_HTTP | ProxyServer::SCHEME_HTTPS | 676 ProxyServer::SCHEME_HTTPS | ProxyServer::SCHEME_SOCKS4 |
677 ProxyServer::SCHEME_SOCKS4 | ProxyServer::SCHEME_SOCKS5); 677 ProxyServer::SCHEME_SOCKS5;
678
679 if (session_->params().enable_quic_for_proxies)
680 supported_proxies |= ProxyServer::SCHEME_QUIC;
681
682 proxy_info_.RemoveProxiesWithoutScheme(supported_proxies);
678 683
679 if (proxy_info_.is_empty()) { 684 if (proxy_info_.is_empty()) {
680 // No proxies/direct to choose from. This happens when we don't support 685 // No proxies/direct to choose from. This happens when we don't support
681 // any of the proxies in the returned list. 686 // any of the proxies in the returned list.
682 result = ERR_NO_SUPPORTED_PROXIES; 687 result = ERR_NO_SUPPORTED_PROXIES;
683 } else if (using_quic_ && 688 } else if (using_quic_ &&
684 (!proxy_info_.is_quic() && !proxy_info_.is_direct())) { 689 (!proxy_info_.is_quic() && !proxy_info_.is_direct())) {
685 // QUIC can not be spoken to non-QUIC proxies. This error should not be 690 // 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. 691 // user visible, because the non-alternate job should be resumed.
687 result = ERR_NO_SUPPORTED_PROXIES; 692 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()); 745 DCHECK(proxy_info_.proxy_server().is_valid());
741 next_state_ = STATE_INIT_CONNECTION_COMPLETE; 746 next_state_ = STATE_INIT_CONNECTION_COMPLETE;
742 747
743 using_ssl_ = request_info_.url.SchemeIs("https") || 748 using_ssl_ = request_info_.url.SchemeIs("https") ||
744 request_info_.url.SchemeIs("wss") || ShouldForceSpdySSL(); 749 request_info_.url.SchemeIs("wss") || ShouldForceSpdySSL();
745 using_spdy_ = false; 750 using_spdy_ = false;
746 751
747 if (ShouldForceQuic()) 752 if (ShouldForceQuic())
748 using_quic_ = true; 753 using_quic_ = true;
749 754
750 if (proxy_info_.is_quic()) 755 DCHECK(!using_quic_ || session_->params().enable_quic);
756
757 if (proxy_info_.is_quic()) {
751 using_quic_ = true; 758 using_quic_ = true;
759 DCHECK(session_->params().enable_quic_for_proxies);
760 }
752 761
753 if (using_quic_) { 762 if (using_quic_) {
754 DCHECK(session_->params().enable_quic);
755 if (proxy_info_.is_quic() && !request_info_.url.SchemeIs("http")) { 763 if (proxy_info_.is_quic() && !request_info_.url.SchemeIs("http")) {
756 NOTREACHED(); 764 NOTREACHED();
757 // TODO(rch): support QUIC proxies for HTTPS urls. 765 // TODO(rch): support QUIC proxies for HTTPS urls.
758 return ERR_NOT_IMPLEMENTED; 766 return ERR_NOT_IMPLEMENTED;
759 } 767 }
760 HostPortPair destination = proxy_info_.is_quic() ? 768 HostPortPair destination = proxy_info_.is_quic() ?
761 proxy_info_.proxy_server().host_port_pair() : origin_; 769 proxy_info_.proxy_server().host_port_pair() : origin_;
762 next_state_ = STATE_INIT_CONNECTION_COMPLETE; 770 next_state_ = STATE_INIT_CONNECTION_COMPLETE;
763 bool secure_quic = using_ssl_ || proxy_info_.is_quic(); 771 bool secure_quic = using_ssl_ || proxy_info_.is_quic();
764 int rv = quic_request_.Request( 772 int rv = quic_request_.Request(
(...skipping 725 matching lines...) Expand 10 before | Expand all | Expand 10 after
1490 1498
1491 if (job_status_ == STATUS_SUCCEEDED && other_job_status_ == STATUS_BROKEN) { 1499 if (job_status_ == STATUS_SUCCEEDED && other_job_status_ == STATUS_BROKEN) {
1492 HistogramBrokenAlternateProtocolLocation( 1500 HistogramBrokenAlternateProtocolLocation(
1493 BROKEN_ALTERNATE_PROTOCOL_LOCATION_HTTP_STREAM_FACTORY_IMPL_JOB_MAIN); 1501 BROKEN_ALTERNATE_PROTOCOL_LOCATION_HTTP_STREAM_FACTORY_IMPL_JOB_MAIN);
1494 session_->http_server_properties()->SetBrokenAlternateProtocol( 1502 session_->http_server_properties()->SetBrokenAlternateProtocol(
1495 HostPortPair::FromURL(request_info_.url)); 1503 HostPortPair::FromURL(request_info_.url));
1496 } 1504 }
1497 } 1505 }
1498 1506
1499 } // namespace net 1507 } // namespace net
OLDNEW
« no previous file with comments | « net/http/http_network_session.cc ('k') | net/http/http_stream_factory_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698