Fixed IPv6 addresses in hostnames in info_ json_ and embed_ URLs as well as .smil URLs.

This commit is contained in:
Thulinma 2016-05-31 10:11:38 +02:00
parent 4c9c6fa7ba
commit 0b2355c5bb

View file

@ -242,8 +242,8 @@ namespace Mist {
// send smil MBR index // send smil MBR index
if (H.url.length() > 6 && H.url.substr(H.url.length() - 5, 5) == ".smil"){ if (H.url.length() > 6 && H.url.substr(H.url.length() - 5, 5) == ".smil"){
std::string host = H.GetHeader("Host"); std::string host = H.GetHeader("Host");
if (host.find(':')){ if (host.rfind(':') != std::string::npos && *host.rbegin() != ']'){
host.resize(host.find(':')); host.resize(host.rfind(':'));
} }
std::string port, url_rel; std::string port, url_rel;
@ -302,8 +302,8 @@ namespace Mist {
std::string response; std::string response;
std::string rURL = H.url; std::string rURL = H.url;
std::string host = H.GetHeader("Host"); std::string host = H.GetHeader("Host");
if (host.find(':') != std::string::npos){ if (host.rfind(':') != std::string::npos && *host.rbegin() != ']'){
host.resize(host.find(':')); host.resize(host.rfind(':'));
} }
H.Clean(); H.Clean();
H.SetHeader("Server", "MistServer/" PACKAGE_VERSION); H.SetHeader("Server", "MistServer/" PACKAGE_VERSION);