excon 0.0.26 → 0.1.0
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.
Potentially problematic release.
This version of excon might be problematic. Click here for more details.
- data/Gemfile +11 -0
- data/excon.gemspec +3 -2
- data/lib/excon.rb +1 -1
- data/lib/excon/connection.rb +16 -6
- metadata +4 -3
data/Gemfile
ADDED
data/excon.gemspec
CHANGED
@@ -13,8 +13,8 @@ Gem::Specification.new do |s|
|
|
13
13
|
## If your rubyforge_project name is different, then edit it and comment out
|
14
14
|
## the sub! line in the Rakefile
|
15
15
|
s.name = 'excon'
|
16
|
-
s.version = '0.0
|
17
|
-
s.date = '2010-06-
|
16
|
+
s.version = '0.1.0'
|
17
|
+
s.date = '2010-06-19'
|
18
18
|
s.rubyforge_project = 'excon'
|
19
19
|
|
20
20
|
## Make sure your summary is short. The description may be as long
|
@@ -59,6 +59,7 @@ Gem::Specification.new do |s|
|
|
59
59
|
## THE MANIFEST COMMENTS, they are used as delimiters by the task.
|
60
60
|
# = MANIFEST =
|
61
61
|
s.files = %w[
|
62
|
+
Gemfile
|
62
63
|
README.rdoc
|
63
64
|
Rakefile
|
64
65
|
benchmarks/excon_vs.rb
|
data/lib/excon.rb
CHANGED
data/lib/excon/connection.rb
CHANGED
@@ -11,7 +11,6 @@ module Excon
|
|
11
11
|
:query => uri.query,
|
12
12
|
:scheme => uri.scheme
|
13
13
|
}.merge!(params)
|
14
|
-
reset_socket
|
15
14
|
end
|
16
15
|
|
17
16
|
def request(params, &block)
|
@@ -82,6 +81,11 @@ module Excon
|
|
82
81
|
private
|
83
82
|
|
84
83
|
def reset_socket
|
84
|
+
socket && socket.close
|
85
|
+
sockets.delete(socket_key)
|
86
|
+
end
|
87
|
+
|
88
|
+
def connect
|
85
89
|
new_socket = TCPSocket.open(@connection[:host], @connection[:port])
|
86
90
|
|
87
91
|
if @connection[:scheme] == 'https'
|
@@ -92,16 +96,22 @@ module Excon
|
|
92
96
|
new_socket.connect
|
93
97
|
end
|
94
98
|
|
95
|
-
|
96
|
-
|
99
|
+
new_socket
|
100
|
+
end
|
101
|
+
|
102
|
+
def closed?
|
103
|
+
sockets[socket_key] && sockets[socket_key].closed?
|
97
104
|
end
|
98
105
|
|
99
106
|
def socket
|
100
|
-
|
101
|
-
if !Thread.current[:_excon_sockets][socket_key] || Thread.current[:_excon_sockets][socket_key].closed?
|
107
|
+
if closed?
|
102
108
|
reset_socket
|
103
109
|
end
|
104
|
-
|
110
|
+
sockets[socket_key] ||= connect
|
111
|
+
end
|
112
|
+
|
113
|
+
def sockets
|
114
|
+
Thread.current[:_excon_sockets] ||= {}
|
105
115
|
end
|
106
116
|
|
107
117
|
def socket_key
|
metadata
CHANGED
@@ -4,9 +4,9 @@ version: !ruby/object:Gem::Version
|
|
4
4
|
prerelease: false
|
5
5
|
segments:
|
6
6
|
- 0
|
7
|
+
- 1
|
7
8
|
- 0
|
8
|
-
|
9
|
-
version: 0.0.26
|
9
|
+
version: 0.1.0
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- geemus (Wesley Beary)
|
@@ -14,7 +14,7 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2010-06-
|
17
|
+
date: 2010-06-19 00:00:00 -07:00
|
18
18
|
default_executable:
|
19
19
|
dependencies: []
|
20
20
|
|
@@ -27,6 +27,7 @@ extensions: []
|
|
27
27
|
extra_rdoc_files:
|
28
28
|
- README.rdoc
|
29
29
|
files:
|
30
|
+
- Gemfile
|
30
31
|
- README.rdoc
|
31
32
|
- Rakefile
|
32
33
|
- benchmarks/excon_vs.rb
|