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.
@@ -4,8 +4,8 @@ require 'addressable/uri'
4
4
  module HttpRequest
5
5
  extend self
6
6
 
7
- def pool(key)
8
- Client.pool(key)
7
+ def pool(key, options={})
8
+ Client.pool(key, options)
9
9
  end
10
10
 
11
11
  def open(url, options={})
@@ -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'] ||= user_agent
73
- headers['Connection'] ||= 'keep-alive' if keep_alive
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.to_s, headers)
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
@@ -1,3 +1,3 @@
1
1
  module HttpRequest
2
- VERSION = '1.1.1'
2
+ VERSION = '1.1.2'
3
3
  end
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.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-03 00:00:00.000000000 Z
12
+ date: 2012-08-14 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: addressable