Fixed HLS case sensitivity.

This commit is contained in:
Thulinma 2014-09-08 00:05:17 +02:00
parent 4e705195a8
commit de61bb77a8

View file

@ -280,13 +280,11 @@ namespace Mist {
AppleCompat = (HTTP_R.GetHeader("User-Agent").find("Apple") != std::string::npos); AppleCompat = (HTTP_R.GetHeader("User-Agent").find("Apple") != std::string::npos);
initialize(); initialize();
if (HTTP_R.url.find(".m3u") == std::string::npos){ if (HTTP_R.url.find(".m3u") == std::string::npos){
std::string tmpStr = HTTP_R.getUrl(); std::string tmpStr = HTTP_R.getUrl().substr(5+streamName.size());
std::string fmtStr = "/hls/" + streamName + "/%u_%u/%llu_%llu.ts";
long long unsigned int from; long long unsigned int from;
if (sscanf(tmpStr.c_str(), fmtStr.c_str(), &vidTrack, &audTrack, &from, &until) != 4){ if (sscanf(tmpStr.c_str(), "/%u_%u/%llu_%llu.ts", &vidTrack, &audTrack, &from, &until) != 4){
fmtStr = "/hls/" + streamName + "/%u/%llu_%llu.ts"; if (sscanf(tmpStr.c_str(), "/%u/%llu_%llu.ts", &vidTrack, &from, &until) != 3){
if (sscanf(tmpStr.c_str(), fmtStr.c_str(), &vidTrack, &from, &until) != 3){ DEBUG_MSG(DLVL_MEDIUM, "Could not parse URL: %s", HTTP_R.getUrl().c_str());
WARN_MSG("Could not parse URL: %s", HTTP_R.getUrl().c_str());
HTTP_S.Clean(); HTTP_S.Clean();
HTTP_S.SetBody("The HLS URL wasn't understood - what did you want, exactly?\n"); HTTP_S.SetBody("The HLS URL wasn't understood - what did you want, exactly?\n");
myConn.SendNow(HTTP_S.BuildResponse("404", "URL mismatch")); myConn.SendNow(HTTP_S.BuildResponse("404", "URL mismatch"));