From 41365a8275dcb6d2e2fbe21ae2b2dfc52db19c1f Mon Sep 17 00:00:00 2001 From: Colin Shield & Ian Lesperance Date: Wed, 28 Sep 2011 15:23:47 -0700 Subject: Fixed digest authentication for requests with a query string [#3158] --- activeresource/lib/active_resource/connection.rb | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'activeresource/lib/active_resource') diff --git a/activeresource/lib/active_resource/connection.rb b/activeresource/lib/active_resource/connection.rb index d923204dde..592fca96a4 100644 --- a/activeresource/lib/active_resource/connection.rb +++ b/activeresource/lib/active_resource/connection.rb @@ -238,8 +238,11 @@ module ActiveResource def digest_auth_header(http_method, uri) params = extract_params_from_response + request_uri = uri.path + request_uri << "?#{uri.query}" if uri.query + ha1 = Digest::MD5.hexdigest("#{@user}:#{params['realm']}:#{@password}") - ha2 = Digest::MD5.hexdigest("#{http_method.to_s.upcase}:#{uri.path}") + ha2 = Digest::MD5.hexdigest("#{http_method.to_s.upcase}:#{request_uri}") params.merge!('cnonce' => client_nonce) request_digest = Digest::MD5.hexdigest([ha1, params['nonce'], "0", params['cnonce'], params['qop'], ha2].join(":")) -- cgit v1.2.3