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).
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.
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!
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).
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.