Enable SNI in ssl adapter.

Bug: webrtc:6973
Change-Id: I13d28cf41c586880bd7fea523005233921794cdf
Reviewed-on: https://chromium-review.googlesource.com/523024
Reviewed-by: Zeke Chin <tkchin@webrtc.org>
Reviewed-by: Sami Kalliomäki <sakal@webrtc.org>
Reviewed-by: Justin Uberti <juberti@chromium.org>
Reviewed-by: Taylor Brandstetter <deadbeef@webrtc.org>
Commit-Queue: Emad Omara <emadomara@google.com>
Cr-Commit-Position: refs/heads/master@{#18640}
This commit is contained in:
Emad Omara
2017-06-16 15:43:11 -07:00
committed by Commit Bot
parent 43b39de0ca
commit dab1d2d34e
10 changed files with 152 additions and 12 deletions

View File

@ -40,6 +40,14 @@ class IceServerParsingTest : public testing::Test {
const std::string& username,
const std::string& password,
PeerConnectionInterface::TlsCertPolicy tls_certificate_policy) {
return ParseUrl(url, username, password, tls_certificate_policy, "");
}
bool ParseUrl(const std::string& url,
const std::string& username,
const std::string& password,
PeerConnectionInterface::TlsCertPolicy tls_certificate_policy,
const std::string& hostname) {
stun_servers_.clear();
turn_servers_.clear();
PeerConnectionInterface::IceServers servers;
@ -48,6 +56,7 @@ class IceServerParsingTest : public testing::Test {
server.username = username;
server.password = password;
server.tls_cert_policy = tls_certificate_policy;
server.hostname = hostname;
servers.push_back(server);
return webrtc::ParseIceServers(servers, &stun_servers_, &turn_servers_) ==
webrtc::RTCErrorType::NONE;
@ -148,6 +157,18 @@ TEST_F(IceServerParsingTest, ParseHostnameAndPort) {
EXPECT_EQ("hostname", stun_servers_.begin()->hostname());
EXPECT_EQ(3478, stun_servers_.begin()->port());
// Both TURN IP and host exist
EXPECT_TRUE(
ParseUrl("turn:1.2.3.4:1234", "username", "password",
PeerConnectionInterface::TlsCertPolicy::kTlsCertPolicySecure,
"hostname"));
EXPECT_EQ(1U, turn_servers_.size());
rtc::SocketAddress address = turn_servers_[0].ports[0].address;
EXPECT_EQ("hostname", address.hostname());
EXPECT_EQ(1234, address.port());
EXPECT_FALSE(address.IsUnresolvedIP());
EXPECT_EQ("1.2.3.4", address.ipaddr().ToString());
// Try some invalid hostname:port strings.
EXPECT_FALSE(ParseUrl("stun:hostname:99a99"));
EXPECT_FALSE(ParseUrl("stun:hostname:-1"));