Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

Digest auth fails when multiple authenticate headers are present #271

jsternberg opened this Issue Feb 12, 2014 · 2 comments


None yet
2 participants

jsternberg commented Feb 12, 2014

Digest auth doesn't work when there are multiple headers present. I have a web server where both the NTLM and Digest authorization headers are sent at the same time which causes HTTParty to fail. An example where the server shows the following:

WWW-Authenticate: NTLM, Digest .........

This produces the following error:

/home/jsternberg/httparty/lib/httparty/net_digest_auth.rb:49:in `parse': undefined method `gsub' for nil:NilClass (NoMethodError)
        from /home/jsternberg/httparty/lib/httparty/net_digest_auth.rb:18:in `initialize'
        from /home/jsternberg/httparty/lib/httparty/net_digest_auth.rb:7:in `new'
        from /home/jsternberg/httparty/lib/httparty/net_digest_auth.rb:7:in `digest_auth'
        from /home/jsternberg/httparty/lib/httparty/request.rb:162:in `setup_digest_auth'
        from /home/jsternberg/httparty/lib/httparty/request.rb:153:in `setup_raw_request'
        from /home/jsternberg/httparty/lib/httparty/request.rb:90:in `perform'
        from /home/jsternberg/httparty/lib/httparty.rb:499:in `perform_request'
        from /home/jsternberg/httparty/lib/httparty.rb:435:in `get'
        from test.rb:10:in `get'
        from test.rb:15:in `<main>'

jsternberg added a commit to jsternberg/httparty that referenced this issue Feb 12, 2014

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.

jsternberg commented Feb 14, 2014

This is fixed as part of the pull request #272.

@jsternberg jsternberg closed this Feb 14, 2014


jnunemaker commented Feb 14, 2014


Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment