File tree Expand file tree Collapse file tree 1 file changed +3
-2
lines changed 
actionpack/lib/action_dispatch/http Expand file tree Collapse file tree 1 file changed +3
-2
lines changed Original file line number Diff line number Diff line change @@ -17,7 +17,8 @@ class Request < Rack::Request
1717    include  ActionDispatch ::Http ::Upload 
1818    include  ActionDispatch ::Http ::URL 
1919
20-     LOCALHOST    =  [ /^127\. 0\. 0\. \d {1,3}$/ ,  "::1" ,  /^0:0:0:0:0:0:0:1(%.*)?$/ ] . freeze 
20+     LOCALHOST    =  Regexp . union  [ /^127\. 0\. 0\. \d {1,3}$/ ,  /^::1$/ ,  /^0:0:0:0:0:0:0:1(%.*)?$/ ] 
21+ 
2122    ENV_METHODS  =  %w[  AUTH_TYPE  GATEWAY_INTERFACE 
2223        PATH_TRANSLATED  REMOTE_HOST 
2324        REMOTE_IDENT  REMOTE_USER  REMOTE_ADDR 
@@ -250,7 +251,7 @@ def authorization
250251
251252    # True if the request came from localhost, 127.0.0.1. 
252253    def  local? 
253-       LOCALHOST . any?   {  | local_ip |  local_ip  ===  remote_addr  && local_ip  ===  remote_ip   } 
254+       LOCALHOST  =~  remote_addr  && LOCALHOST  =~  remote_ip 
254255    end 
255256
256257    private 
 
 
   
 
     
   
   
          
    
    
     
    
      
     
     
    You can’t perform that action at this time.
  
 
    
  
    
      
        
     
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments