From e85652e7e7f10f7dfd9b70b0ef66c5699fd94597 Mon Sep 17 00:00:00 2001 From: trilene Date: Mon, 13 Jul 2020 19:16:28 -0400 Subject: Fix percent-encoding of TURN server URI --- src/CallManager.cpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'src/CallManager.cpp') diff --git a/src/CallManager.cpp b/src/CallManager.cpp index 67aabced..b2236290 100644 --- a/src/CallManager.cpp +++ b/src/CallManager.cpp @@ -274,7 +274,8 @@ CallManager::retrieveTurnServer() void CallManager::setTurnServers() { - // gstreamer expects (percent-encoded): turn(s)://username:password@host:port?transport=udp(tcp) + // gstreamer expects: turn(s)://username:password@host:port?transport=udp(tcp) + // where username and password are percent-encoded std::vector uris; for (const auto &uri : turnServer_.uris) { if (auto c = uri.find(':'); c == std::string::npos) { @@ -287,9 +288,11 @@ CallManager::setTurnServers() nhlog::ui()->error("Invalid TURN server uri: {}", uri); continue; } - std::string res = scheme + "://" + turnServer_.username + ":" + turnServer_.password - + "@" + std::string(uri, ++c); - QString encodedUri = QUrl::toPercentEncoding(QString::fromStdString(res)); + + QString encodedUri = QString::fromStdString(scheme) + "://" + + QUrl::toPercentEncoding(QString::fromStdString(turnServer_.username)) + ":" + + QUrl::toPercentEncoding(QString::fromStdString(turnServer_.password)) + "@" + + QString::fromStdString(std::string(uri, ++c)); uris.push_back(encodedUri.toStdString()); } } -- cgit 1.5.1