| 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" |
| 11 #include "base/bind_helpers.h" | 11 #include "base/bind_helpers.h" |
| 12 #include "base/logging.h" | 12 #include "base/logging.h" |
| 13 #include "base/metrics/histogram_macros.h" | 13 #include "base/metrics/histogram_macros.h" |
| 14 #include "base/profiler/scoped_tracker.h" | 14 #include "base/profiler/scoped_tracker.h" |
| 15 #include "base/stl_util.h" | 15 #include "base/stl_util.h" |
| 16 #include "base/strings/string_number_conversions.h" |
| 16 #include "base/strings/string_util.h" | 17 #include "base/strings/string_util.h" |
| 17 #include "base/strings/stringprintf.h" | 18 #include "base/strings/stringprintf.h" |
| 18 #include "base/values.h" | 19 #include "base/values.h" |
| 19 #include "build/build_config.h" | 20 #include "build/build_config.h" |
| 20 #include "net/base/connection_type_histograms.h" | 21 #include "net/base/connection_type_histograms.h" |
| 21 #include "net/base/net_util.h" | 22 #include "net/base/net_util.h" |
| 22 #include "net/http/http_basic_stream.h" | 23 #include "net/http/http_basic_stream.h" |
| 23 #include "net/http/http_network_session.h" | 24 #include "net/http/http_network_session.h" |
| 24 #include "net/http/http_proxy_client_socket.h" | 25 #include "net/http/http_proxy_client_socket.h" |
| 25 #include "net/http/http_proxy_client_socket_pool.h" | 26 #include "net/http/http_proxy_client_socket_pool.h" |
| (...skipping 12 matching lines...) Expand all Loading... |
| 38 #include "net/spdy/spdy_http_stream.h" | 39 #include "net/spdy/spdy_http_stream.h" |
| 39 #include "net/spdy/spdy_session.h" | 40 #include "net/spdy/spdy_session.h" |
| 40 #include "net/spdy/spdy_session_pool.h" | 41 #include "net/spdy/spdy_session_pool.h" |
| 41 #include "net/ssl/ssl_cert_request_info.h" | 42 #include "net/ssl/ssl_cert_request_info.h" |
| 42 | 43 |
| 43 namespace net { | 44 namespace net { |
| 44 | 45 |
| 45 // Returns parameters associated with the start of a HTTP stream job. | 46 // Returns parameters associated with the start of a HTTP stream job. |
| 46 base::Value* NetLogHttpStreamJobCallback(const GURL* original_url, | 47 base::Value* NetLogHttpStreamJobCallback(const GURL* original_url, |
| 47 const GURL* url, | 48 const GURL* url, |
| 49 const GURL* alternate_url, |
| 48 RequestPriority priority, | 50 RequestPriority priority, |
| 49 NetLog::LogLevel /* log_level */) { | 51 NetLog::LogLevel /* log_level */) { |
| 50 base::DictionaryValue* dict = new base::DictionaryValue(); | 52 base::DictionaryValue* dict = new base::DictionaryValue(); |
| 51 dict->SetString("original_url", original_url->GetOrigin().spec()); | 53 dict->SetString("original_url", original_url->GetOrigin().spec()); |
| 52 dict->SetString("url", url->GetOrigin().spec()); | 54 dict->SetString("url", url->GetOrigin().spec()); |
| 55 dict->SetString("alternate_service_url", alternate_url->GetOrigin().spec()); |
| 53 dict->SetString("priority", RequestPriorityToString(priority)); | 56 dict->SetString("priority", RequestPriorityToString(priority)); |
| 54 return dict; | 57 return dict; |
| 55 } | 58 } |
| 56 | 59 |
| 57 // Returns parameters associated with the Proto (with NPN negotiation) of a HTTP | 60 // Returns parameters associated with the Proto (with NPN negotiation) of a HTTP |
| 58 // stream. | 61 // stream. |
| 59 base::Value* NetLogHttpStreamProtoCallback( | 62 base::Value* NetLogHttpStreamProtoCallback( |
| 60 const SSLClientSocket::NextProtoStatus status, | 63 const SSLClientSocket::NextProtoStatus status, |
| 61 const std::string* proto, | 64 const std::string* proto, |
| 62 NetLog::LogLevel /* log_level */) { | 65 NetLog::LogLevel /* log_level */) { |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 160 return session_->proxy_service()->GetLoadState(pac_request_); | 163 return session_->proxy_service()->GetLoadState(pac_request_); |
| 161 case STATE_INIT_CONNECTION_COMPLETE: | 164 case STATE_INIT_CONNECTION_COMPLETE: |
| 162 case STATE_CREATE_STREAM_COMPLETE: | 165 case STATE_CREATE_STREAM_COMPLETE: |
| 163 return using_quic_ ? LOAD_STATE_CONNECTING : connection_->GetLoadState(); | 166 return using_quic_ ? LOAD_STATE_CONNECTING : connection_->GetLoadState(); |
| 164 default: | 167 default: |
| 165 return LOAD_STATE_IDLE; | 168 return LOAD_STATE_IDLE; |
| 166 } | 169 } |
| 167 } | 170 } |
| 168 | 171 |
| 169 void HttpStreamFactoryImpl::Job::MarkAsAlternate( | 172 void HttpStreamFactoryImpl::Job::MarkAsAlternate( |
| 170 const GURL& original_url, | |
| 171 AlternativeService alternative_service) { | 173 AlternativeService alternative_service) { |
| 172 DCHECK(!IsAlternate()); | 174 DCHECK(!IsAlternate()); |
| 173 original_url_ = original_url; | |
| 174 alternative_service_ = alternative_service; | 175 alternative_service_ = alternative_service; |
| 175 if (alternative_service.protocol == QUIC) { | 176 if (alternative_service.protocol == QUIC) { |
| 176 DCHECK(session_->params().enable_quic); | 177 DCHECK(session_->params().enable_quic); |
| 177 using_quic_ = true; | 178 using_quic_ = true; |
| 178 } | 179 } |
| 179 } | 180 } |
| 180 | 181 |
| 181 void HttpStreamFactoryImpl::Job::WaitFor(Job* job) { | 182 void HttpStreamFactoryImpl::Job::WaitFor(Job* job) { |
| 182 DCHECK_EQ(STATE_NONE, next_state_); | 183 DCHECK_EQ(STATE_NONE, next_state_); |
| 183 DCHECK_EQ(STATE_NONE, job->next_state_); | 184 DCHECK_EQ(STATE_NONE, job->next_state_); |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 279 } | 280 } |
| 280 | 281 |
| 281 bool HttpStreamFactoryImpl::Job::CanUseExistingSpdySession() const { | 282 bool HttpStreamFactoryImpl::Job::CanUseExistingSpdySession() const { |
| 282 // We need to make sure that if a spdy session was created for | 283 // We need to make sure that if a spdy session was created for |
| 283 // https://somehost/ that we don't use that session for http://somehost:443/. | 284 // https://somehost/ that we don't use that session for http://somehost:443/. |
| 284 // The only time we can use an existing session is if the request URL is | 285 // The only time we can use an existing session is if the request URL is |
| 285 // https (the normal case) or if we're connection to a SPDY proxy, or | 286 // https (the normal case) or if we're connection to a SPDY proxy, or |
| 286 // if we're running with force_spdy_always_. crbug.com/133176 | 287 // if we're running with force_spdy_always_. crbug.com/133176 |
| 287 // TODO(ricea): Add "wss" back to this list when SPDY WebSocket support is | 288 // TODO(ricea): Add "wss" back to this list when SPDY WebSocket support is |
| 288 // working. | 289 // working. |
| 289 return request_info_.url.SchemeIs("https") || | 290 return alternative_service_url_.SchemeIs("https") || |
| 290 proxy_info_.proxy_server().is_https() || | 291 proxy_info_.proxy_server().is_https() || |
| 291 session_->params().force_spdy_always; | 292 session_->params().force_spdy_always; |
| 292 } | 293 } |
| 293 | 294 |
| 294 void HttpStreamFactoryImpl::Job::OnStreamReadyCallback() { | 295 void HttpStreamFactoryImpl::Job::OnStreamReadyCallback() { |
| 295 DCHECK(stream_.get()); | 296 DCHECK(stream_.get()); |
| 296 DCHECK(!IsPreconnecting()); | 297 DCHECK(!IsPreconnecting()); |
| 297 DCHECK(!stream_factory_->for_websockets_); | 298 DCHECK(!stream_factory_->for_websockets_); |
| 298 if (IsOrphaned()) { | 299 if (IsOrphaned()) { |
| 299 stream_factory_->OnOrphanedJobComplete(this); | 300 stream_factory_->OnOrphanedJobComplete(this); |
| (...skipping 315 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 615 } | 616 } |
| 616 | 617 |
| 617 int HttpStreamFactoryImpl::Job::DoStart() { | 618 int HttpStreamFactoryImpl::Job::DoStart() { |
| 618 if (IsAlternate()) { | 619 if (IsAlternate()) { |
| 619 server_ = alternative_service_.host_port_pair(); | 620 server_ = alternative_service_.host_port_pair(); |
| 620 } else { | 621 } else { |
| 621 server_ = HostPortPair::FromURL(request_info_.url); | 622 server_ = HostPortPair::FromURL(request_info_.url); |
| 622 } | 623 } |
| 623 origin_url_ = | 624 origin_url_ = |
| 624 stream_factory_->ApplyHostMappingRules(request_info_.url, &server_); | 625 stream_factory_->ApplyHostMappingRules(request_info_.url, &server_); |
| 626 alternative_service_url_ = origin_url_; |
| 627 // For SPDY via Alt-Svc, set |alternative_service_url_| to |
| 628 // https://<alternative host>:<alternative port>/... |
| 629 // so the proxy resolution works with the actual destination, and so |
| 630 // that the correct socket pool is used. |
| 631 // TODO(rch): change the socket pool API to not require a full URL. |
| 632 if (alternative_service_.protocol >= NPN_SPDY_MINIMUM_VERSION && |
| 633 alternative_service_.protocol <= NPN_SPDY_MAXIMUM_VERSION) { |
| 634 // TODO(rch): Figure out how to make QUIC iteract with PAC |
| 635 // scripts. By not re-writing the URL, we will query the PAC script |
| 636 // for the proxy to use to reach the original URL via TCP. But |
| 637 // the alternate request will be going via UDP to a different port. |
| 638 GURL::Replacements replacements; |
| 639 // new_port needs to be in scope here because GURL::Replacements references |
| 640 // the memory contained by it directly. |
| 641 const std::string new_port = base::IntToString(alternative_service_.port); |
| 642 replacements.SetSchemeStr("https"); |
| 643 replacements.SetPortStr(new_port); |
| 644 alternative_service_url_ = |
| 645 alternative_service_url_.ReplaceComponents(replacements); |
| 646 } |
| 625 | 647 |
| 626 net_log_.BeginEvent(NetLog::TYPE_HTTP_STREAM_JOB, | 648 net_log_.BeginEvent( |
| 627 base::Bind(&NetLogHttpStreamJobCallback, | 649 NetLog::TYPE_HTTP_STREAM_JOB, |
| 628 &request_info_.url, &origin_url_, | 650 base::Bind(&NetLogHttpStreamJobCallback, &request_info_.url, &origin_url_, |
| 629 priority_)); | 651 &alternative_service_url_, priority_)); |
| 630 | 652 |
| 631 // Don't connect to restricted ports. | 653 // Don't connect to restricted ports. |
| 632 bool is_port_allowed = IsPortAllowedByDefault(server_.port()); | 654 bool is_port_allowed = IsPortAllowedByDefault(server_.port()); |
| 633 if (request_info_.url.SchemeIs("ftp")) { | 655 if (request_info_.url.SchemeIs("ftp")) { |
| 634 // Never share connection with other jobs for FTP requests. | 656 // Never share connection with other jobs for FTP requests. |
| 635 DCHECK(!waiting_job_); | 657 DCHECK(!waiting_job_); |
| 636 | 658 |
| 637 is_port_allowed = IsPortAllowedByFtp(server_.port()); | 659 is_port_allowed = IsPortAllowedByFtp(server_.port()); |
| 638 } | 660 } |
| 639 if (!is_port_allowed && !IsPortAllowedByOverride(server_.port())) { | 661 if (!is_port_allowed && !IsPortAllowedByOverride(server_.port())) { |
| (...skipping 13 matching lines...) Expand all Loading... |
| 653 DCHECK(session_); | 675 DCHECK(session_); |
| 654 | 676 |
| 655 next_state_ = STATE_RESOLVE_PROXY_COMPLETE; | 677 next_state_ = STATE_RESOLVE_PROXY_COMPLETE; |
| 656 | 678 |
| 657 if (request_info_.load_flags & LOAD_BYPASS_PROXY) { | 679 if (request_info_.load_flags & LOAD_BYPASS_PROXY) { |
| 658 proxy_info_.UseDirect(); | 680 proxy_info_.UseDirect(); |
| 659 return OK; | 681 return OK; |
| 660 } | 682 } |
| 661 | 683 |
| 662 return session_->proxy_service()->ResolveProxy( | 684 return session_->proxy_service()->ResolveProxy( |
| 663 request_info_.url, request_info_.load_flags, &proxy_info_, io_callback_, | 685 alternative_service_url_, request_info_.load_flags, &proxy_info_, |
| 664 &pac_request_, session_->network_delegate(), net_log_); | 686 io_callback_, &pac_request_, session_->network_delegate(), net_log_); |
| 665 } | 687 } |
| 666 | 688 |
| 667 int HttpStreamFactoryImpl::Job::DoResolveProxyComplete(int result) { | 689 int HttpStreamFactoryImpl::Job::DoResolveProxyComplete(int result) { |
| 668 pac_request_ = NULL; | 690 pac_request_ = NULL; |
| 669 | 691 |
| 670 if (result == OK) { | 692 if (result == OK) { |
| 671 // Remove unsupported proxies from the list. | 693 // Remove unsupported proxies from the list. |
| 672 int supported_proxies = | 694 int supported_proxies = |
| 673 ProxyServer::SCHEME_DIRECT | ProxyServer::SCHEME_HTTP | | 695 ProxyServer::SCHEME_DIRECT | ProxyServer::SCHEME_HTTP | |
| 674 ProxyServer::SCHEME_HTTPS | ProxyServer::SCHEME_SOCKS4 | | 696 ProxyServer::SCHEME_HTTPS | ProxyServer::SCHEME_SOCKS4 | |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 740 int HttpStreamFactoryImpl::Job::DoInitConnection() { | 762 int HttpStreamFactoryImpl::Job::DoInitConnection() { |
| 741 // TODO(pkasting): Remove ScopedTracker below once crbug.com/462812 is fixed. | 763 // TODO(pkasting): Remove ScopedTracker below once crbug.com/462812 is fixed. |
| 742 tracked_objects::ScopedTracker tracking_profile( | 764 tracked_objects::ScopedTracker tracking_profile( |
| 743 FROM_HERE_WITH_EXPLICIT_FUNCTION( | 765 FROM_HERE_WITH_EXPLICIT_FUNCTION( |
| 744 "462812 HttpStreamFactoryImpl::Job::DoInitConnection")); | 766 "462812 HttpStreamFactoryImpl::Job::DoInitConnection")); |
| 745 DCHECK(!blocking_job_); | 767 DCHECK(!blocking_job_); |
| 746 DCHECK(!connection_->is_initialized()); | 768 DCHECK(!connection_->is_initialized()); |
| 747 DCHECK(proxy_info_.proxy_server().is_valid()); | 769 DCHECK(proxy_info_.proxy_server().is_valid()); |
| 748 next_state_ = STATE_INIT_CONNECTION_COMPLETE; | 770 next_state_ = STATE_INIT_CONNECTION_COMPLETE; |
| 749 | 771 |
| 750 using_ssl_ = request_info_.url.SchemeIs("https") || | 772 using_ssl_ = alternative_service_url_.SchemeIs("https") || |
| 751 request_info_.url.SchemeIs("wss") || ShouldForceSpdySSL(); | 773 alternative_service_url_.SchemeIs("wss") || ShouldForceSpdySSL(); |
| 752 using_spdy_ = false; | 774 using_spdy_ = false; |
| 753 | 775 |
| 754 if (ShouldForceQuic()) | 776 if (ShouldForceQuic()) |
| 755 using_quic_ = true; | 777 using_quic_ = true; |
| 756 | 778 |
| 757 DCHECK(!using_quic_ || session_->params().enable_quic); | 779 DCHECK(!using_quic_ || session_->params().enable_quic); |
| 758 | 780 |
| 759 if (proxy_info_.is_quic()) { | 781 if (proxy_info_.is_quic()) { |
| 760 using_quic_ = true; | 782 using_quic_ = true; |
| 761 DCHECK(session_->params().enable_quic_for_proxies); | 783 DCHECK(session_->params().enable_quic_for_proxies); |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 855 proxy_info_, | 877 proxy_info_, |
| 856 ShouldForceSpdySSL(), | 878 ShouldForceSpdySSL(), |
| 857 want_spdy_over_npn, | 879 want_spdy_over_npn, |
| 858 server_ssl_config_, | 880 server_ssl_config_, |
| 859 proxy_ssl_config_, | 881 proxy_ssl_config_, |
| 860 request_info_.privacy_mode, | 882 request_info_.privacy_mode, |
| 861 net_log_, | 883 net_log_, |
| 862 num_streams_); | 884 num_streams_); |
| 863 } | 885 } |
| 864 | 886 |
| 865 // If we can't use a SPDY session, don't both checking for one after | 887 // If we can't use a SPDY session, don't bother checking for one after |
| 866 // the hostname is resolved. | 888 // the hostname is resolved. |
| 867 OnHostResolutionCallback resolution_callback = CanUseExistingSpdySession() ? | 889 OnHostResolutionCallback resolution_callback = CanUseExistingSpdySession() ? |
| 868 base::Bind(&Job::OnHostResolution, session_->spdy_session_pool(), | 890 base::Bind(&Job::OnHostResolution, session_->spdy_session_pool(), |
| 869 GetSpdySessionKey()) : | 891 GetSpdySessionKey()) : |
| 870 OnHostResolutionCallback(); | 892 OnHostResolutionCallback(); |
| 871 if (stream_factory_->for_websockets_) { | 893 if (stream_factory_->for_websockets_) { |
| 872 // TODO(ricea): Re-enable NPN when WebSockets over SPDY is supported. | 894 // TODO(ricea): Re-enable NPN when WebSockets over SPDY is supported. |
| 873 SSLConfig websocket_server_ssl_config = server_ssl_config_; | 895 SSLConfig websocket_server_ssl_config = server_ssl_config_; |
| 874 websocket_server_ssl_config.next_protos.clear(); | 896 websocket_server_ssl_config.next_protos.clear(); |
| 875 return InitSocketHandleForWebSocketRequest( | 897 return InitSocketHandleForWebSocketRequest( |
| 876 origin_url_, request_info_.extra_headers, request_info_.load_flags, | 898 origin_url_, request_info_.extra_headers, request_info_.load_flags, |
| 877 priority_, session_, proxy_info_, ShouldForceSpdySSL(), | 899 priority_, session_, proxy_info_, ShouldForceSpdySSL(), |
| 878 want_spdy_over_npn, websocket_server_ssl_config, proxy_ssl_config_, | 900 want_spdy_over_npn, websocket_server_ssl_config, proxy_ssl_config_, |
| 879 request_info_.privacy_mode, net_log_, | 901 request_info_.privacy_mode, net_log_, |
| 880 connection_.get(), resolution_callback, io_callback_); | 902 connection_.get(), resolution_callback, io_callback_); |
| 881 } | 903 } |
| 882 | 904 |
| 883 return InitSocketHandleForHttpRequest( | 905 return InitSocketHandleForHttpRequest( |
| 884 origin_url_, request_info_.extra_headers, request_info_.load_flags, | 906 alternative_service_url_, request_info_.extra_headers, |
| 885 priority_, session_, proxy_info_, ShouldForceSpdySSL(), | 907 request_info_.load_flags, priority_, session_, proxy_info_, |
| 886 want_spdy_over_npn, server_ssl_config_, proxy_ssl_config_, | 908 ShouldForceSpdySSL(), want_spdy_over_npn, server_ssl_config_, |
| 887 request_info_.privacy_mode, net_log_, | 909 proxy_ssl_config_, request_info_.privacy_mode, net_log_, |
| 888 connection_.get(), resolution_callback, io_callback_); | 910 connection_.get(), resolution_callback, io_callback_); |
| 889 } | 911 } |
| 890 | 912 |
| 891 int HttpStreamFactoryImpl::Job::DoInitConnectionComplete(int result) { | 913 int HttpStreamFactoryImpl::Job::DoInitConnectionComplete(int result) { |
| 892 if (IsPreconnecting()) { | 914 if (IsPreconnecting()) { |
| 893 if (using_quic_) | 915 if (using_quic_) |
| 894 return result; | 916 return result; |
| 895 DCHECK_EQ(OK, result); | 917 DCHECK_EQ(OK, result); |
| 896 return OK; | 918 return OK; |
| 897 } | 919 } |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1019 if (!connection_->is_reused()) { | 1041 if (!connection_->is_reused()) { |
| 1020 ConnectionType type = using_spdy_ ? CONNECTION_SPDY : CONNECTION_HTTP; | 1042 ConnectionType type = using_spdy_ ? CONNECTION_SPDY : CONNECTION_HTTP; |
| 1021 UpdateConnectionTypeHistograms(type); | 1043 UpdateConnectionTypeHistograms(type); |
| 1022 } | 1044 } |
| 1023 } | 1045 } |
| 1024 | 1046 |
| 1025 // Handle SSL errors below. | 1047 // Handle SSL errors below. |
| 1026 if (using_ssl_) { | 1048 if (using_ssl_) { |
| 1027 DCHECK(ssl_started); | 1049 DCHECK(ssl_started); |
| 1028 if (IsCertificateError(result)) { | 1050 if (IsCertificateError(result)) { |
| 1029 if (using_spdy_ && IsAlternate() && original_url_.SchemeIs("http")) { | 1051 if (using_spdy_ && IsAlternate() && origin_url_.SchemeIs("http")) { |
| 1030 // We ignore certificate errors for http over spdy. | 1052 // We ignore certificate errors for http over spdy. |
| 1031 spdy_certificate_error_ = result; | 1053 spdy_certificate_error_ = result; |
| 1032 result = OK; | 1054 result = OK; |
| 1033 } else { | 1055 } else { |
| 1034 result = HandleCertificateError(result); | 1056 result = HandleCertificateError(result); |
| 1035 if (result == OK && !connection_->socket()->IsConnectedAndIdle()) { | 1057 if (result == OK && !connection_->socket()->IsConnectedAndIdle()) { |
| 1036 ReturnToStateInitConnection(true /* close connection */); | 1058 ReturnToStateInitConnection(true /* close connection */); |
| 1037 return result; | 1059 return result; |
| 1038 } | 1060 } |
| 1039 } | 1061 } |
| (...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1223 connection_->socket()->SetOmniboxSpeculation(); | 1245 connection_->socket()->SetOmniboxSpeculation(); |
| 1224 // TODO(mbelshe): Add other motivations (like EARLY_LOAD_MOTIVATED). | 1246 // TODO(mbelshe): Add other motivations (like EARLY_LOAD_MOTIVATED). |
| 1225 } | 1247 } |
| 1226 | 1248 |
| 1227 bool HttpStreamFactoryImpl::Job::IsHttpsProxyAndHttpUrl() const { | 1249 bool HttpStreamFactoryImpl::Job::IsHttpsProxyAndHttpUrl() const { |
| 1228 if (!proxy_info_.is_https()) | 1250 if (!proxy_info_.is_https()) |
| 1229 return false; | 1251 return false; |
| 1230 if (IsAlternate()) { | 1252 if (IsAlternate()) { |
| 1231 // We currently only support Alternate-Protocol where the original scheme | 1253 // We currently only support Alternate-Protocol where the original scheme |
| 1232 // is http. | 1254 // is http. |
| 1233 DCHECK(original_url_.SchemeIs("http")); | 1255 DCHECK(origin_url_.SchemeIs("http")); |
| 1234 return original_url_.SchemeIs("http"); | 1256 return origin_url_.SchemeIs("http"); |
| 1235 } | 1257 } |
| 1236 return request_info_.url.SchemeIs("http"); | 1258 return request_info_.url.SchemeIs("http"); |
| 1237 } | 1259 } |
| 1238 | 1260 |
| 1239 bool HttpStreamFactoryImpl::Job::IsAlternate() const { | 1261 bool HttpStreamFactoryImpl::Job::IsAlternate() const { |
| 1240 return alternative_service_.protocol != UNINITIALIZED_ALTERNATE_PROTOCOL; | 1262 return alternative_service_.protocol != UNINITIALIZED_ALTERNATE_PROTOCOL; |
| 1241 } | 1263 } |
| 1242 | 1264 |
| 1243 void HttpStreamFactoryImpl::Job::InitSSLConfig(const HostPortPair& server, | 1265 void HttpStreamFactoryImpl::Job::InitSSLConfig(const HostPortPair& server, |
| 1244 SSLConfig* ssl_config, | 1266 SSLConfig* ssl_config, |
| (...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1467 | 1489 |
| 1468 if (job_status_ == STATUS_SUCCEEDED && other_job_status_ == STATUS_BROKEN) { | 1490 if (job_status_ == STATUS_SUCCEEDED && other_job_status_ == STATUS_BROKEN) { |
| 1469 HistogramBrokenAlternateProtocolLocation( | 1491 HistogramBrokenAlternateProtocolLocation( |
| 1470 BROKEN_ALTERNATE_PROTOCOL_LOCATION_HTTP_STREAM_FACTORY_IMPL_JOB_MAIN); | 1492 BROKEN_ALTERNATE_PROTOCOL_LOCATION_HTTP_STREAM_FACTORY_IMPL_JOB_MAIN); |
| 1471 session_->http_server_properties()->MarkAlternativeServiceBroken( | 1493 session_->http_server_properties()->MarkAlternativeServiceBroken( |
| 1472 other_job_alternative_service_); | 1494 other_job_alternative_service_); |
| 1473 } | 1495 } |
| 1474 } | 1496 } |
| 1475 | 1497 |
| 1476 } // namespace net | 1498 } // namespace net |
| OLD | NEW |