http-request 1.1.1 → 1.1.2
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/http-request.rb +2 -2
- data/lib/http-request/client.rb +2 -2
- data/lib/http-request/connection.rb +3 -3
- data/lib/http-request/version.rb +1 -1
- metadata +2 -2
data/lib/http-request.rb
CHANGED
data/lib/http-request/client.rb
CHANGED
@@ -3,9 +3,9 @@ module HttpRequest
|
|
3
3
|
attr_reader :connections, :options
|
4
4
|
|
5
5
|
# Syntax sugar to manage clients in the current thread
|
6
|
-
def self.pool(key)
|
6
|
+
def self.pool(key, options={})
|
7
7
|
key = "http-request:#{key}"
|
8
|
-
Thread.current[key] ||= Client.new
|
8
|
+
Thread.current[key] ||= Client.new(options)
|
9
9
|
end
|
10
10
|
|
11
11
|
def self.delete_from_pool(key)
|
@@ -69,8 +69,8 @@ module HttpRequest
|
|
69
69
|
open if closed?
|
70
70
|
|
71
71
|
# headers['Date'] = Time.now.httpdate # need this..?
|
72
|
-
headers['User-Agent']
|
73
|
-
headers['Connection']
|
72
|
+
headers['User-Agent'] ||= user_agent
|
73
|
+
headers['Connection'] ||= 'keep-alive' if keep_alive
|
74
74
|
headers['Content-Length'] ||= body.bytesize.to_s if body
|
75
75
|
|
76
76
|
# TODO.. link traversal..
|
@@ -80,7 +80,7 @@ module HttpRequest
|
|
80
80
|
|
81
81
|
# Build request
|
82
82
|
req_klass = instance_eval("Net::HTTP::"+verb.to_s.capitalize)
|
83
|
-
req = req_klass.new(uri.
|
83
|
+
req = req_klass.new(uri.path, headers)
|
84
84
|
req.body = body if !body.nil? && !body.empty?
|
85
85
|
|
86
86
|
# Make the HTTP request
|
data/lib/http-request/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: http-request
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-08-
|
12
|
+
date: 2012-08-14 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: addressable
|