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

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 review nits 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
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 if (!using_spdy_ ||
1171 // While websockets over HTTP/2 are not supported, it is still valid to
Bence 2017/01/24 22:54:19 Please move this comment one line above (or below)
baranovich 2017/01/25 09:10:51 Done.
1172 // have websockets tunneled through HTTP/2 proxy (via CONNECT). If
1173 // websockets are secure (wss://), ProxyClientSocket with established
1174 // tunnel is wrapped with yet another socket (SSLClientSocket), and
1175 // |using_spdy_| will be false, but for ws: scheme, ProxyClientSocket is
1176 // not wrapped into anything.
1177 (using_spdy_ && proxy_info_.is_https() && delegate_->for_websockets())) {
1169 // We may get ftp scheme when fetching ftp resources through proxy. 1178 // We may get ftp scheme when fetching ftp resources through proxy.
1170 bool using_proxy = (proxy_info_.is_http() || proxy_info_.is_https()) && 1179 bool using_proxy = (proxy_info_.is_http() || proxy_info_.is_https()) &&
1171 (request_info_.url.SchemeIs(url::kHttpScheme) || 1180 (request_info_.url.SchemeIs(url::kHttpScheme) ||
1172 request_info_.url.SchemeIs(url::kFtpScheme)); 1181 request_info_.url.SchemeIs(url::kFtpScheme));
1173 if (delegate_->for_websockets()) { 1182 if (delegate_->for_websockets()) {
1174 DCHECK_NE(job_type_, PRECONNECT); 1183 DCHECK_NE(job_type_, PRECONNECT);
1175 DCHECK(delegate_->websocket_handshake_stream_create_helper()); 1184 DCHECK(delegate_->websocket_handshake_stream_create_helper());
1176 websocket_stream_.reset( 1185 websocket_stream_.reset(
1177 delegate_->websocket_handshake_stream_create_helper() 1186 delegate_->websocket_handshake_stream_create_helper()
1178 ->CreateBasicStream(std::move(connection_), using_proxy)); 1187 ->CreateBasicStream(std::move(connection_), using_proxy));
(...skipping 326 matching lines...) Expand 10 before | Expand all | Expand 10 after
1505 1514
1506 ConnectionAttempts socket_attempts = connection_->connection_attempts(); 1515 ConnectionAttempts socket_attempts = connection_->connection_attempts();
1507 if (connection_->socket()) { 1516 if (connection_->socket()) {
1508 connection_->socket()->GetConnectionAttempts(&socket_attempts); 1517 connection_->socket()->GetConnectionAttempts(&socket_attempts);
1509 } 1518 }
1510 1519
1511 delegate_->AddConnectionAttemptsToRequest(this, socket_attempts); 1520 delegate_->AddConnectionAttemptsToRequest(this, socket_attempts);
1512 } 1521 }
1513 1522
1514 } // namespace net 1523 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698