net-http-persistent 1.6 → 1.6.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data.tar.gz.sig +0 -0
- data/History.txt +6 -0
- data/README.txt +10 -1
- data/Rakefile +3 -2
- data/lib/net/http/persistent.rb +3 -2
- data/test/test_net_http_persistent.rb +29 -0
- metadata +21 -28
- metadata.gz.sig +0 -0
data.tar.gz.sig
CHANGED
Binary file
|
data/History.txt
CHANGED
data/README.txt
CHANGED
@@ -1,12 +1,21 @@
|
|
1
1
|
= net-http-persistent
|
2
2
|
|
3
3
|
* http://seattlerb.rubyforge.org/net-http-persistent
|
4
|
+
* https://github.com/drbrain/net-http-persistent
|
4
5
|
|
5
6
|
== DESCRIPTION:
|
6
7
|
|
7
|
-
|
8
|
+
Manages persistent connections using Net::HTTP plus a speed fix for 1.8. It's
|
8
9
|
thread-safe too!
|
9
10
|
|
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
|
16
|
+
handle reconnection gracefully. net-http-persistent supports reconnection
|
17
|
+
according to RFC 2616.
|
18
|
+
|
10
19
|
== FEATURES/PROBLEMS:
|
11
20
|
|
12
21
|
* Supports SSL
|
data/Rakefile
CHANGED
@@ -5,11 +5,12 @@ require 'hoe'
|
|
5
5
|
|
6
6
|
Hoe.plugin :git
|
7
7
|
Hoe.plugin :minitest
|
8
|
-
Hoe.plugin :rubyforge
|
9
8
|
|
10
9
|
Hoe.spec 'net-http-persistent' do |p|
|
11
|
-
self.rubyforge_name = 'seattlerb'
|
12
10
|
developer 'Eric Hodel', 'drbrain@segment7.net'
|
11
|
+
|
12
|
+
rdoc_locations <<
|
13
|
+
'docs.seattlerb.org:/data/www/docs.seattlerb.org/net-http-persistent/'
|
13
14
|
end
|
14
15
|
|
15
16
|
# vim: syntax=Ruby
|
data/lib/net/http/persistent.rb
CHANGED
@@ -37,7 +37,7 @@ class Net::HTTP::Persistent
|
|
37
37
|
##
|
38
38
|
# The version of Net::HTTP::Persistent use are using
|
39
39
|
|
40
|
-
VERSION = '1.6'
|
40
|
+
VERSION = '1.6.1'
|
41
41
|
|
42
42
|
##
|
43
43
|
# Error class for errors raised by Net::HTTP::Persistent. Various
|
@@ -392,7 +392,8 @@ class Net::HTTP::Persistent
|
|
392
392
|
bad_response = true
|
393
393
|
retry
|
394
394
|
rescue IOError, EOFError, Timeout::Error,
|
395
|
-
Errno::ECONNABORTED, Errno::ECONNRESET, Errno::EPIPE
|
395
|
+
Errno::ECONNABORTED, Errno::ECONNRESET, Errno::EPIPE,
|
396
|
+
Errno::EINVAL => e
|
396
397
|
|
397
398
|
if retried or not idempotent? req
|
398
399
|
due_to = "(due to #{e.message} - #{e.class})"
|
@@ -522,6 +522,35 @@ class TestNetHttpPersistent < MiniTest::Unit::TestCase
|
|
522
522
|
assert_equal 1, reqs[c.object_id]
|
523
523
|
end
|
524
524
|
|
525
|
+
def test_request_invalid
|
526
|
+
c = basic_connection
|
527
|
+
def c.request(*a) raise Errno::EINVAL, "write" end
|
528
|
+
|
529
|
+
e = assert_raises Net::HTTP::Persistent::Error do
|
530
|
+
@http.request @uri
|
531
|
+
end
|
532
|
+
|
533
|
+
assert_equal 0, reqs[c.object_id]
|
534
|
+
assert_match %r%too many connection resets%, e.message
|
535
|
+
end
|
536
|
+
|
537
|
+
def test_request_invalid_retry
|
538
|
+
c = basic_connection
|
539
|
+
def c.request(*a)
|
540
|
+
if defined? @called then
|
541
|
+
Net::HTTPResponse.allocate
|
542
|
+
else
|
543
|
+
@called = true
|
544
|
+
raise Errno::EINVAL, "write"
|
545
|
+
end
|
546
|
+
end
|
547
|
+
|
548
|
+
@http.request @uri
|
549
|
+
|
550
|
+
assert c.reset?
|
551
|
+
assert c.finished?
|
552
|
+
end
|
553
|
+
|
525
554
|
def test_request_reset
|
526
555
|
c = basic_connection
|
527
556
|
def c.request(*a) raise Errno::ECONNRESET end
|
metadata
CHANGED
@@ -1,12 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: net-http-persistent
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 13
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 1
|
8
8
|
- 6
|
9
|
-
|
9
|
+
- 1
|
10
|
+
version: 1.6.1
|
10
11
|
platform: ruby
|
11
12
|
authors:
|
12
13
|
- Eric Hodel
|
@@ -35,7 +36,7 @@ cert_chain:
|
|
35
36
|
x52qPcexcYZR7w==
|
36
37
|
-----END CERTIFICATE-----
|
37
38
|
|
38
|
-
date: 2011-03-
|
39
|
+
date: 2011-03-08 00:00:00 -08:00
|
39
40
|
default_executable:
|
40
41
|
dependencies:
|
41
42
|
- !ruby/object:Gem::Dependency
|
@@ -54,41 +55,33 @@ dependencies:
|
|
54
55
|
version: 2.0.2
|
55
56
|
type: :development
|
56
57
|
version_requirements: *id001
|
57
|
-
- !ruby/object:Gem::Dependency
|
58
|
-
name: rubyforge
|
59
|
-
prerelease: false
|
60
|
-
requirement: &id002 !ruby/object:Gem::Requirement
|
61
|
-
none: false
|
62
|
-
requirements:
|
63
|
-
- - ">="
|
64
|
-
- !ruby/object:Gem::Version
|
65
|
-
hash: 7
|
66
|
-
segments:
|
67
|
-
- 2
|
68
|
-
- 0
|
69
|
-
- 4
|
70
|
-
version: 2.0.4
|
71
|
-
type: :development
|
72
|
-
version_requirements: *id002
|
73
58
|
- !ruby/object:Gem::Dependency
|
74
59
|
name: hoe
|
75
60
|
prerelease: false
|
76
|
-
requirement: &
|
61
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
77
62
|
none: false
|
78
63
|
requirements:
|
79
64
|
- - ">="
|
80
65
|
- !ruby/object:Gem::Version
|
81
|
-
hash:
|
66
|
+
hash: 41
|
82
67
|
segments:
|
83
68
|
- 2
|
84
69
|
- 9
|
85
|
-
-
|
86
|
-
version: 2.9.
|
70
|
+
- 1
|
71
|
+
version: 2.9.1
|
87
72
|
type: :development
|
88
|
-
version_requirements: *
|
73
|
+
version_requirements: *id002
|
89
74
|
description: |-
|
90
|
-
|
75
|
+
Manages persistent connections using Net::HTTP plus a speed fix for 1.8. It's
|
91
76
|
thread-safe too!
|
77
|
+
|
78
|
+
Using persistent HTTP connections can dramatically increase the speed of HTTP.
|
79
|
+
Creating a new HTTP connection for every request involves an extra TCP
|
80
|
+
round-trip and causes TCP congestion avoidance negotiation to start over.
|
81
|
+
|
82
|
+
Net::HTTP supports persistent connections with some API methods but does not
|
83
|
+
handle reconnection gracefully. net-http-persistent supports reconnection
|
84
|
+
according to RFC 2616.
|
92
85
|
email:
|
93
86
|
- drbrain@segment7.net
|
94
87
|
executables: []
|
@@ -139,10 +132,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
139
132
|
version: "0"
|
140
133
|
requirements: []
|
141
134
|
|
142
|
-
rubyforge_project:
|
143
|
-
rubygems_version: 1.6.
|
135
|
+
rubyforge_project: net-http-persistent
|
136
|
+
rubygems_version: 1.6.1
|
144
137
|
signing_key:
|
145
138
|
specification_version: 3
|
146
|
-
summary:
|
139
|
+
summary: Manages persistent connections using Net::HTTP plus a speed fix for 1.8
|
147
140
|
test_files:
|
148
141
|
- test/test_net_http_persistent.rb
|
metadata.gz.sig
CHANGED
Binary file
|