Permalink
Browse files

Fix digest auth when multiple headers are sent by the server

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 #271.
  • Loading branch information...
1 parent 3b513d8 commit ddba90c87596bbd2ea035a557b9fdac6ec86fdf0 @jsternberg jsternberg committed Feb 12, 2014
Showing with 2 additions and 2 deletions.
  1. +2 −2 lib/httparty/net_digest_auth.rb
@@ -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

0 comments on commit ddba90c

Please sign in to comment.