Bug 879654: Tolerate '?transport=udp' by stripping it r=jesup

This commit is contained in:
Jan-Ivar Bruaroey 2013-06-05 15:44:48 -04:00
parent 3cb81d0925
commit 0a5c597380
2 changed files with 10 additions and 2 deletions

View File

@ -54,7 +54,7 @@
{ url:"stun:0.0.0.0" },
{ url:"stuns:x.net", foo:"" },
{ url:"turn:[::192.9.5.5]:42", username:"p", credential:"p" },
{ url:"turns:x.org:42", username:"p", credential:"p" }
{ url:"turns:x.org:42?transport=udp", username:"p", credential:"p" }
]}, true);
pcs = null;

View File

@ -399,7 +399,8 @@ PeerConnectionImpl::CreateRemoteSourceStreamInfo(nsRefPtr<RemoteSourceStreamInfo
* In JS, an RTCConfiguration looks like this:
*
* { "iceServers": [ { url:"stun:23.21.150.121" },
* { url:"turn:turn.example.org", credential:"mypass", "username"} ] }
* { url:"turn:turn.example.org?transport=udp",
* username: "jib", credential:"mypass"} ] }
*
* This function converts an already-validated jsval that looks like the above
* into an IceConfiguration object.
@ -449,6 +450,13 @@ PeerConnectionImpl::ConvertRTCConfiguration(const JS::Value& aSrc,
nsAutoCString path;
rv = url->GetPath(path);
NS_ENSURE_SUCCESS(rv, rv);
// Tolerate '?transport=udp' by stripping it.
int32_t questionmark = path.FindChar('?');
if (questionmark >= 0) {
path.SetLength(questionmark);
}
rv = net_GetAuthURLParser()->ParseAuthority(path.get(), path.Length(),
nullptr, nullptr,
nullptr, nullptr,