diff --git a/lib/http_parser.cpp b/lib/http_parser.cpp index fe1b8eac..913a8e22 100644 --- a/lib/http_parser.cpp +++ b/lib/http_parser.cpp @@ -423,7 +423,7 @@ void HTTP::Parser::SetBody(const char *buffer, int len){ } /// Returns header i, if set. -std::string HTTP::Parser::getUrl(){ +std::string HTTP::Parser::getUrl() const{ if (url.find('?') != std::string::npos){ return url.substr(0, url.find('?')); }else{ @@ -463,10 +463,10 @@ const std::string &HTTP::Parser::GetVar(const std::string &i) const{ } } -std::string HTTP::Parser::allVars(){ +std::string HTTP::Parser::allVars() const{ std::string ret; if (!vars.size()){return ret;} - for (std::map::iterator it = vars.begin(); it != vars.end(); ++it){ + for (std::map::const_iterator it = vars.begin(); it != vars.end(); ++it){ if (!it->second.size()){continue;} if (ret.size() > 1){ ret += "&"; diff --git a/lib/http_parser.h b/lib/http_parser.h index a5528df3..4d695264 100644 --- a/lib/http_parser.h +++ b/lib/http_parser.h @@ -27,8 +27,8 @@ namespace HTTP{ void clearHeader(const std::string &i); uint8_t getPercentage() const; const std::string &GetVar(const std::string &i) const; - std::string getUrl(); - std::string allVars(); + std::string getUrl() const; + std::string allVars() const; void SetHeader(std::string i, std::string v); void SetHeader(std::string i, long long v); void setCORSHeaders(); diff --git a/src/output/output_http_internal.cpp b/src/output/output_http_internal.cpp index 1660e9de..445d3a61 100644 --- a/src/output/output_http_internal.cpp +++ b/src/output/output_http_internal.cpp @@ -352,13 +352,13 @@ namespace Mist{ std::string uAgent = req.GetHeader("User-Agent"); std::string forceType = ""; - if (H.GetVar("forcetype").size()){ + if (req.GetVar("forcetype").size()){ forceType = ",forceType:\"" + req.GetVar("forcetype") + "\""; } std::string devSkin = ""; if (req.GetVar("dev").size()){devSkin = ",skin:\"dev\"";} - devSkin += ",urlappend:\"" + H.allVars() + "\""; + devSkin += ",urlappend:\"" + req.allVars() + "\""; H.SetVar("stream", streamName); std::string seekTo = ""; @@ -384,6 +384,7 @@ namespace Mist{ } } + H.Clean(); H.SetHeader("Content-Type", "text/html"); H.SetHeader("X-UA-Compatible", "IE=edge"); if (headersOnly){