excon 0.0.26 → 0.1.0

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/Gemfile ADDED
@@ -0,0 +1,11 @@
1
+ source "http://rubygems.org"
2
+
3
+ group :test do
4
+ gem "shindo"
5
+ gem "tach"
6
+
7
+ gem "sinatra"
8
+ gem "rake"
9
+ gem "mongrel"
10
+ gem "open4"
11
+ end
@@ -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.26'
17
- s.date = '2010-06-07'
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
@@ -16,7 +16,7 @@ require 'excon/response'
16
16
  module Excon
17
17
 
18
18
  unless const_defined?(:VERSION)
19
- VERSION = '0.0.26'
19
+ VERSION = '0.1.0'
20
20
  end
21
21
 
22
22
  CHUNK_SIZE = 1048576 # 1 megabyte
@@ -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
- Thread.current[:_excon_sockets] ||= {}
96
- Thread.current[:_excon_sockets][socket_key] = new_socket
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
- Thread.current[:_excon_sockets] ||= {}
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
- Thread.current[:_excon_sockets][socket_key]
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
- - 26
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-07 00:00:00 -07:00
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