Add create function for PeerConnection that can return an error.
Needed in order to return different codes for different failures
in initialization.
Sideswipe: Check TURN URL hostnames for illegal characters.
Bug: webrtc:12238
Change-Id: I1af3a37b9654b83b268304f7356049f9f3786b7a
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/195541
Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
Commit-Queue: Harald Alvestrand <hta@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#32710}
diff --git a/pc/ice_server_parsing_unittest.cc b/pc/ice_server_parsing_unittest.cc
index 2625b24..e4dbd3a 100644
--- a/pc/ice_server_parsing_unittest.cc
+++ b/pc/ice_server_parsing_unittest.cc
@@ -182,6 +182,11 @@
EXPECT_FALSE(ParseUrl("stun:[1:2:3:4:5:6:7:8]junk:1000"));
EXPECT_FALSE(ParseUrl("stun::5555"));
EXPECT_FALSE(ParseUrl("stun:"));
+ // Test illegal URLs according to RFC 3986 (URI generic syntax)
+ // and RFC 7064 (URI schemes for STUN and TURN)
+ EXPECT_FALSE(ParseUrl("stun:/hostname")); // / is not allowed
+ EXPECT_FALSE(ParseUrl("stun:?hostname")); // ? is not allowed
+ EXPECT_FALSE(ParseUrl("stun:#hostname")); // # is not allowed
}
// Test parsing the "?transport=xxx" part of the URL.