Permalink
Browse files

Initial commit

  • Loading branch information...
0 parents commit 0f942cafbf3d29e337145cf36b9cdd85d0da0860 @bpardee committed Oct 3, 2010
Showing with 1,270 additions and 0 deletions.
  1. +4 −0 .gitignore
  2. +4 −0 History.txt
  3. +20 −0 LICENSE
  4. +58 −0 README.rdoc
  5. +16 −0 Rakefile
  6. +1 −0 VERSION
  7. +444 −0 lib/persistent_http.rb
  8. +27 −0 lib/persistent_http/faster.rb
  9. +49 −0 persistent_http.gemspec
  10. +647 −0 test/persistent_http_test.rb
@@ -0,0 +1,4 @@
+/TAGS
+/pkg
+/doc
+*.swp
@@ -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 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.
@@ -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.
@@ -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
@@ -0,0 +1 @@
+1.0.0
Oops, something went wrong.

0 comments on commit 0f942ca

Please sign in to comment.