Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
bpardee committed Oct 3, 2010
0 parents commit 0f942ca
Show file tree
Hide file tree
Showing 10 changed files with 1,270 additions and 0 deletions.
4 changes: 4 additions & 0 deletions .gitignore
@@ -0,0 +1,4 @@
/TAGS
/pkg
/doc
*.swp
4 changes: 4 additions & 0 deletions History.txt
@@ -0,0 +1,4 @@
=== 1.0.0 / 2010-09-16

* Major Enhancements
* Based on drbrain/net-http-persistent but uses a connection pool instead of connection/thread
20 changes: 20 additions & 0 deletions LICENSE
@@ -0,0 +1,20 @@
Copyright (c) 2010 Eric Hodel, Aaron Patterson

Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
'Software'), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:

The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
58 changes: 58 additions & 0 deletions README.rdoc
@@ -0,0 +1,58 @@
= persistent_http

* http://github.com/bpardee/persistent_http

== DESCRIPTION:

Persistent connections using Net::HTTP with a connection pool.

This is based on Eric Holder's Net::HTTP::Persistent libary but uses
a connection pool of Net::HTTP objects instead of a connection per
thread. C/T is fine if you're only using your http threads to make
connections but if you use them in child threads then I suspect you
will have a thread memory leak. Also, you will generally get less
connection resets if the most recently used connection is always
returned.

== FEATURES/PROBLEMS:

* Supports SSL
* Thread-safe
* Pure ruby
* Timeout-less speed boost for 1.8 (by Aaron Patterson)

== INSTALL:

gem install persistent_http

== EXAMPLE USAGE:

require 'persistent_http'

class MyHTTPClient
@@persistent_http = PersistentHTTP.new(
:name => 'MyHTTPClient',
:logger => Rails.logger,
:pool_size => 10,
:warn_timeout => 0.25,
:force_retry => true,
:url => 'https://www.example.com/echo/foo' # equivalent to :use_ssl => true, :host => 'www.example.com', :default_path => '/echo/foo'
)

def send_get_message
response = @@persistent_http.request
... Handle response as you would a normal Net::HTTPResponse ...
end

def send_post_message
request = Net::HTTP::Post.new('/perform_service)
... Modify request as needed ...
response = @@persistent_http.request(request)
... Handle response as you would a normal Net::HTTPResponse ...
end
end


== Copyright

Copyright (c) 2010 Eric Hodel, Aaron Patterson, Brad Pardee. See LICENSE for details.
16 changes: 16 additions & 0 deletions Rakefile
@@ -0,0 +1,16 @@
require 'rubygems'
require 'rake'

begin
require 'jeweler'
Jeweler::Tasks.new do |gemspec|
gemspec.name = "persistent_http"
gemspec.summary = "Persistent HTTP connections using a connection pool"
gemspec.description = "Persistent HTTP connections using a connection pool"
gemspec.email = "bradpardee@gmail.com"
gemspec.homepage = "http://github.com/bpardee/persistent_http"
gemspec.authors = ["Brad Pardee"]
end
rescue LoadError
puts "Jeweler not available. Install it with: gem install jeweler"
end
1 change: 1 addition & 0 deletions VERSION
@@ -0,0 +1 @@
1.0.0

0 comments on commit 0f942ca

Please sign in to comment.