typhoeus 0.1.10 → 0.1.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/ext/typhoeus/native.h +7 -0
- data/lib/typhoeus/hydra.rb +1 -1
- data/lib/typhoeus/remote_proxy_object.rb +6 -6
- data/lib/typhoeus.rb +1 -1
- data/spec/servers/app.rb +2 -1
- metadata +1 -1
data/ext/typhoeus/native.h
CHANGED
data/lib/typhoeus/hydra.rb
CHANGED
@@ -118,7 +118,7 @@ module Typhoeus
|
|
118
118
|
easy = @easy_pool.pop || Easy.new
|
119
119
|
easy.url = request.url
|
120
120
|
easy.method = request.method
|
121
|
-
easy.params = request.params
|
121
|
+
easy.params = request.params if request.method == :post && !request.params.nil?
|
122
122
|
easy.headers = request.headers if request.headers
|
123
123
|
easy.request_body = request.body if request.body
|
124
124
|
easy.timeout = request.timeout if request.timeout
|
@@ -1,7 +1,7 @@
|
|
1
1
|
module Typhoeus
|
2
2
|
class RemoteProxyObject
|
3
|
-
instance_methods.each { |m| undef_method m unless m =~ /^__/ }
|
4
|
-
|
3
|
+
instance_methods.each { |m| undef_method m unless m =~ /^__|object_id/ }
|
4
|
+
|
5
5
|
def initialize(clear_memoized_store_proc, easy, options = {})
|
6
6
|
@clear_memoized_store_proc = clear_memoized_store_proc
|
7
7
|
@easy = easy
|
@@ -12,13 +12,13 @@ module Typhoeus
|
|
12
12
|
@timeout = options.delete(:cache_timeout)
|
13
13
|
Typhoeus.add_easy_request(@easy)
|
14
14
|
end
|
15
|
-
|
15
|
+
|
16
16
|
def method_missing(sym, *args, &block)
|
17
17
|
unless @proxied_object
|
18
18
|
if @cache && @cache_key
|
19
19
|
@proxied_object = @cache.get(@cache_key) rescue nil
|
20
20
|
end
|
21
|
-
|
21
|
+
|
22
22
|
unless @proxied_object
|
23
23
|
Typhoeus.perform_easy_requests
|
24
24
|
response = Response.new(:code => @easy.response_code,
|
@@ -31,7 +31,7 @@ module Typhoeus
|
|
31
31
|
if @easy.response_code >= 200 && @easy.response_code < 300
|
32
32
|
Typhoeus.release_easy_object(@easy)
|
33
33
|
@proxied_object = @success.nil? ? response : @success.call(response)
|
34
|
-
|
34
|
+
|
35
35
|
if @cache && @cache_key
|
36
36
|
@cache.set(@cache_key, @proxied_object, @timeout)
|
37
37
|
end
|
@@ -41,7 +41,7 @@ module Typhoeus
|
|
41
41
|
@clear_memoized_store_proc.call
|
42
42
|
end
|
43
43
|
end
|
44
|
-
|
44
|
+
|
45
45
|
@proxied_object.__send__(sym, *args, &block)
|
46
46
|
end
|
47
47
|
end
|
data/lib/typhoeus.rb
CHANGED
data/spec/servers/app.rb
CHANGED