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 1146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1157 RecordChannelIDKeyMatch(ssl_socket, session_->params().channel_id_service, | 1157 RecordChannelIDKeyMatch(ssl_socket, session_->params().channel_id_service, |
1158 destination_.HostForURL()); | 1158 destination_.HostForURL()); |
1159 } | 1159 } |
1160 | 1160 |
1161 // We only set the socket motivation if we're the first to use | 1161 // We only set the socket motivation if we're the first to use |
1162 // this socket. Is there a race for two SPDY requests? We really | 1162 // this socket. Is there a race for two SPDY requests? We really |
1163 // need to plumb this through to the connect level. | 1163 // need to plumb this through to the connect level. |
1164 if (connection_->socket() && !connection_->is_reused()) | 1164 if (connection_->socket() && !connection_->is_reused()) |
1165 SetSocketMotivation(); | 1165 SetSocketMotivation(); |
1166 | 1166 |
1167 if (!using_spdy_) | 1167 if (!using_spdy_) { |
1168 DCHECK(!IsSpdyAlternative()); | 1168 DCHECK(!IsSpdyAlternative()); |
1169 | |
1170 // While websockets over HTTP/2 are not supported, it is still valid to have | |
1171 // websockets tunneled through HTTP/2 proxy (via CONNECT). If websockets are | |
1172 // secure (wss://), ProxyClientSocket with established tunnel is wrapped with | |
1173 // yet another socket (SSLClientSocket), and |using_spdy_| will be false, but | |
1174 // for ws: scheme, ProxyClientSocket is not wrapped into anything. | |
1175 if (!using_spdy_ || | |
1176 (using_spdy_ && proxy_info_.is_https() && delegate_->for_websockets())) { | |
1177 // We may get ftp scheme when fetching ftp resources through proxy. | 1169 // We may get ftp scheme when fetching ftp resources through proxy. |
1178 bool using_proxy = (proxy_info_.is_http() || proxy_info_.is_https()) && | 1170 bool using_proxy = (proxy_info_.is_http() || proxy_info_.is_https()) && |
1179 (request_info_.url.SchemeIs(url::kHttpScheme) || | 1171 (request_info_.url.SchemeIs(url::kHttpScheme) || |
1180 request_info_.url.SchemeIs(url::kFtpScheme)); | 1172 request_info_.url.SchemeIs(url::kFtpScheme)); |
1181 if (delegate_->for_websockets()) { | 1173 if (delegate_->for_websockets()) { |
1182 DCHECK_NE(job_type_, PRECONNECT); | 1174 DCHECK_NE(job_type_, PRECONNECT); |
1183 DCHECK(delegate_->websocket_handshake_stream_create_helper()); | 1175 DCHECK(delegate_->websocket_handshake_stream_create_helper()); |
1184 websocket_stream_.reset( | 1176 websocket_stream_.reset( |
1185 delegate_->websocket_handshake_stream_create_helper() | 1177 delegate_->websocket_handshake_stream_create_helper() |
1186 ->CreateBasicStream(std::move(connection_), using_proxy)); | 1178 ->CreateBasicStream(std::move(connection_), using_proxy)); |
(...skipping 326 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1513 | 1505 |
1514 ConnectionAttempts socket_attempts = connection_->connection_attempts(); | 1506 ConnectionAttempts socket_attempts = connection_->connection_attempts(); |
1515 if (connection_->socket()) { | 1507 if (connection_->socket()) { |
1516 connection_->socket()->GetConnectionAttempts(&socket_attempts); | 1508 connection_->socket()->GetConnectionAttempts(&socket_attempts); |
1517 } | 1509 } |
1518 | 1510 |
1519 delegate_->AddConnectionAttemptsToRequest(this, socket_attempts); | 1511 delegate_->AddConnectionAttemptsToRequest(this, socket_attempts); |
1520 } | 1512 } |
1521 | 1513 |
1522 } // namespace net | 1514 } // namespace net |
OLD | NEW |