Ignore localhost address when get icecand for webrtc from http request (#3282)

This commit is contained in:
waken 2024-02-04 23:11:18 +08:00 committed by GitHub
parent 0359f178de
commit bfcaf15075
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1750,7 +1750,7 @@ void installWebApi() {
std::string host = allArgs.getParser()["Host"];
std::string localIp = host.substr(0, host.find(':'));
std::regex ipv4Regex("^((25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$");
if (!std::regex_match(localIp, ipv4Regex)) {
if (!std::regex_match(localIp, ipv4Regex)||localIp=="127.0.0.1") {
localIp = "";
}