Bläddra i källkod

URL decode hostname in addition to username and password

Paul-Louis Ageneau 3 år sedan
förälder
incheckning
c1ae522218
1 ändrade filer med 5 tillägg och 2 borttagningar
  1. 5 2
      src/configuration.cpp

+ 5 - 2
src/configuration.cpp

@@ -80,10 +80,13 @@ IceServer::IceServer(const string &url) {
 	password = utils::url_decode(opt[8].value_or(""));
 
 	hostname = opt[10].value();
-	while (!hostname.empty() && hostname.front() == '[')
+	if(hostname.front() == '[' && hostname.back() == ']') {
+		// IPv6 literal
 		hostname.erase(hostname.begin());
-	while (!hostname.empty() && hostname.back() == ']')
 		hostname.pop_back();
+	} else {
+		hostname = utils::url_decode(hostname);
+	}
 
 	string service = opt[12].value_or(relayType == RelayType::TurnTls ? "5349" : "3478");
 	try {