net-http-digest_auth
net-http-digest_auth copied to clipboard
HTTPS support
I got this error when I'm trying to get response from HTTPS url (ie uri = URI.parse 'https://localhost:8000/')
/usr/local/rvm/gems/ruby-2.1.1@rails4/gems/net-http-digest_auth-1.4/lib/net/http/digest_auth.rb:87:in `auth_header': undefined method `gsub' for nil:NilClass (NoMethodError)
from file.rb:22:in `<main>'
What are you sending as the WWW-Authenticate header?
puts res['www-authenticate']
auth = digest_auth.auth_header uri, res['www-authenticate'], 'GET'
puts returns :
negotiate, digest nonce="636581428587179706342730467643667776813115625137678420954", realm="someserver.com", algorithm="md5"
Does this raise an exception?
I'm sorry, but I'm still new with Ruby. I tried this :
begin
auth = digest_auth.auth_header uri, res['www-authenticate'], 'GET'
rescue Exception => msg
puts msg
end
and result is:
undefined method `gsub' for nil:NilClass
Ok. The problem is with the "negotiate" option in the header. Until I fix your bug you can strip it before calling auth_header
This is fixed by #16.