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.

@@ -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.0'
16
+ s.version = '0.1.1'
17
17
  s.date = '2010-06-19'
18
18
  s.rubyforge_project = 'excon'
19
19
 
@@ -16,7 +16,7 @@ require 'excon/response'
16
16
  module Excon
17
17
 
18
18
  unless const_defined?(:VERSION)
19
- VERSION = '0.1.0'
19
+ VERSION = '0.1.1'
20
20
  end
21
21
 
22
22
  CHUNK_SIZE = 1048576 # 1 megabyte
@@ -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
- reset_socket
51
+ reset
52
52
  end
53
53
  response
54
54
  rescue => socket_error
55
- reset_socket
55
+ reset
56
56
  raise(socket_error)
57
57
  end
58
58
 
59
59
  if params[:expects] && ![*params[:expects]].include?(response.status)
60
- reset_socket
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
- private
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
- reset_socket
107
+ reset
109
108
  end
110
109
  sockets[socket_key] ||= connect
111
110
  end
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 1
8
- - 0
9
- version: 0.1.0
8
+ - 1
9
+ version: 0.1.1
10
10
  platform: ruby
11
11
  authors:
12
12
  - geemus (Wesley Beary)