diff options
author | Carlos Antonio da Silva <carlosantoniodasilva@gmail.com> | 2012-01-12 14:35:43 -0200 |
---|---|---|
committer | Carlos Antonio da Silva <carlosantoniodasilva@gmail.com> | 2012-01-12 14:35:43 -0200 |
commit | 6e23c235184ecc72f4e68508fda91bba0652b6e2 (patch) | |
tree | 04cbbadda5842270eab94177e808dbe4e5bb883a /actionpack/lib/action_dispatch | |
parent | e927f06b2528bef52087dd12f012c20ab26fb59c (diff) | |
download | rails-6e23c235184ecc72f4e68508fda91bba0652b6e2.tar.gz rails-6e23c235184ecc72f4e68508fda91bba0652b6e2.tar.bz2 rails-6e23c235184ecc72f4e68508fda91bba0652b6e2.zip |
Extract ip host regexp to a constant
Diffstat (limited to 'actionpack/lib/action_dispatch')
-rw-r--r-- | actionpack/lib/action_dispatch/http/url.rb | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/actionpack/lib/action_dispatch/http/url.rb b/actionpack/lib/action_dispatch/http/url.rb index 64459836b5..2367231359 100644 --- a/actionpack/lib/action_dispatch/http/url.rb +++ b/actionpack/lib/action_dispatch/http/url.rb @@ -1,6 +1,8 @@ module ActionDispatch module Http module URL + IP_HOST_REGEXP = /\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/ + mattr_accessor :tld_length self.tld_length = 1 @@ -52,7 +54,7 @@ module ActionDispatch private def named_host?(host) - !(host.nil? || /\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/.match(host)) + !(host.nil? || IP_HOST_REGEXP.match(host)) end def rewrite_authentication(options) |