excon 0.0.13 → 0.0.14
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/VERSION +1 -1
- data/excon.gemspec +2 -2
- data/lib/excon/connection.rb +7 -6
- metadata +2 -2
data/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
0.0.
|
|
1
|
+
0.0.14
|
data/excon.gemspec
CHANGED
|
@@ -5,11 +5,11 @@
|
|
|
5
5
|
|
|
6
6
|
Gem::Specification.new do |s|
|
|
7
7
|
s.name = %q{excon}
|
|
8
|
-
s.version = "0.0.
|
|
8
|
+
s.version = "0.0.14"
|
|
9
9
|
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
|
11
11
|
s.authors = ["Wesley Beary"]
|
|
12
|
-
s.date = %q{
|
|
12
|
+
s.date = %q{2010-01-04}
|
|
13
13
|
s.description = %q{speed, persistence, http(s)}
|
|
14
14
|
s.email = %q{wbeary@engineyard.com}
|
|
15
15
|
s.extra_rdoc_files = [
|
data/lib/excon/connection.rb
CHANGED
|
@@ -5,6 +5,7 @@ unless Excon.mocking?
|
|
|
5
5
|
|
|
6
6
|
def initialize(url)
|
|
7
7
|
@uri = URI.parse(url)
|
|
8
|
+
Thread.current[:_excon_connections] ||= {}
|
|
8
9
|
end
|
|
9
10
|
|
|
10
11
|
def request(params)
|
|
@@ -76,16 +77,16 @@ unless Excon.mocking?
|
|
|
76
77
|
end
|
|
77
78
|
elsif response.headers['Connection'] == 'close'
|
|
78
79
|
block.call(connection.read)
|
|
79
|
-
Thread.current[:
|
|
80
|
+
Thread.current[:_excon_connections][@uri.to_s] = nil
|
|
80
81
|
end
|
|
81
82
|
end
|
|
82
83
|
rescue => connection_error
|
|
83
|
-
Thread.current[:
|
|
84
|
+
Thread.current[:_excon_connections][@uri.to_s] = nil
|
|
84
85
|
raise(connection_error)
|
|
85
86
|
end
|
|
86
87
|
|
|
87
88
|
if params[:expects] && ![*params[:expects]].include?(response.status)
|
|
88
|
-
Thread.current[:
|
|
89
|
+
Thread.current[:_excon_connections][@uri.to_s] = nil
|
|
89
90
|
raise(Excon::Errors.status_error(params, response))
|
|
90
91
|
else
|
|
91
92
|
response
|
|
@@ -107,10 +108,10 @@ unless Excon.mocking?
|
|
|
107
108
|
private
|
|
108
109
|
|
|
109
110
|
def connection
|
|
110
|
-
if !Thread.current[:
|
|
111
|
-
Thread.current[:
|
|
111
|
+
if !Thread.current[:_excon_connections][@uri.to_s] || Thread.current[:_excon_connections][@uri.to_s].closed?
|
|
112
|
+
Thread.current[:_excon_connections][@uri.to_s] = establish_connection
|
|
112
113
|
end
|
|
113
|
-
Thread.current[:
|
|
114
|
+
Thread.current[:_excon_connections][@uri.to_s]
|
|
114
115
|
end
|
|
115
116
|
|
|
116
117
|
def establish_connection
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: excon
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.0.
|
|
4
|
+
version: 0.0.14
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Wesley Beary
|
|
@@ -9,7 +9,7 @@ autorequire:
|
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
11
|
|
|
12
|
-
date:
|
|
12
|
+
date: 2010-01-04 00:00:00 -08:00
|
|
13
13
|
default_executable:
|
|
14
14
|
dependencies: []
|
|
15
15
|
|