Using Authentication with Open-uri #
Obviously big fans of open-uri
around here. And development of open-uri
has continued with the addition of HTTP Basic authentication, newly implemented in both HEAD
and ruby_1_8
branches of CVS.
open("http://...", :http_basic_authentication=>[user, password])
I should note that this was implemented at the behest of Kent Sibilev. So, hey, does anyone else have open-uri
wishes? (And please don’t say HTTPS. Tanaka-san has a preliminary patch here and, believe me, that dog is running.)
Within hours, HTTPS support is checked in. Just like that. Faster than a beaver tale.
gab
I won’t say the h* word. But it is ubercool :)
Wejn
Hmm, maybe having support for the
http://user:pass@domain/
type of urls would be even better.Kent
That what I proposed in the first place, but this approach has some security problems.
why
Wejn: well, calling a URL with
userinfo
filled like the above will continue to work in the 1.8 series actually.Running under 1.9 will toss an exception, though, since it’s deprecated in RFC 3986 :
cilibrar
Huzzah! Huzzah! Down with cleartext! Away with passwords! I think we need a one-time-password library in Ruby like S/Key or something. Huzzah!
Comments are closed for this entry.