summaryrefslogtreecommitdiffstats
path: root/content
diff options
context:
space:
mode:
authorjiayl@chromium.org <jiayl@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-08-15 19:21:46 +0000
committerjiayl@chromium.org <jiayl@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-08-15 19:22:50 +0000
commit1f028b7d36d011c2d889cddbee4a9b4f0dabd888 (patch)
tree39ab96f01b4e55172cdd9076018a3f6edbee9d4d /content
parentec1fbde6eaa5aa79573ace392f14a62dd5aba66a (diff)
downloadchromium_src-1f028b7d36d011c2d889cddbee4a9b4f0dabd888.zip
chromium_src-1f028b7d36d011c2d889cddbee4a9b4f0dabd888.tar.gz
chromium_src-1f028b7d36d011c2d889cddbee4a9b4f0dabd888.tar.bz2
Fix the hostname used to setup a TURN/TSL connection.
BUG=https://code.google.com/p/webrtc/issues/detail?id=3601 Review URL: https://codereview.chromium.org/466843002 Cr-Commit-Position: refs/heads/master@{#289972} git-svn-id: svn://svn.chromium.org/chrome/trunk/src@289972 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content')
-rw-r--r--content/browser/renderer_host/p2p/socket_host_tcp.cc16
-rw-r--r--content/renderer/p2p/ipc_socket_factory.cc20
2 files changed, 21 insertions, 15 deletions
diff --git a/content/browser/renderer_host/p2p/socket_host_tcp.cc b/content/browser/renderer_host/p2p/socket_host_tcp.cc
index 2955b61..1ee1627 100644
--- a/content/browser/renderer_host/p2p/socket_host_tcp.cc
+++ b/content/browser/renderer_host/p2p/socket_host_tcp.cc
@@ -186,16 +186,16 @@ void P2PSocketHostTcpBase::StartTls() {
// Default ssl config.
const net::SSLConfig ssl_config;
net::HostPortPair dest_host_port_pair;
- if (remote_address_.ip_address.address().empty()) {
- DCHECK(!remote_address_.hostname.empty());
- dest_host_port_pair = net::HostPortPair::FromString(
- remote_address_.hostname);
+
+ // Calling net::HostPortPair::FromIPEndPoint will crash if the IP address is
+ // empty.
+ if (!remote_address_.ip_address.address().empty()) {
+ net::HostPortPair::FromIPEndPoint(remote_address_.ip_address);
} else {
- dest_host_port_pair = net::HostPortPair::FromIPEndPoint(
- remote_address_.ip_address);
- if (!remote_address_.hostname.empty())
- dest_host_port_pair.set_host(remote_address_.hostname);
+ dest_host_port_pair.set_port(remote_address_.ip_address.port());
}
+ if (!remote_address_.hostname.empty())
+ dest_host_port_pair.set_host(remote_address_.hostname);
net::ClientSocketFactory* socket_factory =
net::ClientSocketFactory::GetDefaultFactory();
diff --git a/content/renderer/p2p/ipc_socket_factory.cc b/content/renderer/p2p/ipc_socket_factory.cc
index 62428ad..3055016 100644
--- a/content/renderer/p2p/ipc_socket_factory.cc
+++ b/content/renderer/p2p/ipc_socket_factory.cc
@@ -235,18 +235,24 @@ bool IpcPacketSocket::Init(P2PSocketType type,
}
net::IPEndPoint remote_endpoint;
- if (!remote_address.IsNil() && !jingle_glue::SocketAddressToIPEndPoint(
- remote_address, &remote_endpoint) && !IsTcpClientSocket(type_)) {
- // Non TCP sockets must have a resolved remote address.
- return false;
+ if (!remote_address.IsNil()) {
+ DCHECK(IsTcpClientSocket(type_));
+
+ if (remote_address.IsUnresolvedIP()) {
+ remote_endpoint =
+ net::IPEndPoint(net::IPAddressNumber(), remote_address.port());
+ } else {
+ if (!jingle_glue::SocketAddressToIPEndPoint(remote_address,
+ &remote_endpoint)) {
+ return false;
+ }
+ }
}
// We need to send both resolved and unresolved address in Init. Unresolved
// address will be used in case of TLS for certificate hostname matching.
// Certificate will be tied to domain name not to IP address.
- std::string remote_hostname = remote_address.hostname() + ":" +
- remote_address.PortAsString();
- P2PHostAndIPEndPoint remote_info(remote_hostname, remote_endpoint);
+ P2PHostAndIPEndPoint remote_info(remote_address.hostname(), remote_endpoint);
client->Init(type, local_endpoint, remote_info, this);