From c7cef0260f14c1fecaf81881e8989046ff5d9834 Mon Sep 17 00:00:00 2001 From: Thulinma Date: Wed, 23 Jul 2014 12:51:23 +0200 Subject: [PATCH] Fixed HLS url recognition failure --- src/output/output_hls.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/output/output_hls.cpp b/src/output/output_hls.cpp index 443f8e9f..f091dbdb 100644 --- a/src/output/output_hls.cpp +++ b/src/output/output_hls.cpp @@ -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);