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" |
(...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
264 DCHECK(connection_.get() && connection_->socket()); | 264 DCHECK(connection_.get() && connection_->socket()); |
265 SSLClientSocket* ssl_socket = | 265 SSLClientSocket* ssl_socket = |
266 static_cast<SSLClientSocket*>(connection_->socket()); | 266 static_cast<SSLClientSocket*>(connection_->socket()); |
267 ssl_socket->GetSSLInfo(&ssl_info_); | 267 ssl_socket->GetSSLInfo(&ssl_info_); |
268 } | 268 } |
269 | 269 |
270 SpdySessionKey HttpStreamFactoryImpl::Job::GetSpdySessionKey() const { | 270 SpdySessionKey HttpStreamFactoryImpl::Job::GetSpdySessionKey() const { |
271 // In the case that we're using an HTTPS proxy for an HTTP url, | 271 // In the case that we're using an HTTPS proxy for an HTTP url, |
272 // we look for a SPDY session *to* the proxy, instead of to the | 272 // we look for a SPDY session *to* the proxy, instead of to the |
273 // origin server. | 273 // origin server. |
274 PrivacyMode privacy_mode = request_info_.privacy_mode; | |
275 if (IsHttpsProxyAndHttpUrl()) { | 274 if (IsHttpsProxyAndHttpUrl()) { |
276 return SpdySessionKey(proxy_info_.proxy_server().host_port_pair(), | 275 return SpdySessionKey(proxy_info_.proxy_server().host_port_pair(), |
277 ProxyServer::Direct(), | 276 ProxyServer::Direct(), PRIVACY_MODE_DISABLED); |
278 privacy_mode); | |
279 } | 277 } |
278 PrivacyMode privacy_mode = request_info_.privacy_mode; | |
280 return SpdySessionKey(server_, proxy_info_.proxy_server(), privacy_mode); | 279 return SpdySessionKey(server_, proxy_info_.proxy_server(), privacy_mode); |
Ryan Hamilton
2015/04/13 18:29:56
I recommend doing this cleanup in a different CL s
Bence
2015/04/15 21:07:46
Done: https://crrev.com/1063873003.
| |
281 } | 280 } |
282 | 281 |
283 bool HttpStreamFactoryImpl::Job::CanUseExistingSpdySession() const { | 282 bool HttpStreamFactoryImpl::Job::CanUseExistingSpdySession() const { |
284 // 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 |
285 // 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/. |
286 // 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 |
287 // https (the normal case) or if we're connection to a SPDY proxy. | 286 // https (the normal case) or if we're connection to a SPDY proxy. |
288 // https://crbug.com/133176 | 287 // https://crbug.com/133176 |
289 // 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 |
290 // working. | 289 // working. |
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
529 ptr_factory_.GetWeakPtr())); | 528 ptr_factory_.GetWeakPtr())); |
530 } else { | 529 } else { |
531 DCHECK(stream_.get()); | 530 DCHECK(stream_.get()); |
532 base::MessageLoop::current()->PostTask( | 531 base::MessageLoop::current()->PostTask( |
533 FROM_HERE, | 532 FROM_HERE, |
534 base::Bind(&Job::OnStreamReadyCallback, ptr_factory_.GetWeakPtr())); | 533 base::Bind(&Job::OnStreamReadyCallback, ptr_factory_.GetWeakPtr())); |
535 } | 534 } |
536 return ERR_IO_PENDING; | 535 return ERR_IO_PENDING; |
537 | 536 |
538 default: | 537 default: |
538 DCHECK((result != ERR_ALTERNATIVE_CERT_NOT_VALID_FOR_ORIGIN) || | |
Ryan Hamilton
2015/04/13 18:29:56
No need for the 2nd set of ()s. Feel free to put I
Bence
2015/04/15 21:07:46
Done.
| |
539 IsSpdyAlternate()); | |
539 if (job_status_ != STATUS_BROKEN) { | 540 if (job_status_ != STATUS_BROKEN) { |
540 DCHECK_EQ(STATUS_RUNNING, job_status_); | 541 DCHECK_EQ(STATUS_RUNNING, job_status_); |
541 job_status_ = STATUS_FAILED; | 542 job_status_ = STATUS_FAILED; |
543 // TODO(bnc): If (result == ERR_ALTERNATIVE_CERT_NOT_VALID_FOR_ORIGIN), | |
544 // then instead of marking alternative service broken, mark (origin, | |
545 // alternative service) couple as invalid. | |
542 MaybeMarkAlternativeServiceBroken(); | 546 MaybeMarkAlternativeServiceBroken(); |
543 } | 547 } |
544 base::MessageLoop::current()->PostTask( | 548 base::MessageLoop::current()->PostTask( |
545 FROM_HERE, | 549 FROM_HERE, |
546 base::Bind(&Job::OnStreamFailedCallback, ptr_factory_.GetWeakPtr(), | 550 base::Bind(&Job::OnStreamFailedCallback, ptr_factory_.GetWeakPtr(), |
547 result)); | 551 result)); |
548 return ERR_IO_PENDING; | 552 return ERR_IO_PENDING; |
549 } | 553 } |
550 } | 554 } |
551 | 555 |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
616 } | 620 } |
617 | 621 |
618 int HttpStreamFactoryImpl::Job::DoStart() { | 622 int HttpStreamFactoryImpl::Job::DoStart() { |
619 if (IsAlternate()) { | 623 if (IsAlternate()) { |
620 server_ = alternative_service_.host_port_pair(); | 624 server_ = alternative_service_.host_port_pair(); |
621 } else { | 625 } else { |
622 server_ = HostPortPair::FromURL(request_info_.url); | 626 server_ = HostPortPair::FromURL(request_info_.url); |
623 } | 627 } |
624 origin_url_ = | 628 origin_url_ = |
625 stream_factory_->ApplyHostMappingRules(request_info_.url, &server_); | 629 stream_factory_->ApplyHostMappingRules(request_info_.url, &server_); |
630 valid_spdy_session_pool_.reset( | |
631 new ValidSpdySessionPool(session_, origin_url_, IsSpdyAlternate())); | |
626 | 632 |
627 net_log_.BeginEvent( | 633 net_log_.BeginEvent( |
628 NetLog::TYPE_HTTP_STREAM_JOB, | 634 NetLog::TYPE_HTTP_STREAM_JOB, |
629 base::Bind(&NetLogHttpStreamJobCallback, &request_info_.url, &origin_url_, | 635 base::Bind(&NetLogHttpStreamJobCallback, &request_info_.url, &origin_url_, |
630 &alternative_service_, priority_)); | 636 &alternative_service_, priority_)); |
631 | 637 |
632 // Don't connect to restricted ports. | 638 // Don't connect to restricted ports. |
633 bool is_port_allowed = IsPortAllowedByDefault(server_.port()); | 639 bool is_port_allowed = IsPortAllowedByDefault(server_.port()); |
634 if (request_info_.url.SchemeIs("ftp")) { | 640 if (request_info_.url.SchemeIs("ftp")) { |
635 // Never share connection with other jobs for FTP requests. | 641 // Never share connection with other jobs for FTP requests. |
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
790 // OK, there's no available QUIC session. Let |waiting_job_| resume | 796 // OK, there's no available QUIC session. Let |waiting_job_| resume |
791 // if it's paused. | 797 // if it's paused. |
792 if (waiting_job_) { | 798 if (waiting_job_) { |
793 waiting_job_->Resume(this); | 799 waiting_job_->Resume(this); |
794 waiting_job_ = NULL; | 800 waiting_job_ = NULL; |
795 } | 801 } |
796 } | 802 } |
797 return rv; | 803 return rv; |
798 } | 804 } |
799 | 805 |
806 SpdySessionKey spdy_session_key = GetSpdySessionKey(); | |
807 | |
800 // Check first if we have a spdy session for this group. If so, then go | 808 // Check first if we have a spdy session for this group. If so, then go |
801 // straight to using that. | 809 // straight to using that. |
802 SpdySessionKey spdy_session_key = GetSpdySessionKey(); | 810 if (CanUseExistingSpdySession()) { |
803 base::WeakPtr<SpdySession> spdy_session = | 811 bool is_valid; |
804 session_->spdy_session_pool()->FindAvailableSession( | 812 base::WeakPtr<SpdySession> spdy_session = |
805 spdy_session_key, net_log_); | 813 valid_spdy_session_pool_->FindAvailableSession(spdy_session_key, |
806 if (spdy_session && CanUseExistingSpdySession()) { | 814 net_log_, &is_valid); |
807 // If we're preconnecting, but we already have a SpdySession, we don't | 815 if (!is_valid) { |
808 // actually need to preconnect any sockets, so we're done. | 816 return ERR_ALTERNATIVE_CERT_NOT_VALID_FOR_ORIGIN; |
809 if (IsPreconnecting()) | 817 } |
818 if (spdy_session) { | |
819 // If we're preconnecting, but we already have a SpdySession, we don't | |
820 // actually need to preconnect any sockets, so we're done. | |
821 if (IsPreconnecting()) | |
822 return OK; | |
823 using_spdy_ = true; | |
824 next_state_ = STATE_CREATE_STREAM; | |
825 existing_spdy_session_ = spdy_session; | |
810 return OK; | 826 return OK; |
811 using_spdy_ = true; | 827 } |
812 next_state_ = STATE_CREATE_STREAM; | 828 } |
813 existing_spdy_session_ = spdy_session; | 829 if (request_ && !request_->HasSpdySessionKey() && using_ssl_) { |
814 return OK; | |
815 } else if (request_ && !request_->HasSpdySessionKey() && using_ssl_) { | |
816 // Update the spdy session key for the request that launched this job. | 830 // Update the spdy session key for the request that launched this job. |
817 request_->SetSpdySessionKey(spdy_session_key); | 831 request_->SetSpdySessionKey(spdy_session_key); |
818 } | 832 } |
819 | 833 |
820 // OK, there's no available SPDY session. Let |waiting_job_| resume if it's | 834 // OK, there's no available SPDY session. Let |waiting_job_| resume if it's |
821 // paused. | 835 // paused. |
822 | |
823 if (waiting_job_) { | 836 if (waiting_job_) { |
824 waiting_job_->Resume(this); | 837 waiting_job_->Resume(this); |
825 waiting_job_ = NULL; | 838 waiting_job_ = NULL; |
826 } | 839 } |
827 | 840 |
828 if (proxy_info_.is_http() || proxy_info_.is_https()) | 841 if (proxy_info_.is_http() || proxy_info_.is_https()) |
829 establishing_tunnel_ = using_ssl_; | 842 establishing_tunnel_ = using_ssl_; |
830 | 843 |
831 // TODO(bnc): s/want_spdy_over_npn/expect_spdy_over_npn/ | 844 // TODO(bnc): s/want_spdy_over_npn/expect_spdy_over_npn/ |
832 bool want_spdy_over_npn = IsAlternate(); | 845 bool want_spdy_over_npn = IsAlternate(); |
(...skipping 24 matching lines...) Expand all Loading... | |
857 DCHECK(!stream_factory_->for_websockets_); | 870 DCHECK(!stream_factory_->for_websockets_); |
858 return PreconnectSocketsForHttpRequest( | 871 return PreconnectSocketsForHttpRequest( |
859 GetSocketGroup(), server_, request_info_.extra_headers, | 872 GetSocketGroup(), server_, request_info_.extra_headers, |
860 request_info_.load_flags, priority_, session_, proxy_info_, | 873 request_info_.load_flags, priority_, session_, proxy_info_, |
861 want_spdy_over_npn, server_ssl_config_, proxy_ssl_config_, | 874 want_spdy_over_npn, server_ssl_config_, proxy_ssl_config_, |
862 request_info_.privacy_mode, net_log_, num_streams_); | 875 request_info_.privacy_mode, net_log_, num_streams_); |
863 } | 876 } |
864 | 877 |
865 // If we can't use a SPDY session, don't bother checking for one after | 878 // If we can't use a SPDY session, don't bother checking for one after |
866 // the hostname is resolved. | 879 // the hostname is resolved. |
867 OnHostResolutionCallback resolution_callback = CanUseExistingSpdySession() ? | 880 OnHostResolutionCallback resolution_callback = |
868 base::Bind(&Job::OnHostResolution, session_->spdy_session_pool(), | 881 CanUseExistingSpdySession() |
869 GetSpdySessionKey()) : | 882 ? base::Bind(&Job::OnHostResolution, session_->spdy_session_pool(), |
870 OnHostResolutionCallback(); | 883 spdy_session_key) |
884 : OnHostResolutionCallback(); | |
871 if (stream_factory_->for_websockets_) { | 885 if (stream_factory_->for_websockets_) { |
872 // TODO(ricea): Re-enable NPN when WebSockets over SPDY is supported. | 886 // TODO(ricea): Re-enable NPN when WebSockets over SPDY is supported. |
873 SSLConfig websocket_server_ssl_config = server_ssl_config_; | 887 SSLConfig websocket_server_ssl_config = server_ssl_config_; |
874 websocket_server_ssl_config.next_protos.clear(); | 888 websocket_server_ssl_config.next_protos.clear(); |
875 return InitSocketHandleForWebSocketRequest( | 889 return InitSocketHandleForWebSocketRequest( |
876 GetSocketGroup(), server_, request_info_.extra_headers, | 890 GetSocketGroup(), server_, request_info_.extra_headers, |
877 request_info_.load_flags, priority_, session_, proxy_info_, | 891 request_info_.load_flags, priority_, session_, proxy_info_, |
878 want_spdy_over_npn, websocket_server_ssl_config, proxy_ssl_config_, | 892 want_spdy_over_npn, websocket_server_ssl_config, proxy_ssl_config_, |
879 request_info_.privacy_mode, net_log_, connection_.get(), | 893 request_info_.privacy_mode, net_log_, connection_.get(), |
880 resolution_callback, io_callback_); | 894 resolution_callback, io_callback_); |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
982 // puts the in progress HttpProxy socket into |connection_| in order to | 996 // puts the in progress HttpProxy socket into |connection_| in order to |
983 // complete the auth (or read the response body). The tunnel restart code | 997 // complete the auth (or read the response body). The tunnel restart code |
984 // is careful to remove it before returning control to the rest of this | 998 // is careful to remove it before returning control to the rest of this |
985 // class. | 999 // class. |
986 connection_.reset(connection_->release_pending_http_proxy_connection()); | 1000 connection_.reset(connection_->release_pending_http_proxy_connection()); |
987 return result; | 1001 return result; |
988 } | 1002 } |
989 | 1003 |
990 if (!ssl_started && result < 0 && IsAlternate()) { | 1004 if (!ssl_started && result < 0 && IsAlternate()) { |
991 job_status_ = STATUS_BROKEN; | 1005 job_status_ = STATUS_BROKEN; |
1006 // TODO(bnc): if (result == ERR_ALTERNATIVE_CERT_NOT_VALID_FOR_ORIGIN), then | |
1007 // instead of marking alternative service broken, mark (origin, alternative | |
1008 // service) couple as invalid. | |
992 MaybeMarkAlternativeServiceBroken(); | 1009 MaybeMarkAlternativeServiceBroken(); |
993 return result; | 1010 return result; |
994 } | 1011 } |
995 | 1012 |
996 if (using_quic_) { | 1013 if (using_quic_) { |
997 if (result < 0) { | 1014 if (result < 0) { |
998 job_status_ = STATUS_BROKEN; | 1015 job_status_ = STATUS_BROKEN; |
999 MaybeMarkAlternativeServiceBroken(); | 1016 MaybeMarkAlternativeServiceBroken(); |
1000 return result; | 1017 return result; |
1001 } | 1018 } |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1092 request_->websocket_handshake_stream_create_helper() | 1109 request_->websocket_handshake_stream_create_helper() |
1093 ->CreateBasicStream(connection_.Pass(), using_proxy)); | 1110 ->CreateBasicStream(connection_.Pass(), using_proxy)); |
1094 } else { | 1111 } else { |
1095 stream_.reset(new HttpBasicStream(connection_.release(), using_proxy)); | 1112 stream_.reset(new HttpBasicStream(connection_.release(), using_proxy)); |
1096 } | 1113 } |
1097 return OK; | 1114 return OK; |
1098 } | 1115 } |
1099 | 1116 |
1100 CHECK(!stream_.get()); | 1117 CHECK(!stream_.get()); |
1101 | 1118 |
1102 bool direct = true; | 1119 bool direct = !IsHttpsProxyAndHttpUrl(); |
1103 const ProxyServer& proxy_server = proxy_info_.proxy_server(); | |
1104 PrivacyMode privacy_mode = request_info_.privacy_mode; | |
1105 if (IsHttpsProxyAndHttpUrl()) | |
1106 direct = false; | |
1107 | |
1108 if (existing_spdy_session_.get()) { | 1120 if (existing_spdy_session_.get()) { |
1109 // We picked up an existing session, so we don't need our socket. | 1121 // We picked up an existing session, so we don't need our socket. |
1110 if (connection_->socket()) | 1122 if (connection_->socket()) |
1111 connection_->socket()->Disconnect(); | 1123 connection_->socket()->Disconnect(); |
1112 connection_->Reset(); | 1124 connection_->Reset(); |
1113 | 1125 |
1114 int set_result = SetSpdyHttpStream(existing_spdy_session_, direct); | 1126 int set_result = SetSpdyHttpStream(existing_spdy_session_, direct); |
1115 existing_spdy_session_.reset(); | 1127 existing_spdy_session_.reset(); |
1116 return set_result; | 1128 return set_result; |
1117 } | 1129 } |
1118 | 1130 |
1119 SpdySessionKey spdy_session_key(server_, proxy_server, privacy_mode); | 1131 SpdySessionKey spdy_session_key = GetSpdySessionKey(); |
1120 if (IsHttpsProxyAndHttpUrl()) { | 1132 bool is_valid; |
1121 // If we don't have a direct SPDY session, and we're using an HTTPS | 1133 base::WeakPtr<SpdySession> spdy_session = |
1122 // proxy, then we might have a SPDY session to the proxy. | 1134 valid_spdy_session_pool_->FindAvailableSession(spdy_session_key, net_log_, |
1123 // We never use privacy mode for connection to proxy server. | 1135 &is_valid); |
1124 spdy_session_key = SpdySessionKey(proxy_server.host_port_pair(), | 1136 if (!is_valid) { |
Ryan Hamilton
2015/04/13 18:29:56
Hm. I'm not in love with this API. Instead, I woul
Bence
2015/04/15 21:07:46
Done.
| |
1125 ProxyServer::Direct(), | 1137 return ERR_ALTERNATIVE_CERT_NOT_VALID_FOR_ORIGIN; |
1126 PRIVACY_MODE_DISABLED); | |
1127 } | 1138 } |
1128 | |
1129 SpdySessionPool* spdy_pool = session_->spdy_session_pool(); | |
1130 base::WeakPtr<SpdySession> spdy_session = | |
1131 spdy_pool->FindAvailableSession(spdy_session_key, net_log_); | |
1132 | |
1133 if (spdy_session) { | 1139 if (spdy_session) { |
1134 return SetSpdyHttpStream(spdy_session, direct); | 1140 return SetSpdyHttpStream(spdy_session, direct); |
1135 } | 1141 } |
1136 | 1142 |
1137 spdy_session = | 1143 spdy_session = valid_spdy_session_pool_->CreateAvailableSessionFromSocket( |
1138 spdy_pool->CreateAvailableSessionFromSocket(spdy_session_key, | 1144 spdy_session_key, connection_.Pass(), net_log_, spdy_certificate_error_, |
1139 connection_.Pass(), | 1145 using_ssl_, &is_valid); |
1140 net_log_, | 1146 if (!is_valid) { |
1141 spdy_certificate_error_, | 1147 return ERR_ALTERNATIVE_CERT_NOT_VALID_FOR_ORIGIN; |
1142 using_ssl_); | 1148 } |
1149 | |
1143 if (!spdy_session->HasAcceptableTransportSecurity()) { | 1150 if (!spdy_session->HasAcceptableTransportSecurity()) { |
1144 spdy_session->CloseSessionOnError( | 1151 spdy_session->CloseSessionOnError( |
1145 ERR_SPDY_INADEQUATE_TRANSPORT_SECURITY, ""); | 1152 ERR_SPDY_INADEQUATE_TRANSPORT_SECURITY, ""); |
1146 return ERR_SPDY_INADEQUATE_TRANSPORT_SECURITY; | 1153 return ERR_SPDY_INADEQUATE_TRANSPORT_SECURITY; |
1147 } | 1154 } |
1148 | 1155 |
1149 new_spdy_session_ = spdy_session; | 1156 new_spdy_session_ = spdy_session; |
1150 spdy_session_direct_ = direct; | 1157 spdy_session_direct_ = direct; |
1151 const HostPortPair& host_port_pair = spdy_session_key.host_port_pair(); | 1158 const HostPortPair& host_port_pair = spdy_session_key.host_port_pair(); |
1152 base::WeakPtr<HttpServerProperties> http_server_properties = | 1159 base::WeakPtr<HttpServerProperties> http_server_properties = |
(...skipping 315 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1468 } | 1475 } |
1469 | 1476 |
1470 if (job_status_ == STATUS_SUCCEEDED && other_job_status_ == STATUS_BROKEN) { | 1477 if (job_status_ == STATUS_SUCCEEDED && other_job_status_ == STATUS_BROKEN) { |
1471 HistogramBrokenAlternateProtocolLocation( | 1478 HistogramBrokenAlternateProtocolLocation( |
1472 BROKEN_ALTERNATE_PROTOCOL_LOCATION_HTTP_STREAM_FACTORY_IMPL_JOB_MAIN); | 1479 BROKEN_ALTERNATE_PROTOCOL_LOCATION_HTTP_STREAM_FACTORY_IMPL_JOB_MAIN); |
1473 session_->http_server_properties()->MarkAlternativeServiceBroken( | 1480 session_->http_server_properties()->MarkAlternativeServiceBroken( |
1474 other_job_alternative_service_); | 1481 other_job_alternative_service_); |
1475 } | 1482 } |
1476 } | 1483 } |
1477 | 1484 |
1485 HttpStreamFactoryImpl::Job::ValidSpdySessionPool::ValidSpdySessionPool( | |
1486 HttpNetworkSession* session, | |
Ryan Hamilton
2015/04/13 18:29:56
Looks like you can just take the Pool instead of s
Bence
2015/04/15 21:07:46
Done.
| |
1487 GURL& origin_url, | |
1488 bool is_spdy_alternate) | |
1489 : session_(session), | |
1490 origin_url_(origin_url), | |
1491 is_spdy_alternate_(is_spdy_alternate) { | |
1492 } | |
1493 | |
1494 base::WeakPtr<SpdySession> | |
1495 HttpStreamFactoryImpl::Job::ValidSpdySessionPool::FindAvailableSession( | |
1496 const SpdySessionKey& key, | |
1497 const BoundNetLog& net_log, | |
1498 bool* is_valid) { | |
1499 base::WeakPtr<SpdySession> spdy_session = | |
1500 session_->spdy_session_pool()->FindAvailableSession(key, net_log); | |
1501 *is_valid = IsAlternativeCertificateValidForOrigin(spdy_session); | |
1502 return spdy_session; | |
1503 } | |
1504 | |
1505 base::WeakPtr<SpdySession> HttpStreamFactoryImpl::Job::ValidSpdySessionPool:: | |
1506 CreateAvailableSessionFromSocket(const SpdySessionKey& key, | |
1507 scoped_ptr<ClientSocketHandle> connection, | |
1508 const BoundNetLog& net_log, | |
1509 int certificate_error_code, | |
1510 bool is_secure, | |
1511 bool* is_valid) { | |
1512 base::WeakPtr<SpdySession> spdy_session = | |
1513 session_->spdy_session_pool()->CreateAvailableSessionFromSocket( | |
1514 key, connection.Pass(), net_log, certificate_error_code, is_secure); | |
1515 *is_valid = IsAlternativeCertificateValidForOrigin(spdy_session); | |
1516 return spdy_session; | |
1517 } | |
1518 | |
1519 bool HttpStreamFactoryImpl::Job::ValidSpdySessionPool:: | |
1520 IsAlternativeCertificateValidForOrigin( | |
1521 base::WeakPtr<SpdySession> spdy_session) { | |
1522 return !is_spdy_alternate_ || !spdy_session || | |
Ryan Hamilton
2015/04/13 18:29:56
It seems like is_spdy_alternate_ is not adding any
Bence
2015/04/15 21:07:46
Per your other comment, I removed hostname checkin
Ryan Hamilton
2015/04/15 21:24:34
Can you add a comment about why you don't need to
Bence
2015/04/23 17:17:07
Done.
| |
1523 (origin_url_.host() == spdy_session->host_port_pair().host()) || | |
1524 spdy_session->VerifyDomainAuthentication(origin_url_.host()); | |
1525 } | |
1526 | |
1478 ClientSocketPoolManager::SocketGroupType | 1527 ClientSocketPoolManager::SocketGroupType |
1479 HttpStreamFactoryImpl::Job::GetSocketGroup() const { | 1528 HttpStreamFactoryImpl::Job::GetSocketGroup() const { |
1480 std::string scheme = origin_url_.scheme(); | 1529 std::string scheme = origin_url_.scheme(); |
1481 if (scheme == "https" || scheme == "wss" || IsSpdyAlternate()) | 1530 if (scheme == "https" || scheme == "wss" || IsSpdyAlternate()) |
1482 return ClientSocketPoolManager::SSL_GROUP; | 1531 return ClientSocketPoolManager::SSL_GROUP; |
1483 | 1532 |
1484 if (scheme == "ftp") | 1533 if (scheme == "ftp") |
1485 return ClientSocketPoolManager::FTP_GROUP; | 1534 return ClientSocketPoolManager::FTP_GROUP; |
1486 | 1535 |
1487 return ClientSocketPoolManager::NORMAL_GROUP; | 1536 return ClientSocketPoolManager::NORMAL_GROUP; |
1488 } | 1537 } |
1489 | 1538 |
1490 } // namespace net | 1539 } // namespace net |
OLD | NEW |