[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Ruby modules for HTTP clienting

Eli Bendersky

3/18/2006 12:45:00 PM

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

1 Answer

Eli Bendersky

3/18/2006 2:10:00 PM

0

> 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 ?
>

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 ?