From 0b2355c5bbea3758611b5f5bb904bbf0bf76f7bd Mon Sep 17 00:00:00 2001 From: Thulinma Date: Tue, 31 May 2016 10:11:38 +0200 Subject: [PATCH] Fixed IPv6 addresses in hostnames in info_ json_ and embed_ URLs as well as .smil URLs. --- src/output/output_http_internal.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/output/output_http_internal.cpp b/src/output/output_http_internal.cpp index 9da1fa3d..0fbcefe4 100644 --- a/src/output/output_http_internal.cpp +++ b/src/output/output_http_internal.cpp @@ -242,8 +242,8 @@ namespace Mist { // send smil MBR index if (H.url.length() > 6 && H.url.substr(H.url.length() - 5, 5) == ".smil"){ std::string host = H.GetHeader("Host"); - if (host.find(':')){ - host.resize(host.find(':')); + if (host.rfind(':') != std::string::npos && *host.rbegin() != ']'){ + host.resize(host.rfind(':')); } std::string port, url_rel; @@ -302,8 +302,8 @@ namespace Mist { std::string response; std::string rURL = H.url; std::string host = H.GetHeader("Host"); - if (host.find(':') != std::string::npos){ - host.resize(host.find(':')); + if (host.rfind(':') != std::string::npos && *host.rbegin() != ']'){ + host.resize(host.rfind(':')); } H.Clean(); H.SetHeader("Server", "MistServer/" PACKAGE_VERSION);