diff options
author | Prem Sichanugrist <s@sikachu.com> | 2010-01-16 20:51:42 +0700 |
---|---|---|
committer | José Valim <jose.valim@gmail.com> | 2010-01-17 16:56:54 +0100 |
commit | eb67532bc1c1ce5c494b71b980c04c8aa83efb74 (patch) | |
tree | 1098a72023ae0b0919b8894ed34dd8222da0a469 /actionpack/lib | |
parent | a0dc6cc70b694349a592b42ec3b58001ce82fec9 (diff) | |
download | rails-eb67532bc1c1ce5c494b71b980c04c8aa83efb74.tar.gz rails-eb67532bc1c1ce5c494b71b980c04c8aa83efb74.tar.bz2 rails-eb67532bc1c1ce5c494b71b980c04c8aa83efb74.zip |
Make local_request? to returns true when facing ::1 IPv6 address [#3257 status:resolved]
Signed-off-by: José Valim <jose.valim@gmail.com>
Diffstat (limited to 'actionpack/lib')
-rw-r--r-- | actionpack/lib/action_dispatch/middleware/show_exceptions.rb | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/actionpack/lib/action_dispatch/middleware/show_exceptions.rb b/actionpack/lib/action_dispatch/middleware/show_exceptions.rb index 0977f5c60a..3bcd004e12 100644 --- a/actionpack/lib/action_dispatch/middleware/show_exceptions.rb +++ b/actionpack/lib/action_dispatch/middleware/show_exceptions.rb @@ -20,7 +20,7 @@ module ActionDispatch # * :exception - The exception raised; # class ShowExceptions - LOCALHOST = '127.0.0.1'.freeze + LOCALHOST = ['127.0.0.1', '::1'].freeze RESCUES_TEMPLATE_PATH = File.join(File.dirname(__FILE__), 'templates') @@ -118,7 +118,7 @@ module ActionDispatch # True if the request came from localhost, 127.0.0.1. def local_request?(request) - request.remote_addr == LOCALHOST && request.remote_ip == LOCALHOST + LOCALHOST.any?{ |local_ip| request.remote_addr == local_ip && request.remote_ip == local_ip } end def status_code(exception) |