# \[ANN\] HTTP (The Gem!) 2.0.0: a fast, elegant HTTP client for Ruby

**URL:** <https://rubytalk.org/t/ann-http-the-gem-2-0-0-a-fast-elegant-http-client-for-ruby/73587>\
**Category:** ruby-talk\
**Created:** [23 April 2016 23:27 UTC](https://rubytalk.org/t/ann-http-the-gem-2-0-0-a-fast-elegant-http-client-for-ruby/73587 "2016-04-23T23:27:34Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Tony\_Arcieri1](https://yyz1.discourse-cdn.com/flex029/user_avatar/rubytalk.org/tony_arcieri1/32/1864_2.png) [@Tony\_Arcieri1](https://rubytalk.org/u/Tony_Arcieri1)\
**Post date:** [23 April 2016 23:27 UTC](https://rubytalk.org/t/ann-http-the-gem-2-0-0-a-fast-elegant-http-client-for-ruby/73587/1 "2016-04-23T23:27:34Z")

</div>

HTTP (The Gem!, a.k.a. http.rb) provides an elegant, chainable interface  
for building HTTP requests, similar to Python's "Requests" library. Think  
ActiveRecord or JQuery for building HTTP requests. Its API is hopefully  
intuitive and just does what you expect (unlike, say, Net::HTTP).

Web site: [https://github.com/](https://github.com/) \<[https://github.com/httprb/http](https://github.com/httprb/http)\>httprb/http  
\<[https://github.com/httprb/http](https://github.com/httprb/http)\>

Unlike most other Ruby HTTP clients which aim to provide a good API, it is  
\*not\* built on top of Net::HTTP, but instead natively implements the HTTP  
protocol, building on the natively implemented http\_parser.rb gem (which  
contains the Node.js parser and a Java port for JRuby). This makes http.rb  
one of the fastest Ruby HTTP clients available. It also supports persistent  
"keep-alive" connections and fine-grained timeouts implemented using an  
asynchronous socket layer instead of timeout.rb (which has thread safety  
problems).

The 2.0.0 release includes some breaking API changes: we dropped Ruby 1.9  
support and changed the exceptions raised for I/O errors so they're all  
subclassed from HTTP::ConnectionError, which should make error handling  
easier.

A handful of other issues were fixed. You can find them documented in  
[CHANGES.md](http://CHANGES.md) \<[https://github.com/httprb/http/blob/master/CHANGES.md](https://github.com/httprb/http/blob/master/CHANGES.md)\>.

> **···**
>
> --  
> Tony Arcieri

---

<div class="post-metadata">

**Author:** ![Peter\_Fitzgibbons](https://avatars.discourse-cdn.com/v4/letter/p/e56c9b/32.png) [@Peter\_Fitzgibbons](https://rubytalk.org/u/Peter_Fitzgibbons)\
**Post date:** [28 April 2016 12:35 UTC](https://rubytalk.org/t/ann-http-the-gem-2-0-0-a-fast-elegant-http-client-for-ruby/73587/2 "2016-04-28T12:35:22Z")

</div>

Dude! Tony you are officially my hero.

I have used HTTP in Ruby with trepidation for years and years due to  
Net::HTTP's terrible timeout code.  
Thankyou for producing a correct implementation!

- Peter Fitzgibbons

---

<div class="post-metadata">

**Author:** ![gvim](https://avatars.discourse-cdn.com/v4/letter/g/a3d4f5/32.png) [@gvim](https://rubytalk.org/u/gvim)\
**Post date:** [28 April 2016 16:26 UTC](https://rubytalk.org/t/ann-http-the-gem-2-0-0-a-fast-elegant-http-client-for-ruby/73587/3 "2016-04-28T16:26:05Z")

</div>

Is it fair to say, with excellent gems such as this, that Ruby matches Python as far as web scraping and http/url handling goes? Agreed, SciRuby isn't quite on a par with Python (yet) but I like to keep a mental note of what exactly one needs Python for these days.

gvim

> **···**
>
> On 24/04/2016 00:27, Tony Arcieri wrote:
> 
> > HTTP (The Gem!, a.k.a. http.rb) provides an elegant, chainable interface  
> > for building HTTP requests, similar to Python's "Requests" library.  
> > Think ActiveRecord or JQuery for building HTTP requests. Its API is  
> > hopefully intuitive and just does what you expect (unlike, say, Net::HTTP).
> > 
> > Web site: [https://github.com/](https://github.com/)  
> > \<[https://github.com/httprb/http&gt;httprb/http](https://github.com/httprb/http&gt;httprb/http) \<[https://github.com/httprb/http&gt](https://github.com/httprb/http&gt);
> > 
> > Unlike most other Ruby HTTP clients which aim to provide a good API, it  
> > is \*not\* built on top of Net::HTTP, but instead natively implements the  
> > HTTP protocol, building on the natively implemented http\_parser.rb gem  
> > (which contains the Node.js parser and a Java port for JRuby). This  
> > makes http.rb one of the fastest Ruby HTTP clients available. It also  
> > supports persistent "keep-alive" connections and fine-grained timeouts  
> > implemented using an asynchronous socket layer instead of timeout.rb  
> > (which has thread safety problems).
> > 
> > The 2.0.0 release includes some breaking API changes: we dropped Ruby  
> > 1.9 support and changed the exceptions raised for I/O errors so they're  
> > all subclassed from HTTP::ConnectionError, which should make error  
> > handling easier.
> > 
> > A handful of other issues were fixed. You can find them documented in  
> > CHANGES.md \<[https://github.com/httprb/http/blob/master/CHANGES.md&gt;\](https://github.com/httprb/http/blob/master/CHANGES.md&gt;%5C).
> > 
> > --  
> > Tony Arcieri
