right_http_connection 1.1.0 → 1.2.0
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +20 -20
- data/Manifest.txt +0 -1
- data/Rakefile +2 -2
- data/lib/right_http_connection.rb +32 -8
- metadata +3 -4
- data/lib/right_http_connection/version.rb +0 -9
data/History.txt
CHANGED
@@ -1,30 +1,30 @@
|
|
1
|
-
|
1
|
+
== 0.0.1 2007-05-15
|
2
|
+
* 1 major enhancement:
|
3
|
+
* Initial release
|
2
4
|
|
3
|
-
|
4
|
-
+ Initial release
|
5
|
+
== 0.1.2 2007-06-27
|
5
6
|
|
6
|
-
|
7
|
+
* No major changes.
|
7
8
|
|
8
|
-
|
9
|
+
== 0.1.3 2007-07-09
|
9
10
|
|
10
|
-
|
11
|
+
* No change.
|
11
12
|
|
12
|
-
|
13
|
+
== 0.1.4 2007-08-10
|
13
14
|
|
14
|
-
|
15
|
+
* r1442, todd, 2007-08-07 15:45:24
|
16
|
+
* # 373, Add support in right_http_connection for bailing out to a block while
|
17
|
+
reading the HTTP response (to support GET streaming...)
|
15
18
|
|
16
|
-
|
17
|
-
|
19
|
+
* r1411, todd, 2007-08-03 15:14:45
|
20
|
+
* # 373, Stream uploads (PUTs) if the source is a file, stream, or anything
|
21
|
+
read()-able
|
18
22
|
|
19
|
-
|
20
|
-
reading the HTTP response (to support GET streaming...)
|
21
|
-
|
22
|
-
------------------------------------------------------------------------
|
23
|
-
r1411 | todd | 2007-08-03 15:14:45 -0700 (Fri, 03 Aug 2007) | 3 lines
|
24
|
-
|
25
|
-
(#373) Stream uploads (PUTs) if the source is a file, stream, or anything
|
26
|
-
read()-able
|
27
|
-
|
28
|
-
+++ 1.1.0 2007-08-15
|
23
|
+
== 1.1.0 2007-08-15
|
29
24
|
Initial public release
|
30
25
|
|
26
|
+
== 1.2.0 2007-10-05
|
27
|
+
|
28
|
+
* r1867, konstantin, 2007-10-05 06:19:45
|
29
|
+
* # 220, (re)open connection to server if none exists or connection params
|
30
|
+
have changed
|
data/Manifest.txt
CHANGED
data/Rakefile
CHANGED
@@ -9,7 +9,7 @@ require 'rake/contrib/rubyforgepublisher'
|
|
9
9
|
require 'fileutils'
|
10
10
|
require 'hoe'
|
11
11
|
include FileUtils
|
12
|
-
require File.join(File.dirname(__FILE__), 'lib', 'right_http_connection'
|
12
|
+
require File.join(File.dirname(__FILE__), 'lib', 'right_http_connection')
|
13
13
|
|
14
14
|
AUTHOR = 'RightScale' # can also be an array of Authors
|
15
15
|
EMAIL = "support@rightscale.com"
|
@@ -46,7 +46,7 @@ hoe = Hoe.new(GEM_NAME, VERS) do |p|
|
|
46
46
|
p.rubyforge_name = RUBYFORGE_PROJECT if RUBYFORGE_PROJECT
|
47
47
|
p.test_globs = ["test/**/test_*.rb"]
|
48
48
|
p.clean_globs = CLEAN #An array of file patterns to delete on clean.
|
49
|
-
p.remote_rdoc_dir = "
|
49
|
+
p.remote_rdoc_dir = "right_http_gem_doc"
|
50
50
|
|
51
51
|
# == Optional
|
52
52
|
p.changes = p.paragraphs_of("History.txt", 0..1).join("\n\n")
|
@@ -8,6 +8,17 @@ require "time"
|
|
8
8
|
require "logger"
|
9
9
|
|
10
10
|
|
11
|
+
module RightHttpConnection #:nodoc:
|
12
|
+
module VERSION #:nodoc:
|
13
|
+
MAJOR = 1
|
14
|
+
MINOR = 2
|
15
|
+
TINY = 0
|
16
|
+
|
17
|
+
STRING = [MAJOR, MINOR, TINY].join('.')
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
|
11
22
|
module Rightscale
|
12
23
|
|
13
24
|
=begin rdoc
|
@@ -173,13 +184,13 @@ them.
|
|
173
184
|
# opens a new one.
|
174
185
|
def start(request_params)
|
175
186
|
# close the previous if exists
|
176
|
-
|
187
|
+
finish
|
177
188
|
# create new connection
|
178
189
|
@server = request_params[:server]
|
179
190
|
@port = request_params[:port]
|
180
|
-
@protocol = request_params[:protocol]
|
191
|
+
@protocol = request_params[:protocol]
|
181
192
|
|
182
|
-
@logger.info("Opening new
|
193
|
+
@logger.info("Opening new #{@protocol.upcase} connection to #@server:#@port")
|
183
194
|
@http = Net::HTTP.new(@server, @port)
|
184
195
|
@http.open_timeout = HTTP_CONNECTION_OPEN_TIMEOUT
|
185
196
|
@http.read_timeout = HTTP_CONNECTION_READ_TIMEOUT
|
@@ -205,7 +216,7 @@ them.
|
|
205
216
|
end
|
206
217
|
|
207
218
|
public
|
208
|
-
|
219
|
+
|
209
220
|
=begin rdoc
|
210
221
|
Send HTTP request to server
|
211
222
|
|
@@ -231,10 +242,15 @@ them.
|
|
231
242
|
|
232
243
|
# try to connect server(if connection does not exist) and get response data
|
233
244
|
begin
|
234
|
-
|
235
|
-
#
|
236
|
-
|
237
|
-
|
245
|
+
request_params[:protocol] ||= (request_params[:port] == 443 ? 'https' : 'http')
|
246
|
+
# (re)open connection to server if none exists or params has changed
|
247
|
+
unless @http &&
|
248
|
+
@http.started? &&
|
249
|
+
@server == request_params[:server] &&
|
250
|
+
@port == request_params[:port] &&
|
251
|
+
@protocol == request_params[:protocol]
|
252
|
+
start(request_params)
|
253
|
+
end
|
238
254
|
|
239
255
|
# get response and return it
|
240
256
|
request = request_params[:request]
|
@@ -292,6 +308,14 @@ them.
|
|
292
308
|
end
|
293
309
|
end
|
294
310
|
|
311
|
+
def finish(reason = '')
|
312
|
+
if @http && @http.started?
|
313
|
+
reason = ", reason: '#{reason}'" unless reason.blank?
|
314
|
+
@logger.info("Closing #{@http.use_ssl? ? 'HTTPS' : 'HTTP'} connection to #{@http.address}:#{@http.port}#{reason}")
|
315
|
+
@http.finish
|
316
|
+
end
|
317
|
+
end
|
318
|
+
|
295
319
|
# Errors received during testing:
|
296
320
|
#
|
297
321
|
# #<Timeout::Error: execution expired>
|
metadata
CHANGED
@@ -1,10 +1,10 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
|
-
rubygems_version: 0.9.
|
2
|
+
rubygems_version: 0.9.0
|
3
3
|
specification_version: 1
|
4
4
|
name: right_http_connection
|
5
5
|
version: !ruby/object:Gem::Version
|
6
|
-
version: 1.
|
7
|
-
date: 2007-
|
6
|
+
version: 1.2.0
|
7
|
+
date: 2007-10-17 00:00:00 +04:00
|
8
8
|
summary: RightScale's robust HTTP/S connection module
|
9
9
|
require_paths:
|
10
10
|
- lib
|
@@ -34,7 +34,6 @@ files:
|
|
34
34
|
- README.txt
|
35
35
|
- Rakefile
|
36
36
|
- lib/right_http_connection.rb
|
37
|
-
- lib/right_http_connection/version.rb
|
38
37
|
- setup.rb
|
39
38
|
test_files: []
|
40
39
|
|