Skip to content


Subversion checkout URL

You can clone with
Download ZIP


Digest auth fails when multiple authenticate headers are present #271

jsternberg opened this Issue · 2 comments

2 participants


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 jsternberg referenced this issue from a commit in jsternberg/httparty
@jsternberg jsternberg 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.

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

@jsternberg jsternberg closed this


Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.