Skip to content

Commit

Permalink
Fix digest auth when multiple headers are sent by the server
Browse files Browse the repository at this point in the history
Digest authentication would fail if more than one header was sent as
part of the response. Look specifically for the "Digest" word as part of
the www-authenticate header.

This fixes issue jnunemaker#271.
  • Loading branch information
jsternberg committed Feb 12, 2014
1 parent 3b513d8 commit ddba90c
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/httparty/net_digest_auth.rb
Expand Up @@ -44,9 +44,9 @@ def authorization_header
private

def parse(response_header)
response_header['www-authenticate'] =~ /^(\w+) (.*)/
response_header['www-authenticate'] =~ /Digest (.*)/
params = {}
$2.gsub(/(\w+)="(.*?)"/) { params[$1] = $2 }
$1.gsub(/(\w+)="(.*?)"/) { params[$1] = $2 }
params
end

Expand Down

0 comments on commit ddba90c

Please sign in to comment.