From 6816b6074c3faf29446cff5d8ccea97a1aebf2f2 Mon Sep 17 00:00:00 2001 From: Thulinma Date: Tue, 26 Jul 2016 13:20:01 +0200 Subject: [PATCH] Fixed support for non-HTTP-compliant devices pulling HTTP TS output --- lib/http_parser.cpp | 4 ++++ lib/http_parser.h | 1 + src/output/output_httpts.cpp | 5 ++++- 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/lib/http_parser.cpp b/lib/http_parser.cpp index d7efe6a6..f353c0dd 100644 --- a/lib/http_parser.cpp +++ b/lib/http_parser.cpp @@ -334,6 +334,10 @@ void HTTP::Parser::SetHeader(std::string i, std::string v) { headers[i] = v; } +void HTTP::Parser::clearHeader(const std::string & i){ + headers.erase(i); +} + /// Sets header i to integer value v. void HTTP::Parser::SetHeader(std::string i, long long v) { Trim(i); diff --git a/lib/http_parser.h b/lib/http_parser.h index 4e304038..52084ab1 100644 --- a/lib/http_parser.h +++ b/lib/http_parser.h @@ -17,6 +17,7 @@ namespace HTTP { bool Read(Socket::Connection & conn); bool Read(std::string & strbuf); std::string GetHeader(std::string i); + void clearHeader(const std::string & i); std::string GetVar(std::string i); std::string getUrl(); std::string allVars(); diff --git a/src/output/output_httpts.cpp b/src/output/output_httpts.cpp index 64b1644d..80a84226 100644 --- a/src/output/output_httpts.cpp +++ b/src/output/output_httpts.cpp @@ -26,8 +26,10 @@ namespace Mist { void OutHTTPTS::onHTTP(){ std::string method = H.method; - initialize(); + H.clearHeader("Range"); + H.clearHeader("Icy-MetaData"); + H.clearHeader("User-Agent"); H.SetHeader("Content-Type", "video/mp2t"); H.setCORSHeaders(); if(method == "OPTIONS" || method == "HEAD"){ @@ -35,6 +37,7 @@ namespace Mist { H.Clean(); return; } + H.protocol = "HTTP/1.0";//Force HTTP/1.0 because some devices just don't understand chunked replies H.StartResponse(H, myConn); parseData = true; wantRequest = false;