dcu-typhoeus 0.4.1 → 0.4.2

Sign up to get free protection for your applications and to get access to all the features.
data/lib/typhoeus/form.rb CHANGED
@@ -6,7 +6,8 @@ module Typhoeus
6
6
  attr_reader :first, :traversal
7
7
 
8
8
  def initialize(params = {})
9
- @params = params
9
+ # ideally we should escape params here with Typhoeus::Utils.escape_params. I don't do it in this commit because I don't know the implications yet.
10
+ @params = params
10
11
  @first = ::FFI::MemoryPointer.new(:pointer)
11
12
  @last = ::FFI::MemoryPointer.new(:pointer)
12
13
 
@@ -177,7 +177,7 @@ module Typhoeus
177
177
  unless mock_object.nil?
178
178
  decode_nil_response(mock_object)
179
179
  else
180
- enforce_allow_net_connect!(:#{method.to_s}, url, options[:params])
180
+ enforce_allow_net_connect!(:#{method.to_s}, url, Typhoeus::Utils.escape_params(options[:params]))
181
181
  remote_proxy_object(url, :#{method.to_s}, options)
182
182
  end
183
183
  end
@@ -192,7 +192,7 @@ module Typhoeus
192
192
  easy.method = method
193
193
  easy.headers = options[:headers] if options.has_key?(:headers)
194
194
  easy.headers["User-Agent"] = (options[:user_agent] || Typhoeus::USER_AGENT)
195
- easy.params = options[:params] if options[:params]
195
+ easy.params = Typhoeus::Utils.escape_params(options[:params]) if options[:params]
196
196
  easy.request_body = options[:body] if options[:body]
197
197
  easy.timeout = options[:timeout] if options[:timeout]
198
198
  easy.follow_location = options[:follow_location] if options[:follow_location]
@@ -285,7 +285,10 @@ module Typhoeus
285
285
  args[:base_uri] ||= @remote_defaults[:base_uri]
286
286
  args[:path] ||= @remote_defaults[:path]
287
287
  args[:follow_location] ||= @remote_defaults[:follow_location]
288
- args[:follow_location] ||= @remote_defaults[:max_redirects]
288
+ args[:max_redirects] ||= @remote_defaults[:max_redirects]
289
+ args[:params] ||= @remote_defaults[:params]
290
+ args[:username] ||= @remote_defaults[:username]
291
+ args[:password] ||= @remote_defaults[:password]
289
292
  m = RemoteMethod.new(args)
290
293
 
291
294
  @remote_methods ||= {}
@@ -1,3 +1,5 @@
1
+ require 'cgi'
2
+
1
3
  module Typhoeus
2
4
  module Utils
3
5
  # Taken from Rack::Utils, 1.2.1 to remove Rack dependency.
@@ -10,7 +12,7 @@ module Typhoeus
10
12
 
11
13
  def escape_params(params)
12
14
  traverse_params_hash(params)[:params].inject({}) do |memo, (k, v)|
13
- memo[escape(k)] = escape(v)
15
+ memo[escape(k)] = CGI.escape(v)
14
16
  memo
15
17
  end
16
18
  end
@@ -24,7 +26,7 @@ module Typhoeus
24
26
 
25
27
  def traversal_to_param_string(traversal, escape = true)
26
28
  traversal[:params].collect { |param|
27
- escape ? "#{Typhoeus::Utils.escape(param[0])}=#{Typhoeus::Utils.escape(param[1])}" : "#{param[0]}=#{param[1]}"
29
+ escape ? "#{Typhoeus::Utils.escape(param[0])}=#{CGI.escape(param[1])}" : "#{param[0]}=#{param[1]}"
28
30
  }.join('&')
29
31
  end
30
32
  module_function :traversal_to_param_string
@@ -1,3 +1,3 @@
1
1
  module Typhoeus
2
- VERSION = '0.4.1'
2
+ VERSION = '0.4.2'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dcu-typhoeus
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.1
4
+ version: 0.4.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -11,11 +11,11 @@ authors:
11
11
  autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2012-05-26 00:00:00.000000000 Z
14
+ date: 2012-08-21 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: ffi
18
- requirement: &70346298664500 !ruby/object:Gem::Requirement
18
+ requirement: !ruby/object:Gem::Requirement
19
19
  none: false
20
20
  requirements:
21
21
  - - ~>
@@ -23,10 +23,15 @@ dependencies:
23
23
  version: '1.0'
24
24
  type: :runtime
25
25
  prerelease: false
26
- version_requirements: *70346298664500
26
+ version_requirements: !ruby/object:Gem::Requirement
27
+ none: false
28
+ requirements:
29
+ - - ~>
30
+ - !ruby/object:Gem::Version
31
+ version: '1.0'
27
32
  - !ruby/object:Gem::Dependency
28
33
  name: mime-types
29
- requirement: &70346298664020 !ruby/object:Gem::Requirement
34
+ requirement: !ruby/object:Gem::Requirement
30
35
  none: false
31
36
  requirements:
32
37
  - - ~>
@@ -34,10 +39,15 @@ dependencies:
34
39
  version: '1.18'
35
40
  type: :runtime
36
41
  prerelease: false
37
- version_requirements: *70346298664020
42
+ version_requirements: !ruby/object:Gem::Requirement
43
+ none: false
44
+ requirements:
45
+ - - ~>
46
+ - !ruby/object:Gem::Version
47
+ version: '1.18'
38
48
  - !ruby/object:Gem::Dependency
39
49
  name: activesupport
40
- requirement: &70346298663540 !ruby/object:Gem::Requirement
50
+ requirement: !ruby/object:Gem::Requirement
41
51
  none: false
42
52
  requirements:
43
53
  - - ~>
@@ -45,10 +55,15 @@ dependencies:
45
55
  version: '3.2'
46
56
  type: :runtime
47
57
  prerelease: false
48
- version_requirements: *70346298663540
58
+ version_requirements: !ruby/object:Gem::Requirement
59
+ none: false
60
+ requirements:
61
+ - - ~>
62
+ - !ruby/object:Gem::Version
63
+ version: '3.2'
49
64
  - !ruby/object:Gem::Dependency
50
65
  name: sinatra
51
- requirement: &70346298663060 !ruby/object:Gem::Requirement
66
+ requirement: !ruby/object:Gem::Requirement
52
67
  none: false
53
68
  requirements:
54
69
  - - ~>
@@ -56,10 +71,15 @@ dependencies:
56
71
  version: '1.3'
57
72
  type: :development
58
73
  prerelease: false
59
- version_requirements: *70346298663060
74
+ version_requirements: !ruby/object:Gem::Requirement
75
+ none: false
76
+ requirements:
77
+ - - ~>
78
+ - !ruby/object:Gem::Version
79
+ version: '1.3'
60
80
  - !ruby/object:Gem::Dependency
61
81
  name: json
62
- requirement: &70346298662580 !ruby/object:Gem::Requirement
82
+ requirement: !ruby/object:Gem::Requirement
63
83
  none: false
64
84
  requirements:
65
85
  - - ~>
@@ -67,10 +87,15 @@ dependencies:
67
87
  version: '1.7'
68
88
  type: :development
69
89
  prerelease: false
70
- version_requirements: *70346298662580
90
+ version_requirements: !ruby/object:Gem::Requirement
91
+ none: false
92
+ requirements:
93
+ - - ~>
94
+ - !ruby/object:Gem::Version
95
+ version: '1.7'
71
96
  - !ruby/object:Gem::Dependency
72
97
  name: rake
73
- requirement: &70346298694100 !ruby/object:Gem::Requirement
98
+ requirement: !ruby/object:Gem::Requirement
74
99
  none: false
75
100
  requirements:
76
101
  - - ~>
@@ -78,10 +103,15 @@ dependencies:
78
103
  version: '0.9'
79
104
  type: :development
80
105
  prerelease: false
81
- version_requirements: *70346298694100
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ none: false
108
+ requirements:
109
+ - - ~>
110
+ - !ruby/object:Gem::Version
111
+ version: '0.9'
82
112
  - !ruby/object:Gem::Dependency
83
113
  name: mocha
84
- requirement: &70346298693620 !ruby/object:Gem::Requirement
114
+ requirement: !ruby/object:Gem::Requirement
85
115
  none: false
86
116
  requirements:
87
117
  - - ~>
@@ -89,10 +119,15 @@ dependencies:
89
119
  version: '0.10'
90
120
  type: :development
91
121
  prerelease: false
92
- version_requirements: *70346298693620
122
+ version_requirements: !ruby/object:Gem::Requirement
123
+ none: false
124
+ requirements:
125
+ - - ~>
126
+ - !ruby/object:Gem::Version
127
+ version: '0.10'
93
128
  - !ruby/object:Gem::Dependency
94
129
  name: rspec
95
- requirement: &70346298693140 !ruby/object:Gem::Requirement
130
+ requirement: !ruby/object:Gem::Requirement
96
131
  none: false
97
132
  requirements:
98
133
  - - ~>
@@ -100,10 +135,15 @@ dependencies:
100
135
  version: '2.10'
101
136
  type: :development
102
137
  prerelease: false
103
- version_requirements: *70346298693140
138
+ version_requirements: !ruby/object:Gem::Requirement
139
+ none: false
140
+ requirements:
141
+ - - ~>
142
+ - !ruby/object:Gem::Version
143
+ version: '2.10'
104
144
  - !ruby/object:Gem::Dependency
105
145
  name: guard-rspec
106
- requirement: &70346298692660 !ruby/object:Gem::Requirement
146
+ requirement: !ruby/object:Gem::Requirement
107
147
  none: false
108
148
  requirements:
109
149
  - - ~>
@@ -111,7 +151,12 @@ dependencies:
111
151
  version: '0.6'
112
152
  type: :development
113
153
  prerelease: false
114
- version_requirements: *70346298692660
154
+ version_requirements: !ruby/object:Gem::Requirement
155
+ none: false
156
+ requirements:
157
+ - - ~>
158
+ - !ruby/object:Gem::Version
159
+ version: '0.6'
115
160
  description: Like a modern code version of the mythical beast with 100 serpent heads,
116
161
  Typhoeus runs HTTP requests in parallel while cleanly encapsulating handling logic.
117
162
  email: hans.hasselberg@gmail.com
@@ -171,7 +216,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
171
216
  version: 1.3.6
172
217
  requirements: []
173
218
  rubyforge_project: ! '[none]'
174
- rubygems_version: 1.8.11
219
+ rubygems_version: 1.8.24
175
220
  signing_key:
176
221
  specification_version: 3
177
222
  summary: Parallel HTTP library on top of libcurl multi.