diff options
author | Prem Sichanugrist <s@sikachu.com> | 2010-06-06 16:56:48 -0400 |
---|---|---|
committer | José Valim <jose.valim@gmail.com> | 2010-06-08 19:45:40 +0200 |
commit | c6ad64394b927a64a221a89087ec1ea7d666ed55 (patch) | |
tree | 99e84fc6b34732caf2ccf0f09ea3d4909683b915 /actionpack/lib/action_dispatch | |
parent | a7edddf605d2ffbb6669365dcd23d6e4c6c2cf84 (diff) | |
download | rails-c6ad64394b927a64a221a89087ec1ea7d666ed55.tar.gz rails-c6ad64394b927a64a221a89087ec1ea7d666ed55.tar.bz2 rails-c6ad64394b927a64a221a89087ec1ea7d666ed55.zip |
Make sure that rails recognized the full notation of IPv6 loopback address, and recognize 127.0.0.0/8 in IPv4
Signed-off-by: José Valim <jose.valim@gmail.com>
Diffstat (limited to 'actionpack/lib/action_dispatch')
-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 f9e81a02d3..b32e7be31f 100644 --- a/actionpack/lib/action_dispatch/middleware/show_exceptions.rb +++ b/actionpack/lib/action_dispatch/middleware/show_exceptions.rb @@ -6,7 +6,7 @@ module ActionDispatch # This middleware rescues any exception returned by the application and renders # nice exception pages if it's being rescued locally. class ShowExceptions - LOCALHOST = ['127.0.0.1', '::1'].freeze + LOCALHOST = [/^127\.0\.0\.\d{1,3}$/, /^::1$/, /^0:0:0:0:0:0:0:1(%.*)?$/].freeze RESCUES_TEMPLATE_PATH = File.join(File.dirname(__FILE__), 'templates') @@ -114,7 +114,7 @@ module ActionDispatch # True if the request came from localhost, 127.0.0.1. def local_request?(request) - LOCALHOST.any?{ |local_ip| request.remote_addr == local_ip && request.remote_ip == local_ip } + LOCALHOST.any?{ |local_ip| request.remote_addr =~ local_ip && request.remote_ip =~ local_ip } end def status_code(exception) |