mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Make Request#subdomains handle "foo.foo.com" correctly
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@1817 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
This commit is contained in:
parent
fae7311b9c
commit
847f738cfd
3 changed files with 8 additions and 1 deletions
|
@ -1,3 +1,7 @@
|
|||
*SVN*
|
||||
|
||||
* Fixed Request#subdomains to handle "foo.foo.com" correctly
|
||||
|
||||
*1.9.1* (11 July, 2005)
|
||||
|
||||
* Fixed that auto_complete_for didn't force the input string to lower case even as the db comparison was
|
||||
|
|
|
@ -116,7 +116,7 @@ module ActionController
|
|||
# in "www.rubyonrails.co.uk".
|
||||
def subdomains(tld_length = 1)
|
||||
parts = host.split('.')
|
||||
parts - parts.last(1 + tld_length)
|
||||
parts[0..-(tld_length+2)]
|
||||
end
|
||||
|
||||
# Receive the raw post data.
|
||||
|
|
|
@ -55,6 +55,9 @@ class RequestTest < Test::Unit::TestCase
|
|||
|
||||
@request.host = "dev.www.rubyonrails.co.uk"
|
||||
assert_equal %w( dev www ), @request.subdomains(2)
|
||||
|
||||
@request.host = "foobar.foobar.com"
|
||||
assert_equal %w( foobar ), @request.subdomains
|
||||
end
|
||||
|
||||
def test_port_string
|
||||
|
|
Loading…
Reference in a new issue