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

userpwd words but setting username and password individually doesn't, hmm #88

Open
ifightcrime opened this Issue Oct 23, 2011 · 3 comments

Comments

Projects
None yet
3 participants

Is there a reason why when using basic auth setting username and password separately doesn't work but using userpwd works fine?

I'm not sure why, but that's what's happening on my box.

centos 5
rvm ruby 1.9.2

Not a big deal because my workaround is obviously setting them together, but just though I would bring it to your attention.

ruby-1.9.2-p290 :002 > c = Curl::Easy.new("place") do |curl|
ruby-1.9.2-p290 :003 > curl.verbose = true
ruby-1.9.2-p290 :004?> end
=> #<Curl::Easy nick.dev.fbsdata.com>
ruby-1.9.2-p290 :005 > c.http_auth_types = :basic
=> :basic
ruby-1.9.2-p290 :006 > c.username = 'nick'
=> "nick"
ruby-1.9.2-p290 :007 > c.password = 'magicalpass'
=> "magicalpass"
ruby-1.9.2-p290 :008 > c.perform

  • About to connect() to blahblah port 80
  • Expire at 1319333700 / 554943 (300000ms)
  • Trying ip... * Expire at 1319333700 / 555062 (300000ms)
  • Expire at 1319333700 / 555102 (300000ms)
  • Connected to omg (ip) port 80

    GET / HTTP/1.1
    Host: goodness
    Accept: /

< HTTP/1.1 401 Authorization Required
< Date: Sun, 23 Oct 2011 01:30:00 GMT
< WWW-Authenticate: Basic realm="super place"
< Content-Length: 577
< Content-Type: text/html; charset=iso-8859-1

Owner

taf2 commented Oct 24, 2011

Yeah, it was probably a mistake of mine to introduce .username and .password when there was already a userpwd... The .username and .password use a newer libcurl API... I'll try to check into what's going wrong later today.

ahh, that would explain things. I was kind of leaning towards that being the problem. Thanks for taking a look! -Nick

Contributor

richmeyers commented Nov 4, 2011

Looks like https://github.com/taf2/curb/blob/master/ext/curb_easy.c#L1886 has the condition backwards. It should be if !nil && !nil. Or possibly !nil || !nil would be more correct, though perhaps not very useful.

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