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

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

Issue 439153004: Using hostname for TLS setup when IP address is not available. This usually (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
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 | Annotate | Revision Log
« no previous file with comments | « no previous file | 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 "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 167 matching lines...) Expand 10 before | Expand all | Expand 10 after
178 socket_handle->SetSocket(socket_.Pass()); 178 socket_handle->SetSocket(socket_.Pass());
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 net::HostPortPair::FromIPEndPoint(remote_address_.ip_address); 189 if (remote_address_.ip_address.address().empty()) {
190 if (!remote_address_.hostname.empty()) 190 DCHECK(!remote_address_.hostname.empty());
191 dest_host_port_pair.set_host(remote_address_.hostname); 191 dest_host_port_pair = net::HostPortPair::FromString(
192 remote_address_.hostname);
193 } else {
194 dest_host_port_pair = net::HostPortPair::FromIPEndPoint(
195 remote_address_.ip_address);
196 if (!remote_address_.hostname.empty())
197 dest_host_port_pair.set_host(remote_address_.hostname);
198 }
192 199
193 net::ClientSocketFactory* socket_factory = 200 net::ClientSocketFactory* socket_factory =
194 net::ClientSocketFactory::GetDefaultFactory(); 201 net::ClientSocketFactory::GetDefaultFactory();
195 DCHECK(socket_factory); 202 DCHECK(socket_factory);
196 203
197 socket_ = socket_factory->CreateSSLClientSocket( 204 socket_ = socket_factory->CreateSSLClientSocket(
198 socket_handle.Pass(), dest_host_port_pair, ssl_config, context); 205 socket_handle.Pass(), dest_host_port_pair, ssl_config, context);
199 int status = socket_->Connect( 206 int status = socket_->Connect(
200 base::Bind(&P2PSocketHostTcpBase::ProcessTlsSslConnectDone, 207 base::Bind(&P2PSocketHostTcpBase::ProcessTlsSslConnectDone,
201 base::Unretained(this))); 208 base::Unretained(this)));
(...skipping 392 matching lines...) Expand 10 before | Expand all | Expand 10 after
594 } else { 601 } else {
595 packet_size += kTurnChannelDataHeaderSize; 602 packet_size += kTurnChannelDataHeaderSize;
596 // Calculate any padding if present. 603 // Calculate any padding if present.
597 if (packet_size % 4) 604 if (packet_size % 4)
598 *pad_bytes = 4 - packet_size % 4; 605 *pad_bytes = 4 - packet_size % 4;
599 } 606 }
600 return packet_size; 607 return packet_size;
601 } 608 }
602 609
603 } // namespace content 610 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698