Skip to content
New issue

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

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HTTPS support #13

Open
dsoronda opened this issue Jan 14, 2015 · 6 comments
Open

HTTPS support #13

dsoronda opened this issue Jan 14, 2015 · 6 comments

Comments

@dsoronda
Copy link

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>'
@drbrain
Copy link
Owner

drbrain commented Jan 14, 2015

What are you sending as the WWW-Authenticate header?

@dsoronda
Copy link
Author

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"

@drbrain
Copy link
Owner

drbrain commented Jan 15, 2015

Does this raise an exception?

@dsoronda
Copy link
Author

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

@drbrain
Copy link
Owner

drbrain commented Jan 16, 2015

Ok. The problem is with the "negotiate" option in the header. Until I fix your bug you can strip it before calling auth_header

@paulvt
Copy link

paulvt commented Mar 15, 2018

This is fixed by #16.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants