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

Side by Side Diff: content/browser/renderer_host/p2p/socket_host_tcp.cc

Issue 466843002: Fix the hostname used to setup a TURN/TSL connection. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 4 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 | « no previous file | content/renderer/p2p/ipc_socket_factory.cc » ('j') | 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 "content/browser/renderer_host/p2p/socket_host_tcp.h" 5 #include "content/browser/renderer_host/p2p/socket_host_tcp.h"
6 6
7 #include "base/sys_byteorder.h" 7 #include "base/sys_byteorder.h"
8 #include "content/common/p2p_messages.h" 8 #include "content/common/p2p_messages.h"
9 #include "ipc/ipc_sender.h" 9 #include "ipc/ipc_sender.h"
10 #include "jingle/glue/fake_ssl_client_socket.h" 10 #include "jingle/glue/fake_ssl_client_socket.h"
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after
179 179
180 net::SSLClientSocketContext context; 180 net::SSLClientSocketContext context;
181 context.cert_verifier = url_context_->GetURLRequestContext()->cert_verifier(); 181 context.cert_verifier = url_context_->GetURLRequestContext()->cert_verifier();
182 context.transport_security_state = 182 context.transport_security_state =
183 url_context_->GetURLRequestContext()->transport_security_state(); 183 url_context_->GetURLRequestContext()->transport_security_state();
184 DCHECK(context.transport_security_state); 184 DCHECK(context.transport_security_state);
185 185
186 // Default ssl config. 186 // Default ssl config.
187 const net::SSLConfig ssl_config; 187 const net::SSLConfig ssl_config;
188 net::HostPortPair dest_host_port_pair; 188 net::HostPortPair dest_host_port_pair;
189 if (remote_address_.ip_address.address().empty()) { 189
190 DCHECK(!remote_address_.hostname.empty()); 190 // Calling net::HostPortPair::FromIPEndPoint will crash if the IP address is
191 dest_host_port_pair = net::HostPortPair::FromString( 191 // empty.
192 remote_address_.hostname); 192 if (!remote_address_.ip_address.address().empty()) {
193 net::HostPortPair::FromIPEndPoint(remote_address_.ip_address);
193 } else { 194 } else {
194 dest_host_port_pair = net::HostPortPair::FromIPEndPoint( 195 dest_host_port_pair.set_port(remote_address_.ip_address.port());
195 remote_address_.ip_address);
196 if (!remote_address_.hostname.empty())
197 dest_host_port_pair.set_host(remote_address_.hostname);
198 } 196 }
197 if (!remote_address_.hostname.empty())
198 dest_host_port_pair.set_host(remote_address_.hostname);
199 199
200 net::ClientSocketFactory* socket_factory = 200 net::ClientSocketFactory* socket_factory =
201 net::ClientSocketFactory::GetDefaultFactory(); 201 net::ClientSocketFactory::GetDefaultFactory();
202 DCHECK(socket_factory); 202 DCHECK(socket_factory);
203 203
204 socket_ = socket_factory->CreateSSLClientSocket( 204 socket_ = socket_factory->CreateSSLClientSocket(
205 socket_handle.Pass(), dest_host_port_pair, ssl_config, context); 205 socket_handle.Pass(), dest_host_port_pair, ssl_config, context);
206 int status = socket_->Connect( 206 int status = socket_->Connect(
207 base::Bind(&P2PSocketHostTcpBase::ProcessTlsSslConnectDone, 207 base::Bind(&P2PSocketHostTcpBase::ProcessTlsSslConnectDone,
208 base::Unretained(this))); 208 base::Unretained(this)));
(...skipping 392 matching lines...) Expand 10 before | Expand all | Expand 10 after
601 } else { 601 } else {
602 packet_size += kTurnChannelDataHeaderSize; 602 packet_size += kTurnChannelDataHeaderSize;
603 // Calculate any padding if present. 603 // Calculate any padding if present.
604 if (packet_size % 4) 604 if (packet_size % 4)
605 *pad_bytes = 4 - packet_size % 4; 605 *pad_bytes = 4 - packet_size % 4;
606 } 606 }
607 return packet_size; 607 return packet_size;
608 } 608 }
609 609
610 } // namespace content 610 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | content/renderer/p2p/ipc_socket_factory.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698