mirror of
				https://github.com/TeamPiped/piped-proxy.git
				synced 2024-08-14 23:50:45 +00:00 
			
		
		
		
	Only match regex once.
This commit is contained in:
		
							parent
							
								
									71cb04d028
								
							
						
					
					
						commit
						e9c84fbb7b
					
				
					 1 changed files with 3 additions and 2 deletions
				
			
		| 
						 | 
				
			
			@ -111,12 +111,13 @@ async fn index(req: HttpRequest) -> Result<HttpResponse, Box<dyn Error>> {
 | 
			
		|||
    }
 | 
			
		||||
 | 
			
		||||
    let host = res.unwrap();
 | 
			
		||||
    let domain = RE_DOMAIN.captures(host);
 | 
			
		||||
 | 
			
		||||
    if !RE_DOMAIN.is_match(host) {
 | 
			
		||||
    if domain.is_none() {
 | 
			
		||||
        return Err("Invalid host provided".into());
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    let domain = RE_DOMAIN.captures(host).unwrap().get(1).unwrap().as_str();
 | 
			
		||||
    let domain = domain.unwrap().get(1).unwrap().as_str();
 | 
			
		||||
 | 
			
		||||
    let mut allowed = false;
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue