1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

Extract ip host regexp to a constant

This commit is contained in:
Carlos Antonio da Silva 2012-01-12 14:35:43 -02:00
parent e927f06b25
commit 6e23c23518

View file

@ -1,6 +1,8 @@
module ActionDispatch module ActionDispatch
module Http module Http
module URL module URL
IP_HOST_REGEXP = /\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/
mattr_accessor :tld_length mattr_accessor :tld_length
self.tld_length = 1 self.tld_length = 1
@ -52,7 +54,7 @@ module ActionDispatch
private private
def named_host?(host) 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 end
def rewrite_authentication(options) def rewrite_authentication(options)