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

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

Issue 1393713003: Remove insecure QUIC support from Chromium. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Cleanup Created 5 years, 2 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 754 matching lines...) Expand 10 before | Expand all | Expand 10 after
765 if (blocking_job_) 765 if (blocking_job_)
766 next_state_ = STATE_WAIT_FOR_JOB; 766 next_state_ = STATE_WAIT_FOR_JOB;
767 else 767 else
768 next_state_ = STATE_INIT_CONNECTION; 768 next_state_ = STATE_INIT_CONNECTION;
769 return OK; 769 return OK;
770 } 770 }
771 771
772 bool HttpStreamFactoryImpl::Job::ShouldForceQuic() const { 772 bool HttpStreamFactoryImpl::Job::ShouldForceQuic() const {
773 return session_->params().enable_quic && 773 return session_->params().enable_quic &&
774 session_->params().origin_to_force_quic_on.Equals(server_) && 774 session_->params().origin_to_force_quic_on.Equals(server_) &&
775 proxy_info_.is_direct(); 775 proxy_info_.is_direct() && origin_url_.SchemeIs("https");
776 } 776 }
777 777
778 int HttpStreamFactoryImpl::Job::DoWaitForJob() { 778 int HttpStreamFactoryImpl::Job::DoWaitForJob() {
779 DCHECK(blocking_job_); 779 DCHECK(blocking_job_);
780 next_state_ = STATE_WAIT_FOR_JOB_COMPLETE; 780 next_state_ = STATE_WAIT_FOR_JOB_COMPLETE;
781 return ERR_IO_PENDING; 781 return ERR_IO_PENDING;
782 } 782 }
783 783
784 int HttpStreamFactoryImpl::Job::DoWaitForJobComplete(int result) { 784 int HttpStreamFactoryImpl::Job::DoWaitForJobComplete(int result) {
785 DCHECK(!blocking_job_); 785 DCHECK(!blocking_job_);
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
824 } 824 }
825 825
826 if (using_quic_) { 826 if (using_quic_) {
827 if (proxy_info_.is_quic() && !request_info_.url.SchemeIs("http")) { 827 if (proxy_info_.is_quic() && !request_info_.url.SchemeIs("http")) {
828 NOTREACHED(); 828 NOTREACHED();
829 // TODO(rch): support QUIC proxies for HTTPS urls. 829 // TODO(rch): support QUIC proxies for HTTPS urls.
830 return ERR_NOT_IMPLEMENTED; 830 return ERR_NOT_IMPLEMENTED;
831 } 831 }
832 HostPortPair destination; 832 HostPortPair destination;
833 std::string origin_host; 833 std::string origin_host;
834 bool secure_quic;
835 SSLConfig* ssl_config; 834 SSLConfig* ssl_config;
836 if (proxy_info_.is_quic()) { 835 if (proxy_info_.is_quic()) {
837 // A proxy's certificate is expected to be valid for the proxy hostname. 836 // A proxy's certificate is expected to be valid for the proxy hostname.
838 destination = proxy_info_.proxy_server().host_port_pair(); 837 destination = proxy_info_.proxy_server().host_port_pair();
839 origin_host = destination.host(); 838 origin_host = destination.host();
840 secure_quic = true;
841 ssl_config = &proxy_ssl_config_; 839 ssl_config = &proxy_ssl_config_;
842 840
843 // If QUIC is disabled on the destination port, return error. 841 // If QUIC is disabled on the destination port, return error.
844 if (session_->quic_stream_factory()->IsQuicDisabled(destination.port())) 842 if (session_->quic_stream_factory()->IsQuicDisabled(destination.port()))
845 return ERR_QUIC_PROTOCOL_ERROR; 843 return ERR_QUIC_PROTOCOL_ERROR;
846 } else { 844 } else {
845 DCHECK(using_ssl_);
847 // The certificate of a QUIC alternative server is expected to be valid 846 // The certificate of a QUIC alternative server is expected to be valid
848 // for the origin of the request (in addition to being valid for the 847 // for the origin of the request (in addition to being valid for the
849 // server itself). 848 // server itself).
850 destination = server_; 849 destination = server_;
851 origin_host = origin_url_.host(); 850 origin_host = origin_url_.host();
852 secure_quic = using_ssl_;
853 ssl_config = &server_ssl_config_; 851 ssl_config = &server_ssl_config_;
854 } 852 }
855 int rv = quic_request_.Request( 853 int rv =
856 destination, secure_quic, request_info_.privacy_mode, 854 quic_request_.Request(destination, request_info_.privacy_mode,
857 ssl_config->GetCertVerifyFlags(), origin_host, request_info_.method, 855 ssl_config->GetCertVerifyFlags(), origin_host,
858 net_log_, io_callback_); 856 request_info_.method, net_log_, io_callback_);
859 if (rv == OK) { 857 if (rv == OK) {
860 using_existing_quic_session_ = true; 858 using_existing_quic_session_ = true;
861 } else { 859 } else {
862 // OK, there's no available QUIC session. Let |waiting_job_| resume 860 // OK, there's no available QUIC session. Let |waiting_job_| resume
863 // if it's paused. 861 // if it's paused.
864 if (waiting_job_) { 862 if (waiting_job_) {
865 if (rv == ERR_IO_PENDING) { 863 if (rv == ERR_IO_PENDING) {
866 // Start the |waiting_job_| after the delay returned by 864 // Start the |waiting_job_| after the delay returned by
867 // GetTimeDelayForWaitingJob(). 865 // GetTimeDelayForWaitingJob().
868 // 866 //
(...skipping 733 matching lines...) Expand 10 before | Expand all | Expand 10 after
1602 if (connection_->socket()) { 1600 if (connection_->socket()) {
1603 ConnectionAttempts socket_attempts; 1601 ConnectionAttempts socket_attempts;
1604 connection_->socket()->GetConnectionAttempts(&socket_attempts); 1602 connection_->socket()->GetConnectionAttempts(&socket_attempts);
1605 request_->AddConnectionAttempts(socket_attempts); 1603 request_->AddConnectionAttempts(socket_attempts);
1606 } else { 1604 } else {
1607 request_->AddConnectionAttempts(connection_->connection_attempts()); 1605 request_->AddConnectionAttempts(connection_->connection_attempts());
1608 } 1606 }
1609 } 1607 }
1610 1608
1611 } // namespace net 1609 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698