aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack
diff options
context:
space:
mode:
Diffstat (limited to 'actionpack')
-rw-r--r--actionpack/CHANGELOG4
-rwxr-xr-xactionpack/lib/action_controller/request.rb2
-rw-r--r--actionpack/test/controller/request_test.rb3
3 files changed, 8 insertions, 1 deletions
diff --git a/actionpack/CHANGELOG b/actionpack/CHANGELOG
index da22956572..46ef1d4212 100644
--- a/actionpack/CHANGELOG
+++ b/actionpack/CHANGELOG
@@ -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
diff --git a/actionpack/lib/action_controller/request.rb b/actionpack/lib/action_controller/request.rb
index 7a8fe49d0f..c41146f56a 100755
--- a/actionpack/lib/action_controller/request.rb
+++ b/actionpack/lib/action_controller/request.rb
@@ -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.
diff --git a/actionpack/test/controller/request_test.rb b/actionpack/test/controller/request_test.rb
index 8980ac7520..8b079df5dd 100644
--- a/actionpack/test/controller/request_test.rb
+++ b/actionpack/test/controller/request_test.rb
@@ -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