persistent_http 1.0.4 → 1.0.5
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/History.md +5 -0
- data/lib/persistent_http.rb +3 -1
- metadata +20 -25
- data/lib/persistent_http/faster.rb.sav +0 -36
data/History.md
CHANGED
@@ -1,6 +1,11 @@
|
|
1
1
|
PersistentHttp Changelog
|
2
2
|
========================
|
3
3
|
|
4
|
+
1.0.5
|
5
|
+
|
6
|
+
- Don't require 'net/https' in code. JRuby 1.6.8 can have issues when 2 threads attempt to require it
|
7
|
+
at the same time.
|
8
|
+
|
4
9
|
1.0.4
|
5
10
|
|
6
11
|
- Added option :pool_timeout which will raise a Timeout::Error if unable to checkout a connection
|
data/lib/persistent_http.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
require 'net/http'
|
2
|
+
require 'net/https'
|
2
3
|
require 'persistent_http/faster'
|
3
4
|
require 'uri'
|
4
5
|
require 'gene_pool'
|
@@ -241,6 +242,7 @@ class PersistentHTTP
|
|
241
242
|
:close_proc => nil,
|
242
243
|
:logger => @logger) do
|
243
244
|
begin
|
245
|
+
@logger.debug { "#{name}: Creating connection" } if @logger
|
244
246
|
connection = Net::HTTP.new(*net_http_args)
|
245
247
|
connection.set_debug_output @debug_output if @debug_output
|
246
248
|
connection.open_timeout = @open_timeout if @open_timeout
|
@@ -249,6 +251,7 @@ class PersistentHTTP
|
|
249
251
|
ssl connection if @use_ssl
|
250
252
|
|
251
253
|
connection.start
|
254
|
+
@logger.debug { "#{name} #{connection}: Connection created" } if @logger
|
252
255
|
connection
|
253
256
|
rescue Errno::ECONNREFUSED
|
254
257
|
raise Error, "connection refused: #{connection.address}:#{connection.port}"
|
@@ -442,7 +445,6 @@ class PersistentHTTP
|
|
442
445
|
# Enables SSL on +connection+
|
443
446
|
|
444
447
|
def ssl connection
|
445
|
-
require 'net/https'
|
446
448
|
connection.use_ssl = true
|
447
449
|
|
448
450
|
# suppress warning but allow override
|
metadata
CHANGED
@@ -1,32 +1,27 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: persistent_http
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
|
5
|
-
|
4
|
+
prerelease:
|
5
|
+
version: 1.0.5
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Brad Pardee
|
9
|
-
autorequire:
|
9
|
+
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-
|
12
|
+
date: 2012-11-26 00:00:00.000000000Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: gene_pool
|
16
|
-
|
17
|
-
none: false
|
16
|
+
version_requirements: &3246 !ruby/object:Gem::Requirement
|
18
17
|
requirements:
|
19
18
|
- - ! '>='
|
20
19
|
- !ruby/object:Gem::Version
|
21
20
|
version: '1.3'
|
22
|
-
type: :runtime
|
23
|
-
prerelease: false
|
24
|
-
version_requirements: !ruby/object:Gem::Requirement
|
25
21
|
none: false
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
version: '1.3'
|
22
|
+
requirement: *3246
|
23
|
+
prerelease: false
|
24
|
+
type: :runtime
|
30
25
|
description: Persistent HTTP connections using a connection pool
|
31
26
|
email:
|
32
27
|
- bradpardee@gmail.com
|
@@ -34,41 +29,41 @@ executables: []
|
|
34
29
|
extensions: []
|
35
30
|
extra_rdoc_files: []
|
36
31
|
files:
|
37
|
-
- lib/persistent_http/faster.rb
|
38
|
-
- lib/persistent_http/faster.rb.sav
|
39
32
|
- lib/persistent_http.rb
|
33
|
+
- lib/persistent_http/faster.rb
|
40
34
|
- LICENSE
|
41
35
|
- Rakefile
|
42
36
|
- History.md
|
43
37
|
- README.rdoc
|
44
38
|
homepage: http://github.com/bpardee/persistent_http
|
45
39
|
licenses: []
|
46
|
-
post_install_message:
|
40
|
+
post_install_message:
|
47
41
|
rdoc_options: []
|
48
42
|
require_paths:
|
49
43
|
- lib
|
50
44
|
required_ruby_version: !ruby/object:Gem::Requirement
|
51
|
-
none: false
|
52
45
|
requirements:
|
53
46
|
- - ! '>='
|
54
47
|
- !ruby/object:Gem::Version
|
55
|
-
version: '0'
|
56
48
|
segments:
|
57
49
|
- 0
|
58
|
-
hash:
|
59
|
-
|
50
|
+
hash: 2
|
51
|
+
version: '0'
|
60
52
|
none: false
|
53
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
61
54
|
requirements:
|
62
55
|
- - ! '>='
|
63
56
|
- !ruby/object:Gem::Version
|
64
|
-
version: '0'
|
65
57
|
segments:
|
66
58
|
- 0
|
67
|
-
hash:
|
59
|
+
hash: 2
|
60
|
+
version: '0'
|
61
|
+
none: false
|
68
62
|
requirements: []
|
69
|
-
rubyforge_project:
|
70
|
-
rubygems_version: 1.8.
|
71
|
-
signing_key:
|
63
|
+
rubyforge_project:
|
64
|
+
rubygems_version: 1.8.9
|
65
|
+
signing_key:
|
72
66
|
specification_version: 3
|
73
67
|
summary: Persistent HTTP connections using a connection pool
|
74
68
|
test_files: []
|
69
|
+
...
|
@@ -1,36 +0,0 @@
|
|
1
|
-
require 'net/protocol'
|
2
|
-
|
3
|
-
##
|
4
|
-
# Aaron Patterson's monkeypatch (accepted into 1.9.1) to fix Net::HTTP's speed
|
5
|
-
# problems.
|
6
|
-
#
|
7
|
-
# http://gist.github.com/251244
|
8
|
-
|
9
|
-
class Net::BufferedIO #:nodoc:
|
10
|
-
alias :old_rbuf_fill :rbuf_fill
|
11
|
-
|
12
|
-
def rbuf_fill
|
13
|
-
if @io.respond_to? :read_nonblock then
|
14
|
-
begin
|
15
|
-
@rbuf << @io.read_nonblock(65536)
|
16
|
-
rescue Errno::EWOULDBLOCK => e
|
17
|
-
retry if IO.select [@io], nil, nil, @read_timeout
|
18
|
-
raise Timeout::Error, e.message
|
19
|
-
end
|
20
|
-
else # SSL sockets do not have read_nonblock
|
21
|
-
timeout @read_timeout do
|
22
|
-
@rbuf << @io.sysread(65536)
|
23
|
-
end
|
24
|
-
end
|
25
|
-
end
|
26
|
-
end if RUBY_VERSION < '1.9'
|
27
|
-
|
28
|
-
class Net::BufferedIO
|
29
|
-
def rbuf_fill
|
30
|
-
if IO.select [@io], [@io], nil, @read_timeout
|
31
|
-
@io.sysread BUFSIZE, @rbuf
|
32
|
-
else
|
33
|
-
raise Timeout::Error
|
34
|
-
end
|
35
|
-
end
|
36
|
-
end
|