Browse Source
			
			
			When receiving a comma separated list as IP, pick the first
			
			
				pull/800/head
			
			
		 
		
			
				
					
						
						Daniel García
					
					6 years ago
					
				 
				
			 
		 
		
			
				
					
					No known key found for this signature in database
					
						
							GPG Key ID: FC8A7D14C3CD543A
						
					
				
			
		
		
		
	
		
			
				 1 changed files with 
7 additions and 
3 deletions
			 
			
		 
		
			
				- 
					
					
					 
					src/auth.rs
				
 
			
		
		
			
			
			
			
			
			
				
				
					
						
							
								
									
	
		
			
				
					| 
						
						
							
								
							
						
						
					 | 
				
				 | 
				
					@ -429,8 +429,12 @@ impl<'a, 'r> FromRequest<'a, 'r> for ClientIp { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    fn from_request(req: &'a Request<'r>) -> request::Outcome<Self, Self::Error> { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        let ip = if CONFIG._ip_header_enabled() { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            req.headers().get_one(&CONFIG.ip_header()).and_then(|ip| { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                ip.parse() | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    .map_err(|_| warn_!("'{}' header is malformed: {}", CONFIG.ip_header(), ip)) | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                match ip.find(',') { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    Some(idx) => &ip[..idx], | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    None => ip, | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                .parse() | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                .map_err(|_| warn!("'{}' header is malformed: {}", CONFIG.ip_header(), ip)) | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                .ok() | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            }) | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        } else { | 
				
			
			
		
	
	
		
			
				
					| 
						
							
								
							
						
						
						
					 | 
				
				 | 
				
					
  |