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.
@@ -12,3 +12,10 @@ extern void init_typhoeus_easy();
12
12
  extern void init_typhoeus_multi();
13
13
 
14
14
  #endif
15
+
16
+ #ifndef RSTRING_PTR
17
+
18
+ #define RSTRING_PTR(s) (RSTRING(s)->ptr)
19
+ #define RSTRING_LEN(s) (RSTRING(s)->len)
20
+
21
+ #endif
@@ -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 if request.method == :post
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
@@ -14,7 +14,7 @@ require 'typhoeus/request'
14
14
  require 'typhoeus/hydra'
15
15
 
16
16
  module Typhoeus
17
- VERSION = "0.1.10"
17
+ VERSION = "0.1.11"
18
18
 
19
19
  def self.easy_object_pool
20
20
  @easy_objects ||= []
data/spec/servers/app.rb CHANGED
@@ -1,3 +1,4 @@
1
+ #!/usr/bin/env ruby
1
2
  require 'rubygems'
2
3
  require 'sinatra'
3
4
  require 'json'
@@ -34,4 +35,4 @@ end
34
35
  delete '/**' do
35
36
  puts request.inspect
36
37
  request.env.merge!(:body => request.body.read).to_json
37
- end
38
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: typhoeus
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.10
4
+ version: 0.1.11
5
5
  platform: ruby
6
6
  authors:
7
7
  - Paul Dix