# Ruby modules for HTTP clienting

**URL:** <https://www.ruby-forum.com/t/ruby-modules-for-http-clienting/55244>\
**Category:** Ruby\
**Created:** [March 18, 2006, 1:50pm UTC](https://www.ruby-forum.com/t/ruby-modules-for-http-clienting/55244 "2006-03-18T13:50:11Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![eliben](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/3bc359/32.png) [@eliben](https://www.ruby-forum.com/u/eliben)\
**Post date:** [March 18, 2006, 1:50pm UTC](https://www.ruby-forum.com/t/ruby-modules-for-http-clienting/55244/1 "2006-03-18T13:50:11Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![eliben](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/3bc359/32.png) [@eliben](https://www.ruby-forum.com/u/eliben)\
**Post date:** [March 18, 2006, 3:16pm UTC](https://www.ruby-forum.com/t/ruby-modules-for-http-clienting/55244/2 "2006-03-18T15:16:13Z")

</div>

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