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

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

Issue 2642723008: Allow proxying plaintext websockets over http/2 proxy (Closed)
Patch Set: Fix codestyle Created 3 years, 11 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
« no previous file with comments | « net/http/http_network_transaction_unittest.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 1146 matching lines...) Expand 10 before | Expand all | Expand 10 after
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())) {
1169 // We may get ftp scheme when fetching ftp resources through proxy. 1177 // We may get ftp scheme when fetching ftp resources through proxy.
1170 bool using_proxy = (proxy_info_.is_http() || proxy_info_.is_https()) && 1178 bool using_proxy = (proxy_info_.is_http() || proxy_info_.is_https()) &&
1171 (request_info_.url.SchemeIs(url::kHttpScheme) || 1179 (request_info_.url.SchemeIs(url::kHttpScheme) ||
1172 request_info_.url.SchemeIs(url::kFtpScheme)); 1180 request_info_.url.SchemeIs(url::kFtpScheme));
1173 if (delegate_->for_websockets()) { 1181 if (delegate_->for_websockets()) {
1174 DCHECK_NE(job_type_, PRECONNECT); 1182 DCHECK_NE(job_type_, PRECONNECT);
1175 DCHECK(delegate_->websocket_handshake_stream_create_helper()); 1183 DCHECK(delegate_->websocket_handshake_stream_create_helper());
1176 websocket_stream_.reset( 1184 websocket_stream_.reset(
1177 delegate_->websocket_handshake_stream_create_helper() 1185 delegate_->websocket_handshake_stream_create_helper()
1178 ->CreateBasicStream(std::move(connection_), using_proxy)); 1186 ->CreateBasicStream(std::move(connection_), using_proxy));
(...skipping 326 matching lines...) Expand 10 before | Expand all | Expand 10 after
1505 1513
1506 ConnectionAttempts socket_attempts = connection_->connection_attempts(); 1514 ConnectionAttempts socket_attempts = connection_->connection_attempts();
1507 if (connection_->socket()) { 1515 if (connection_->socket()) {
1508 connection_->socket()->GetConnectionAttempts(&socket_attempts); 1516 connection_->socket()->GetConnectionAttempts(&socket_attempts);
1509 } 1517 }
1510 1518
1511 delegate_->AddConnectionAttemptsToRequest(this, socket_attempts); 1519 delegate_->AddConnectionAttemptsToRequest(this, socket_attempts);
1512 } 1520 }
1513 1521
1514 } // namespace net 1522 } // namespace net
OLDNEW
« no previous file with comments | « net/http/http_network_transaction_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698