aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/test/controller/http_digest_authentication_test.rb
diff options
context:
space:
mode:
authorPratik Naik <pratiknaik@gmail.com>2009-02-19 21:20:15 +0100
committerPratik Naik <pratiknaik@gmail.com>2009-02-19 21:20:15 +0100
commitd8f1ee4b41352b870f617b01099b2877f754d32c (patch)
treedd6bdf1d1ded6aab7bb926109a24e942fc740b73 /actionpack/test/controller/http_digest_authentication_test.rb
parent8ba1fc18e13c03966d411947180022c1730e81ff (diff)
parent7c0e008973e594ebf53607362c1dfbe34b693600 (diff)
downloadrails-d8f1ee4b41352b870f617b01099b2877f754d32c.tar.gz
rails-d8f1ee4b41352b870f617b01099b2877f754d32c.tar.bz2
rails-d8f1ee4b41352b870f617b01099b2877f754d32c.zip
Merge commit 'mainstream/master'
Diffstat (limited to 'actionpack/test/controller/http_digest_authentication_test.rb')
-rw-r--r--actionpack/test/controller/http_digest_authentication_test.rb11
1 files changed, 10 insertions, 1 deletions
diff --git a/actionpack/test/controller/http_digest_authentication_test.rb b/actionpack/test/controller/http_digest_authentication_test.rb
index 59f7a403b5..4913e7633b 100644
--- a/actionpack/test/controller/http_digest_authentication_test.rb
+++ b/actionpack/test/controller/http_digest_authentication_test.rb
@@ -107,6 +107,15 @@ class HttpDigestAuthenticationTest < ActionController::TestCase
assert_equal 'Definitely Maybe', @response.body
end
+ test "authentication request with relative URI" do
+ @request.env['HTTP_AUTHORIZATION'] = encode_credentials(:uri => "/", :username => 'pretty', :password => 'please')
+ get :display
+
+ assert_response :success
+ assert assigns(:logged_in)
+ assert_equal 'Definitely Maybe', @response.body
+ end
+
private
def encode_credentials(options)
@@ -120,7 +129,7 @@ class HttpDigestAuthenticationTest < ActionController::TestCase
credentials = decode_credentials(@response.headers['WWW-Authenticate'])
credentials.merge!(options)
- credentials.merge!(:uri => "http://#{@request.host}#{@request.env['REQUEST_URI']}")
+ credentials.reverse_merge!(:uri => "http://#{@request.host}#{@request.env['REQUEST_URI']}")
ActionController::HttpAuthentication::Digest.encode_credentials("GET", credentials, password)
end