From e1ba17ca21266cdf2e853d49c8457e21c1f188ad Mon Sep 17 00:00:00 2001 From: Frank Schmirler Date: Tue, 1 Oct 2013 23:52:03 +0200 Subject: Ignore dummy file extensions (.ts, .vob, .vdr) when parsing HTTP URIs --- server/connectionHTTP.c | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) (limited to 'server') diff --git a/server/connectionHTTP.c b/server/connectionHTTP.c index 02e5170..26f6d1c 100644 --- a/server/connectionHTTP.c +++ b/server/connectionHTTP.c @@ -556,11 +556,24 @@ bool cConnectionHTTP::ProcessURI(const std::string& PathInfo) if (file_pos != std::string::npos) { size_t ext_pos = PathInfo.rfind('.'); - // file basename with leading / stripped off - filespec = PathInfo.substr(file_pos + 1, ext_pos - file_pos - 1); - if (ext_pos != std::string::npos) + if (ext_pos != std::string::npos) { // file extension including leading . fileext = PathInfo.substr(ext_pos); + const char *ext = fileext.c_str(); + // ignore dummy file extensions + if (strcasecmp(ext, ".ts") == 0 || + strcasecmp(ext, ".vdr") == 0 || + strcasecmp(ext, ".vob") == 0) { + size_t ext_end = ext_pos; + if (ext_pos > 0) + ext_pos = PathInfo.rfind('.', ext_pos - 1); + if (ext_pos == std::string::npos) + ext_pos = ext_end; + fileext = PathInfo.substr(ext_pos, ext_end - ext_pos); + } + } + // file basename with leading / stripped off + filespec = PathInfo.substr(file_pos + 1, ext_pos - file_pos - 1); } if (fileext.length() > 5) { //probably not an extension -- cgit v1.2.3