Ruby modules for HTTP clienting

E

Eli Bendersky

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
 
E

Eli Bendersky

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 ?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,202
Messages
2,571,057
Members
47,667
Latest member
DaniloB294

Latest Threads

Top