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 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
841 http_server_properties->MaybeForceHTTP11(server_, &server_ssl_config_); | 863 http_server_properties->MaybeForceHTTP11(server_, &server_ssl_config_); |
842 if (proxy_info_.is_http() || proxy_info_.is_https()) { | 864 if (proxy_info_.is_http() || proxy_info_.is_https()) { |
843 http_server_properties->MaybeForceHTTP11( | 865 http_server_properties->MaybeForceHTTP11( |
844 proxy_info_.proxy_server().host_port_pair(), &proxy_ssl_config_); | 866 proxy_info_.proxy_server().host_port_pair(), &proxy_ssl_config_); |
845 } | 867 } |
846 } | 868 } |
847 | 869 |
848 if (IsPreconnecting()) { | 870 if (IsPreconnecting()) { |
849 DCHECK(!stream_factory_->for_websockets_); | 871 DCHECK(!stream_factory_->for_websockets_); |
850 return PreconnectSocketsForHttpRequest( | 872 return PreconnectSocketsForHttpRequest( |
851 origin_url_, | 873 alternative_service_url_, request_info_.extra_headers, |
852 request_info_.extra_headers, | 874 request_info_.load_flags, priority_, session_, proxy_info_, |
853 request_info_.load_flags, | 875 ShouldForceSpdySSL(), want_spdy_over_npn, server_ssl_config_, |
854 priority_, | 876 proxy_ssl_config_, request_info_.privacy_mode, net_log_, num_streams_); |
855 session_, | |
856 proxy_info_, | |
857 ShouldForceSpdySSL(), | |
858 want_spdy_over_npn, | |
859 server_ssl_config_, | |
860 proxy_ssl_config_, | |
861 request_info_.privacy_mode, | |
862 net_log_, | |
863 num_streams_); | |
864 } | 877 } |
865 | 878 |
866 // If we can't use a SPDY session, don't both checking for one after | 879 // If we can't use a SPDY session, don't bother checking for one after |
867 // the hostname is resolved. | 880 // the hostname is resolved. |
868 OnHostResolutionCallback resolution_callback = CanUseExistingSpdySession() ? | 881 OnHostResolutionCallback resolution_callback = CanUseExistingSpdySession() ? |
869 base::Bind(&Job::OnHostResolution, session_->spdy_session_pool(), | 882 base::Bind(&Job::OnHostResolution, session_->spdy_session_pool(), |
870 GetSpdySessionKey()) : | 883 GetSpdySessionKey()) : |
871 OnHostResolutionCallback(); | 884 OnHostResolutionCallback(); |
872 if (stream_factory_->for_websockets_) { | 885 if (stream_factory_->for_websockets_) { |
873 // TODO(ricea): Re-enable NPN when WebSockets over SPDY is supported. | 886 // TODO(ricea): Re-enable NPN when WebSockets over SPDY is supported. |
874 SSLConfig websocket_server_ssl_config = server_ssl_config_; | 887 SSLConfig websocket_server_ssl_config = server_ssl_config_; |
875 websocket_server_ssl_config.next_protos.clear(); | 888 websocket_server_ssl_config.next_protos.clear(); |
876 return InitSocketHandleForWebSocketRequest( | 889 return InitSocketHandleForWebSocketRequest( |
877 origin_url_, request_info_.extra_headers, request_info_.load_flags, | 890 origin_url_, request_info_.extra_headers, request_info_.load_flags, |
878 priority_, session_, proxy_info_, ShouldForceSpdySSL(), | 891 priority_, session_, proxy_info_, ShouldForceSpdySSL(), |
879 want_spdy_over_npn, websocket_server_ssl_config, proxy_ssl_config_, | 892 want_spdy_over_npn, websocket_server_ssl_config, proxy_ssl_config_, |
880 request_info_.privacy_mode, net_log_, | 893 request_info_.privacy_mode, net_log_, |
881 connection_.get(), resolution_callback, io_callback_); | 894 connection_.get(), resolution_callback, io_callback_); |
882 } | 895 } |
883 | 896 |
884 return InitSocketHandleForHttpRequest( | 897 return InitSocketHandleForHttpRequest( |
885 origin_url_, request_info_.extra_headers, request_info_.load_flags, | 898 alternative_service_url_, request_info_.extra_headers, |
886 priority_, session_, proxy_info_, ShouldForceSpdySSL(), | 899 request_info_.load_flags, priority_, session_, proxy_info_, |
887 want_spdy_over_npn, server_ssl_config_, proxy_ssl_config_, | 900 ShouldForceSpdySSL(), want_spdy_over_npn, server_ssl_config_, |
888 request_info_.privacy_mode, net_log_, | 901 proxy_ssl_config_, request_info_.privacy_mode, net_log_, |
889 connection_.get(), resolution_callback, io_callback_); | 902 connection_.get(), resolution_callback, io_callback_); |
890 } | 903 } |
891 | 904 |
892 int HttpStreamFactoryImpl::Job::DoInitConnectionComplete(int result) { | 905 int HttpStreamFactoryImpl::Job::DoInitConnectionComplete(int result) { |
893 if (IsPreconnecting()) { | 906 if (IsPreconnecting()) { |
894 if (using_quic_) | 907 if (using_quic_) |
895 return result; | 908 return result; |
896 DCHECK_EQ(OK, result); | 909 DCHECK_EQ(OK, result); |
897 return OK; | 910 return OK; |
898 } | 911 } |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1020 if (!connection_->is_reused()) { | 1033 if (!connection_->is_reused()) { |
1021 ConnectionType type = using_spdy_ ? CONNECTION_SPDY : CONNECTION_HTTP; | 1034 ConnectionType type = using_spdy_ ? CONNECTION_SPDY : CONNECTION_HTTP; |
1022 UpdateConnectionTypeHistograms(type); | 1035 UpdateConnectionTypeHistograms(type); |
1023 } | 1036 } |
1024 } | 1037 } |
1025 | 1038 |
1026 // Handle SSL errors below. | 1039 // Handle SSL errors below. |
1027 if (using_ssl_) { | 1040 if (using_ssl_) { |
1028 DCHECK(ssl_started); | 1041 DCHECK(ssl_started); |
1029 if (IsCertificateError(result)) { | 1042 if (IsCertificateError(result)) { |
1030 if (using_spdy_ && IsAlternate() && original_url_.SchemeIs("http")) { | 1043 if (using_spdy_ && IsAlternate() && origin_url_.SchemeIs("http")) { |
1031 // We ignore certificate errors for http over spdy. | 1044 // We ignore certificate errors for http over spdy. |
1032 spdy_certificate_error_ = result; | 1045 spdy_certificate_error_ = result; |
1033 result = OK; | 1046 result = OK; |
1034 } else { | 1047 } else { |
1035 result = HandleCertificateError(result); | 1048 result = HandleCertificateError(result); |
1036 if (result == OK && !connection_->socket()->IsConnectedAndIdle()) { | 1049 if (result == OK && !connection_->socket()->IsConnectedAndIdle()) { |
1037 ReturnToStateInitConnection(true /* close connection */); | 1050 ReturnToStateInitConnection(true /* close connection */); |
1038 return result; | 1051 return result; |
1039 } | 1052 } |
1040 } | 1053 } |
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1224 connection_->socket()->SetOmniboxSpeculation(); | 1237 connection_->socket()->SetOmniboxSpeculation(); |
1225 // TODO(mbelshe): Add other motivations (like EARLY_LOAD_MOTIVATED). | 1238 // TODO(mbelshe): Add other motivations (like EARLY_LOAD_MOTIVATED). |
1226 } | 1239 } |
1227 | 1240 |
1228 bool HttpStreamFactoryImpl::Job::IsHttpsProxyAndHttpUrl() const { | 1241 bool HttpStreamFactoryImpl::Job::IsHttpsProxyAndHttpUrl() const { |
1229 if (!proxy_info_.is_https()) | 1242 if (!proxy_info_.is_https()) |
1230 return false; | 1243 return false; |
1231 if (IsAlternate()) { | 1244 if (IsAlternate()) { |
1232 // We currently only support Alternate-Protocol where the original scheme | 1245 // We currently only support Alternate-Protocol where the original scheme |
1233 // is http. | 1246 // is http. |
1234 DCHECK(original_url_.SchemeIs("http")); | 1247 DCHECK(origin_url_.SchemeIs("http")); |
1235 return original_url_.SchemeIs("http"); | 1248 return origin_url_.SchemeIs("http"); |
1236 } | 1249 } |
1237 return request_info_.url.SchemeIs("http"); | 1250 return request_info_.url.SchemeIs("http"); |
1238 } | 1251 } |
1239 | 1252 |
1240 bool HttpStreamFactoryImpl::Job::IsAlternate() const { | 1253 bool HttpStreamFactoryImpl::Job::IsAlternate() const { |
1241 return alternative_service_.protocol != UNINITIALIZED_ALTERNATE_PROTOCOL; | 1254 return alternative_service_.protocol != UNINITIALIZED_ALTERNATE_PROTOCOL; |
1242 } | 1255 } |
1243 | 1256 |
1244 void HttpStreamFactoryImpl::Job::InitSSLConfig(const HostPortPair& server, | 1257 void HttpStreamFactoryImpl::Job::InitSSLConfig(const HostPortPair& server, |
1245 SSLConfig* ssl_config, | 1258 SSLConfig* ssl_config, |
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1468 | 1481 |
1469 if (job_status_ == STATUS_SUCCEEDED && other_job_status_ == STATUS_BROKEN) { | 1482 if (job_status_ == STATUS_SUCCEEDED && other_job_status_ == STATUS_BROKEN) { |
1470 HistogramBrokenAlternateProtocolLocation( | 1483 HistogramBrokenAlternateProtocolLocation( |
1471 BROKEN_ALTERNATE_PROTOCOL_LOCATION_HTTP_STREAM_FACTORY_IMPL_JOB_MAIN); | 1484 BROKEN_ALTERNATE_PROTOCOL_LOCATION_HTTP_STREAM_FACTORY_IMPL_JOB_MAIN); |
1472 session_->http_server_properties()->MarkAlternativeServiceBroken( | 1485 session_->http_server_properties()->MarkAlternativeServiceBroken( |
1473 other_job_alternative_service_); | 1486 other_job_alternative_service_); |
1474 } | 1487 } |
1475 } | 1488 } |
1476 | 1489 |
1477 } // namespace net | 1490 } // namespace net |
OLD | NEW |