excon 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of excon might be problematic. Click here for more details.
- data/excon.gemspec +1 -1
- data/lib/excon.rb +1 -1
- data/lib/excon/connection.rb +8 -9
- metadata +2 -2
data/excon.gemspec
CHANGED
@@ -13,7 +13,7 @@ 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.1.
|
16
|
+
s.version = '0.1.1'
|
17
17
|
s.date = '2010-06-19'
|
18
18
|
s.rubyforge_project = 'excon'
|
19
19
|
|
data/lib/excon.rb
CHANGED
data/lib/excon/connection.rb
CHANGED
@@ -48,16 +48,16 @@ module Excon
|
|
48
48
|
|
49
49
|
response = Excon::Response.parse(socket, params, &block)
|
50
50
|
if response.headers['Connection'] == 'close'
|
51
|
-
|
51
|
+
reset
|
52
52
|
end
|
53
53
|
response
|
54
54
|
rescue => socket_error
|
55
|
-
|
55
|
+
reset
|
56
56
|
raise(socket_error)
|
57
57
|
end
|
58
58
|
|
59
59
|
if params[:expects] && ![*params[:expects]].include?(response.status)
|
60
|
-
|
60
|
+
reset
|
61
61
|
raise(Excon::Errors.status_error(params, response))
|
62
62
|
else
|
63
63
|
response
|
@@ -78,13 +78,12 @@ module Excon
|
|
78
78
|
end
|
79
79
|
end
|
80
80
|
|
81
|
-
|
82
|
-
|
83
|
-
def reset_socket
|
84
|
-
socket && socket.close
|
85
|
-
sockets.delete(socket_key)
|
81
|
+
def reset
|
82
|
+
(old_socket = sockets.delete(socket_key)) && old_socket.close
|
86
83
|
end
|
87
84
|
|
85
|
+
private
|
86
|
+
|
88
87
|
def connect
|
89
88
|
new_socket = TCPSocket.open(@connection[:host], @connection[:port])
|
90
89
|
|
@@ -105,7 +104,7 @@ module Excon
|
|
105
104
|
|
106
105
|
def socket
|
107
106
|
if closed?
|
108
|
-
|
107
|
+
reset
|
109
108
|
end
|
110
109
|
sockets[socket_key] ||= connect
|
111
110
|
end
|