Fixed HLS url recognition failure

This commit is contained in:
Thulinma 2014-07-23 12:51:23 +02:00
parent b1e3eb3628
commit c7cef0260f

View file

@ -220,7 +220,14 @@ namespace Mist {
std::string tmpStr = HTTP_R.getUrl();
std::string fmtStr = "/hls/" + streamName + "/%u_%u/%llu_%llu.ts";
long long unsigned int from;
sscanf(tmpStr.c_str(), fmtStr.c_str(), &vidTrack, &audTrack, &from, &until);
if (sscanf(tmpStr.c_str(), fmtStr.c_str(), &vidTrack, &audTrack, &from, &until) != 4){
WARN_MSG("Could not parse URL: %s", HTTP_R.getUrl().c_str());
HTTP_S.Clean();
HTTP_S.SetBody("The HLS URL wasn't understood - what did you want, exactly?\n");
myConn.SendNow(HTTP_S.BuildResponse("404", "URL mismatch"));
HTTP_R.Clean(); //clean for any possible next requests
continue;
}
DEBUG_MSG(DLVL_DEVEL, "Vid %u, Aud %u, From %llu, Until %llu", vidTrack, audTrack, from, until);
selectedTracks.clear();
selectedTracks.insert(vidTrack);