Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/elcuervo/net-http-pool
Persistent HTTP connection pool
https://github.com/elcuervo/net-http-pool
Last synced: 3 months ago
JSON representation
Persistent HTTP connection pool
- Host: GitHub
- URL: https://github.com/elcuervo/net-http-pool
- Owner: elcuervo
- Created: 2012-02-13T01:59:27.000Z (almost 13 years ago)
- Default Branch: master
- Last Pushed: 2012-04-13T00:44:27.000Z (over 12 years ago)
- Last Synced: 2024-10-05T21:46:57.408Z (3 months ago)
- Language: Ruby
- Homepage:
- Size: 130 KB
- Stars: 9
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Net::HTTP::Pool
[![Build Status](https://secure.travis-ci.org/elcuervo/net-http-pool.png?branch=master)](http://travis-ci.org/elcuervo/net-http-pool)
![Pool](http://www.beijingboyce.com/wp-content/uploads/2008/03/pool-table.JPG)
Act like a database pool but for HTTP.
It will attempt to open (default: 5) persistent connections to a given server.
Then you can make your requests as you want and the pool get recycled.
The implementation it's made throght actors (celluloid) so the behaviour in the
verb block it's async.The target of the lib it's to provide DB-like pool to handle information
exchange.## Motivation
The main goal it's to provide a easy to use HTTP pool exploiting HTTP 1.1
persistent connections in a non-blocking way.## Example
```ruby
require 'net/http/pool'pool = Net::HTTP::Pool.new("http://elcuervo.co")
request = Net::HTTP::Get.new("/humans.txt")pool.request(request) do |response|
File.open('nevermore.txt', 'w') { |f| f << response.body } if response.code == "200"
end
```## Thanks to
* [@foca](http://github.com/foca) and [@dcadenas](http://github.com/dcadenas)
for code-review and corrections.