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:
parent
e927f06b25
commit
6e23c23518
1 changed files with 3 additions and 1 deletions
|
@ -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)
|
||||
|
|
Loading…
Reference in a new issue