HTTP backport
Change-Id: Iaa33c15bbd19b000b0bc8c5389e95109938c2e48
This commit is contained in:
		
							parent
							
								
									f17c2637e7
								
							
						
					
					
						commit
						bf15ec6741
					
				
					 3 changed files with 8 additions and 7 deletions
				
			
		| 
						 | 
				
			
			@ -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<std::string, std::string>::iterator it = vars.begin(); it != vars.end(); ++it){
 | 
			
		||||
  for (std::map<std::string, std::string>::const_iterator it = vars.begin(); it != vars.end(); ++it){
 | 
			
		||||
    if (!it->second.size()){continue;}
 | 
			
		||||
    if (ret.size() > 1){
 | 
			
		||||
      ret += "&";
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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();
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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){
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue