Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 83 lines (57 sloc) 2.753 kb
48a6e05 Eric Hodel Add back rubyforge plugin
authored
1 = net-http-persistent
ddc3cde Eric Hodel Thread-safe persistent connections for Net::HTTP.
authored
2
3113ea5 Eric Hodel Use the newer URL for docs
authored
3 * http://docs.seattlerb.org/net-http-persistent
861008b Eric Hodel Add github URL
authored
4 * https://github.com/drbrain/net-http-persistent
ddc3cde Eric Hodel Thread-safe persistent connections for Net::HTTP.
authored
5
6 == DESCRIPTION:
7
88f78fb Eric Hodel Update history for 1.8.1, tweak README text to mention Ruby 1.8
authored
8 Manages persistent connections using Net::HTTP plus a speed fix for Ruby 1.8.
9 It's thread-safe too!
ddc3cde Eric Hodel Thread-safe persistent connections for Net::HTTP.
authored
10
186d44c Eric Hodel Better README.txt
authored
11 Using persistent HTTP connections can dramatically increase the speed of HTTP.
12 Creating a new HTTP connection for every request involves an extra TCP
13 round-trip and causes TCP congestion avoidance negotiation to start over.
14
15 Net::HTTP supports persistent connections with some API methods but does not
8d11769 Eric Hodel Add timeout to reset connections that have been idle too long.
authored
16 handle reconnection gracefully. Net::HTTP::Persistent supports reconnection
88f78fb Eric Hodel Update history for 1.8.1, tweak README text to mention Ruby 1.8
authored
17 and retry according to RFC 2616.
186d44c Eric Hodel Better README.txt
authored
18
ddc3cde Eric Hodel Thread-safe persistent connections for Net::HTTP.
authored
19 == FEATURES/PROBLEMS:
20
21 * Supports SSL
22 * Thread-safe
23 * Pure ruby
88f78fb Eric Hodel Update history for 1.8.1, tweak README text to mention Ruby 1.8
authored
24 * Timeout-less speed boost for Ruby 1.8 (by Aaron Patterson)
ddc3cde Eric Hodel Thread-safe persistent connections for Net::HTTP.
authored
25
7f8fc8f Aaron Patterson Adding example usage to the readme
tenderlove authored
26 == SYNOPSIS
27
28 The following example will make two requests to the same server. The
29 connection is kept alive between requests:
30
31 require 'net/http/persistent'
f29d8a7 Eric Hodel Fix missing = in SYNOPSIS for POST. Submitted by inject
authored
32
7f8fc8f Aaron Patterson Adding example usage to the readme
tenderlove authored
33 uri = URI 'http://example.com/awesome/web/service'
f29d8a7 Eric Hodel Fix missing = in SYNOPSIS for POST. Submitted by inject
authored
34
7f8fc8f Aaron Patterson Adding example usage to the readme
tenderlove authored
35 http = Net::HTTP::Persistent.new 'my_app_name'
f29d8a7 Eric Hodel Fix missing = in SYNOPSIS for POST. Submitted by inject
authored
36
7f8fc8f Aaron Patterson Adding example usage to the readme
tenderlove authored
37 # perform a GET
38 response = http.request uri
f29d8a7 Eric Hodel Fix missing = in SYNOPSIS for POST. Submitted by inject
authored
39
7f8fc8f Aaron Patterson Adding example usage to the readme
tenderlove authored
40 # create a POST
41 post_uri = uri + 'create'
42 post = Net::HTTP::Post.new post_uri.path
43 post.set_form_data 'some' => 'cool data'
f29d8a7 Eric Hodel Fix missing = in SYNOPSIS for POST. Submitted by inject
authored
44
7f8fc8f Aaron Patterson Adding example usage to the readme
tenderlove authored
45 # perform the POST, the URI is always required
f29d8a7 Eric Hodel Fix missing = in SYNOPSIS for POST. Submitted by inject
authored
46 response = http.request post_uri, post
7f8fc8f Aaron Patterson Adding example usage to the readme
tenderlove authored
47
99946f0 Eric Hodel Improved documentation of #shutdown and when to use it. Fixes #20
authored
48 # if you are done making http requests, or won't make requests for several
49 # minutes
50 http.shutdown
51
52 Please see the documentation on Net::HTTP::Persistent for more information,
53 including SSL connection verification, header handling and tunable options.
7f8fc8f Aaron Patterson Adding example usage to the readme
tenderlove authored
54
ddc3cde Eric Hodel Thread-safe persistent connections for Net::HTTP.
authored
55 == INSTALL:
56
57 gem install net-http-persistent
58
59 == LICENSE:
60
61 (The MIT License)
62
63 Copyright (c) 2010 Eric Hodel, Aaron Patterson
64
65 Permission is hereby granted, free of charge, to any person obtaining
66 a copy of this software and associated documentation files (the
67 'Software'), to deal in the Software without restriction, including
68 without limitation the rights to use, copy, modify, merge, publish,
69 distribute, sublicense, and/or sell copies of the Software, and to
70 permit persons to whom the Software is furnished to do so, subject to
71 the following conditions:
72
73 The above copyright notice and this permission notice shall be
74 included in all copies or substantial portions of the Software.
75
76 THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
77 EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
78 MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
79 IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
80 CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
81 TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
82 SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Something went wrong with that request. Please try again.