Forum: Ruby Ruby modules for HTTP clienting

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Eli B. (Guest)
on 2006-03-18 14:50
(Received via mailing list)
Hello,

I'm a Perl programmer in transition to Ruby. One of the biggest
problems with such a transition is the relative lack of modules in the
Ruby world. CPAN has made us Perl hackers lazy and over-confident :-)

I am doing some HTTP "clienting" work, and want to port it to Ruby. In
Perl I use the LWP::UserAgent, HTTP::Request and HTTP::Headers modules
for this purpose. I'm sure Ruby has an equivalent - could someone
please point me to the module I need ?
Also, LWP::UserAgent is smart enough to use SSL if the connection is
HTTPS and uses the Perl module Crypt::SSLeay for that. I hope this also
has a parallel in Ruby ?

Thanks in advance
Eli
Eli B. (Guest)
on 2006-03-18 16:16
(Received via mailing list)
> Also, LWP::UserAgent is smart enough to use SSL if the connection is
> HTTPS and uses the Perl module Crypt::SSLeay for that. I hope this also
> has a parallel in Ruby ?
>

It seems that what I was looking for is Net::HTTP

One question though - I want to use basic authentication (connecting to
an Atom feed with user/password). This works:

req.basic_auth(username, password)

However, this doesn't, although I think it should:

encoded_userpass = Base64.encode64(user + ':' + pass)
req.add_field('Authorization', "Basic #{encoded_userpass}")

What am I missing ?
This topic is locked and can not be replied to.