Added URL passthrough.

This commit is contained in:
Thulinma 2016-05-19 15:37:17 +02:00
parent b77e7c8b7c
commit 5d4366fdf1
3 changed files with 18 additions and 1 deletions

View file

@ -313,6 +313,20 @@ std::string HTTP::Parser::GetVar(std::string i) {
return vars[i]; return vars[i];
} }
std::string HTTP::Parser::allVars(){
std::string ret;
if (!vars.size()){return ret;}
for (std::map<std::string, std::string>::iterator it = vars.begin(); it != vars.end(); ++it){
if (ret.size() > 1){
ret += "&";
}else{
ret += "?";
}
ret += it->first + "=" + Encodings::URL::encode(it->second);
}
return ret;
}
/// Sets header i to string value v. /// Sets header i to string value v.
void HTTP::Parser::SetHeader(std::string i, std::string v) { void HTTP::Parser::SetHeader(std::string i, std::string v) {
Trim(i); Trim(i);

View file

@ -19,6 +19,7 @@ namespace HTTP {
std::string GetHeader(std::string i); std::string GetHeader(std::string i);
std::string GetVar(std::string i); std::string GetVar(std::string i);
std::string getUrl(); std::string getUrl();
std::string allVars();
void SetHeader(std::string i, std::string v); void SetHeader(std::string i, std::string v);
void SetHeader(std::string i, long long v); void SetHeader(std::string i, long long v);
void setCORSHeaders(); void setCORSHeaders();

View file

@ -160,7 +160,9 @@ namespace Mist {
if (!myConn.Received().size()){ if (!myConn.Received().size()){
if (myConn.peek() && H.Read(myConn)){ if (myConn.peek() && H.Read(myConn)){
std::string handler = getHandler(); std::string handler = getHandler();
reqUrl = H.url;/*LTS*/ /*LTS-START*/
reqUrl = H.url + H.allVars();
/*LTS-END*/
DEBUG_MSG(DLVL_MEDIUM, "Received request: %s => %s (%s)", H.getUrl().c_str(), handler.c_str(), H.GetVar("stream").c_str()); DEBUG_MSG(DLVL_MEDIUM, "Received request: %s => %s (%s)", H.getUrl().c_str(), handler.c_str(), H.GetVar("stream").c_str());
if (!handler.size()){ if (!handler.size()){
H.Clean(); H.Clean();