typhoeus 0.2.1 → 0.2.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,5 +1,9 @@
1
- Current Master
2
- --------------
1
+ 0.2.2
2
+ -----
3
+ * Fixed a problem with nested URL params encoding incorrectly [dbalatero]
4
+
5
+ 0.2.1
6
+ -----
3
7
  * Added extended proxy support [Zapotek, GH-46]
4
8
  * eliminated compile time warnings by using proper type declarations [skaes, GH-54]
5
9
  * fixed broken calls to rb_raise [skaes, GH-54]
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.2.1
1
+ 0.2.2
@@ -110,18 +110,23 @@ module Typhoeus
110
110
  end
111
111
 
112
112
  def params_string
113
- params.keys.sort { |a, b| a.to_s <=> b.to_s }.collect do |k|
114
- value = params[k]
115
- if value.is_a? Hash
116
- value.keys.collect {|sk| Typhoeus::Utils.escape("#{k}[#{sk}]") + "=" + Typhoeus::Utils.escape(value[sk].to_s)}
117
- elsif value.is_a? Array
118
- key = Typhoeus::Utils.escape(k.to_s)
119
- value.collect { |v| "#{key}[]=#{Typhoeus::Utils.escape(v.to_s)}" }.join('&')
113
+ traverse_hash(params).flatten.join('&')
114
+ end
115
+
116
+ def traverse_hash(hash, current_key = nil)
117
+ hash.keys.sort { |a, b| a.to_s <=> b.to_s }.collect do |key|
118
+ new_key = current_key ? "#{current_key}[#{key}]" : key
119
+ if hash[key].is_a?(Hash)
120
+ traverse_hash(hash[key], new_key)
121
+ elsif hash[key].is_a?(Array)
122
+ array_key = Typhoeus::Utils.escape("#{new_key}[]")
123
+ hash[key].collect { |v| "#{array_key}=#{Typhoeus::Utils.escape(v.to_s)}" }.join('&')
120
124
  else
121
- "#{Typhoeus::Utils.escape(k.to_s)}=#{Typhoeus::Utils.escape(params[k].to_s)}"
125
+ "#{Typhoeus::Utils.escape(new_key)}=#{Typhoeus::Utils.escape(hash[key].to_s)}"
122
126
  end
123
- end.flatten.join("&")
127
+ end
124
128
  end
129
+ private :traverse_hash
125
130
 
126
131
  def on_complete(&block)
127
132
  @on_complete = block
@@ -74,7 +74,23 @@ describe Typhoeus::Request do
74
74
  :params => {
75
75
  :a => ['789','2434']
76
76
  })
77
- request.params_string.should == "a[]=789&a[]=2434"
77
+ request.params_string.should == "a%5B%5D=789&a%5B%5D=2434"
78
+ end
79
+
80
+ it "should nest arrays in hashes" do
81
+ request = Typhoeus::Request.new('http://google.com',
82
+ :params => {
83
+ :a => { :b => { :c => ['d','e'] } }
84
+ })
85
+ request.params_string.should == "a%5Bb%5D%5Bc%5D%5B%5D=d&a%5Bb%5D%5Bc%5D%5B%5D=e"
86
+ end
87
+
88
+ it "should translate nested params correctly" do
89
+ request = Typhoeus::Request.new('http://google.com',
90
+ :params => {
91
+ :a => { :b => { :c => 'd' } }
92
+ })
93
+ request.params_string.should == "a%5Bb%5D%5Bc%5D=d"
78
94
  end
79
95
  end
80
96
 
@@ -1,112 +1,110 @@
1
1
  # Generated by jeweler
2
2
  # DO NOT EDIT THIS FILE DIRECTLY
3
- # Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
3
+ # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
4
  # -*- encoding: utf-8 -*-
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{typhoeus}
8
- s.version = "0.2.1"
8
+ s.version = "0.2.2"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Paul Dix", "David Balatero"]
12
- s.date = %q{2011-01-28}
12
+ s.date = %q{2011-02-14}
13
13
  s.description = %q{Like a modern code version of the mythical beast with 100 serpent heads, Typhoeus runs HTTP requests in parallel while cleanly encapsulating handling logic.}
14
14
  s.email = %q{dbalatero@gmail.com}
15
15
  s.extensions = ["ext/typhoeus/extconf.rb"]
16
16
  s.extra_rdoc_files = [
17
17
  "LICENSE",
18
- "README.textile"
18
+ "README.textile"
19
19
  ]
20
20
  s.files = [
21
- ".gitignore",
22
- "CHANGELOG.markdown",
23
- "Gemfile",
24
- "Gemfile.lock",
25
- "LICENSE",
26
- "README.textile",
27
- "Rakefile",
28
- "VERSION",
29
- "benchmarks/profile.rb",
30
- "benchmarks/vs_nethttp.rb",
31
- "examples/file.rb",
32
- "examples/times.rb",
33
- "examples/twitter.rb",
34
- "ext/typhoeus/.gitignore",
35
- "ext/typhoeus/extconf.rb",
36
- "ext/typhoeus/native.c",
37
- "ext/typhoeus/native.h",
38
- "ext/typhoeus/typhoeus_easy.c",
39
- "ext/typhoeus/typhoeus_easy.h",
40
- "ext/typhoeus/typhoeus_form.c",
41
- "ext/typhoeus/typhoeus_form.h",
42
- "ext/typhoeus/typhoeus_multi.c",
43
- "ext/typhoeus/typhoeus_multi.h",
44
- "lib/typhoeus.rb",
45
- "lib/typhoeus/.gitignore",
46
- "lib/typhoeus/easy.rb",
47
- "lib/typhoeus/filter.rb",
48
- "lib/typhoeus/form.rb",
49
- "lib/typhoeus/hydra.rb",
50
- "lib/typhoeus/hydra/callbacks.rb",
51
- "lib/typhoeus/hydra/connect_options.rb",
52
- "lib/typhoeus/hydra/stubbing.rb",
53
- "lib/typhoeus/hydra_mock.rb",
54
- "lib/typhoeus/multi.rb",
55
- "lib/typhoeus/normalized_header_hash.rb",
56
- "lib/typhoeus/remote.rb",
57
- "lib/typhoeus/remote_method.rb",
58
- "lib/typhoeus/remote_proxy_object.rb",
59
- "lib/typhoeus/request.rb",
60
- "lib/typhoeus/response.rb",
61
- "lib/typhoeus/service.rb",
62
- "lib/typhoeus/utils.rb",
63
- "profilers/valgrind.rb",
64
- "spec/fixtures/placeholder.gif",
65
- "spec/fixtures/placeholder.txt",
66
- "spec/fixtures/placeholder.ukn",
67
- "spec/fixtures/result_set.xml",
68
- "spec/servers/app.rb",
69
- "spec/spec.opts",
70
- "spec/spec_helper.rb",
71
- "spec/typhoeus/easy_spec.rb",
72
- "spec/typhoeus/filter_spec.rb",
73
- "spec/typhoeus/form_spec.rb",
74
- "spec/typhoeus/hydra_mock_spec.rb",
75
- "spec/typhoeus/hydra_spec.rb",
76
- "spec/typhoeus/multi_spec.rb",
77
- "spec/typhoeus/normalized_header_hash_spec.rb",
78
- "spec/typhoeus/remote_method_spec.rb",
79
- "spec/typhoeus/remote_proxy_object_spec.rb",
80
- "spec/typhoeus/remote_spec.rb",
81
- "spec/typhoeus/request_spec.rb",
82
- "spec/typhoeus/response_spec.rb",
83
- "spec/typhoeus/utils_spec.rb",
84
- "typhoeus.gemspec"
21
+ "CHANGELOG.markdown",
22
+ "Gemfile",
23
+ "Gemfile.lock",
24
+ "LICENSE",
25
+ "README.textile",
26
+ "Rakefile",
27
+ "VERSION",
28
+ "benchmarks/profile.rb",
29
+ "benchmarks/vs_nethttp.rb",
30
+ "examples/file.rb",
31
+ "examples/times.rb",
32
+ "examples/twitter.rb",
33
+ "ext/typhoeus/.gitignore",
34
+ "ext/typhoeus/extconf.rb",
35
+ "ext/typhoeus/native.c",
36
+ "ext/typhoeus/native.h",
37
+ "ext/typhoeus/typhoeus_easy.c",
38
+ "ext/typhoeus/typhoeus_easy.h",
39
+ "ext/typhoeus/typhoeus_form.c",
40
+ "ext/typhoeus/typhoeus_form.h",
41
+ "ext/typhoeus/typhoeus_multi.c",
42
+ "ext/typhoeus/typhoeus_multi.h",
43
+ "lib/typhoeus.rb",
44
+ "lib/typhoeus/.gitignore",
45
+ "lib/typhoeus/easy.rb",
46
+ "lib/typhoeus/filter.rb",
47
+ "lib/typhoeus/form.rb",
48
+ "lib/typhoeus/hydra.rb",
49
+ "lib/typhoeus/hydra/callbacks.rb",
50
+ "lib/typhoeus/hydra/connect_options.rb",
51
+ "lib/typhoeus/hydra/stubbing.rb",
52
+ "lib/typhoeus/hydra_mock.rb",
53
+ "lib/typhoeus/multi.rb",
54
+ "lib/typhoeus/normalized_header_hash.rb",
55
+ "lib/typhoeus/remote.rb",
56
+ "lib/typhoeus/remote_method.rb",
57
+ "lib/typhoeus/remote_proxy_object.rb",
58
+ "lib/typhoeus/request.rb",
59
+ "lib/typhoeus/response.rb",
60
+ "lib/typhoeus/service.rb",
61
+ "lib/typhoeus/utils.rb",
62
+ "profilers/valgrind.rb",
63
+ "spec/fixtures/placeholder.gif",
64
+ "spec/fixtures/placeholder.txt",
65
+ "spec/fixtures/placeholder.ukn",
66
+ "spec/fixtures/result_set.xml",
67
+ "spec/servers/app.rb",
68
+ "spec/spec.opts",
69
+ "spec/spec_helper.rb",
70
+ "spec/typhoeus/easy_spec.rb",
71
+ "spec/typhoeus/filter_spec.rb",
72
+ "spec/typhoeus/form_spec.rb",
73
+ "spec/typhoeus/hydra_mock_spec.rb",
74
+ "spec/typhoeus/hydra_spec.rb",
75
+ "spec/typhoeus/multi_spec.rb",
76
+ "spec/typhoeus/normalized_header_hash_spec.rb",
77
+ "spec/typhoeus/remote_method_spec.rb",
78
+ "spec/typhoeus/remote_proxy_object_spec.rb",
79
+ "spec/typhoeus/remote_spec.rb",
80
+ "spec/typhoeus/request_spec.rb",
81
+ "spec/typhoeus/response_spec.rb",
82
+ "spec/typhoeus/utils_spec.rb",
83
+ "typhoeus.gemspec"
85
84
  ]
86
85
  s.homepage = %q{http://github.com/dbalatero/typhoeus}
87
- s.rdoc_options = ["--charset=UTF-8"]
88
86
  s.require_paths = ["lib"]
89
87
  s.rubygems_version = %q{1.3.7}
90
88
  s.summary = %q{A library for interacting with web services (and building SOAs) at blinding speed.}
91
89
  s.test_files = [
90
+ "examples/file.rb",
91
+ "examples/times.rb",
92
+ "examples/twitter.rb",
92
93
  "spec/servers/app.rb",
93
- "spec/spec_helper.rb",
94
- "spec/typhoeus/easy_spec.rb",
95
- "spec/typhoeus/filter_spec.rb",
96
- "spec/typhoeus/form_spec.rb",
97
- "spec/typhoeus/hydra_mock_spec.rb",
98
- "spec/typhoeus/hydra_spec.rb",
99
- "spec/typhoeus/multi_spec.rb",
100
- "spec/typhoeus/normalized_header_hash_spec.rb",
101
- "spec/typhoeus/remote_method_spec.rb",
102
- "spec/typhoeus/remote_proxy_object_spec.rb",
103
- "spec/typhoeus/remote_spec.rb",
104
- "spec/typhoeus/request_spec.rb",
105
- "spec/typhoeus/response_spec.rb",
106
- "spec/typhoeus/utils_spec.rb",
107
- "examples/file.rb",
108
- "examples/times.rb",
109
- "examples/twitter.rb"
94
+ "spec/spec_helper.rb",
95
+ "spec/typhoeus/easy_spec.rb",
96
+ "spec/typhoeus/filter_spec.rb",
97
+ "spec/typhoeus/form_spec.rb",
98
+ "spec/typhoeus/hydra_mock_spec.rb",
99
+ "spec/typhoeus/hydra_spec.rb",
100
+ "spec/typhoeus/multi_spec.rb",
101
+ "spec/typhoeus/normalized_header_hash_spec.rb",
102
+ "spec/typhoeus/remote_method_spec.rb",
103
+ "spec/typhoeus/remote_proxy_object_spec.rb",
104
+ "spec/typhoeus/remote_spec.rb",
105
+ "spec/typhoeus/request_spec.rb",
106
+ "spec/typhoeus/response_spec.rb",
107
+ "spec/typhoeus/utils_spec.rb"
110
108
  ]
111
109
 
112
110
  if s.respond_to? :specification_version then
@@ -114,6 +112,7 @@ Gem::Specification.new do |s|
114
112
  s.specification_version = 3
115
113
 
116
114
  if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
115
+ s.add_runtime_dependency(%q<mime-types>, [">= 0"])
117
116
  s.add_runtime_dependency(%q<mime-types>, [">= 0"])
118
117
  s.add_development_dependency(%q<rspec>, [">= 0"])
119
118
  s.add_development_dependency(%q<jeweler>, [">= 0"])
@@ -121,6 +120,7 @@ Gem::Specification.new do |s|
121
120
  s.add_development_dependency(%q<sinatra>, [">= 0"])
122
121
  s.add_development_dependency(%q<json>, [">= 0"])
123
122
  else
123
+ s.add_dependency(%q<mime-types>, [">= 0"])
124
124
  s.add_dependency(%q<mime-types>, [">= 0"])
125
125
  s.add_dependency(%q<rspec>, [">= 0"])
126
126
  s.add_dependency(%q<jeweler>, [">= 0"])
@@ -129,6 +129,7 @@ Gem::Specification.new do |s|
129
129
  s.add_dependency(%q<json>, [">= 0"])
130
130
  end
131
131
  else
132
+ s.add_dependency(%q<mime-types>, [">= 0"])
132
133
  s.add_dependency(%q<mime-types>, [">= 0"])
133
134
  s.add_dependency(%q<rspec>, [">= 0"])
134
135
  s.add_dependency(%q<jeweler>, [">= 0"])
metadata CHANGED
@@ -1,12 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: typhoeus
3
3
  version: !ruby/object:Gem::Version
4
+ hash: 19
4
5
  prerelease: false
5
6
  segments:
6
7
  - 0
7
8
  - 2
8
- - 1
9
- version: 0.2.1
9
+ - 2
10
+ version: 0.2.2
10
11
  platform: ruby
11
12
  authors:
12
13
  - Paul Dix
@@ -15,87 +16,107 @@ autorequire:
15
16
  bindir: bin
16
17
  cert_chain: []
17
18
 
18
- date: 2011-01-28 00:00:00 -08:00
19
+ date: 2011-02-14 00:00:00 -08:00
19
20
  default_executable:
20
21
  dependencies:
21
22
  - !ruby/object:Gem::Dependency
22
- name: mime-types
23
+ type: :runtime
23
24
  prerelease: false
24
- requirement: &id001 !ruby/object:Gem::Requirement
25
+ version_requirements: &id001 !ruby/object:Gem::Requirement
25
26
  none: false
26
27
  requirements:
27
28
  - - ">="
28
29
  - !ruby/object:Gem::Version
30
+ hash: 3
29
31
  segments:
30
32
  - 0
31
33
  version: "0"
32
- type: :runtime
33
- version_requirements: *id001
34
+ name: mime-types
35
+ requirement: *id001
34
36
  - !ruby/object:Gem::Dependency
35
- name: rspec
37
+ type: :runtime
36
38
  prerelease: false
37
- requirement: &id002 !ruby/object:Gem::Requirement
39
+ version_requirements: &id002 !ruby/object:Gem::Requirement
38
40
  none: false
39
41
  requirements:
40
42
  - - ">="
41
43
  - !ruby/object:Gem::Version
44
+ hash: 3
42
45
  segments:
43
46
  - 0
44
47
  version: "0"
45
- type: :development
46
- version_requirements: *id002
48
+ name: mime-types
49
+ requirement: *id002
47
50
  - !ruby/object:Gem::Dependency
48
- name: jeweler
51
+ type: :development
49
52
  prerelease: false
50
- requirement: &id003 !ruby/object:Gem::Requirement
53
+ version_requirements: &id003 !ruby/object:Gem::Requirement
51
54
  none: false
52
55
  requirements:
53
56
  - - ">="
54
57
  - !ruby/object:Gem::Version
58
+ hash: 3
55
59
  segments:
56
60
  - 0
57
61
  version: "0"
58
- type: :development
59
- version_requirements: *id003
62
+ name: rspec
63
+ requirement: *id003
60
64
  - !ruby/object:Gem::Dependency
61
- name: diff-lcs
65
+ type: :development
62
66
  prerelease: false
63
- requirement: &id004 !ruby/object:Gem::Requirement
67
+ version_requirements: &id004 !ruby/object:Gem::Requirement
64
68
  none: false
65
69
  requirements:
66
70
  - - ">="
67
71
  - !ruby/object:Gem::Version
72
+ hash: 3
68
73
  segments:
69
74
  - 0
70
75
  version: "0"
71
- type: :development
72
- version_requirements: *id004
76
+ name: jeweler
77
+ requirement: *id004
73
78
  - !ruby/object:Gem::Dependency
74
- name: sinatra
79
+ type: :development
75
80
  prerelease: false
76
- requirement: &id005 !ruby/object:Gem::Requirement
81
+ version_requirements: &id005 !ruby/object:Gem::Requirement
77
82
  none: false
78
83
  requirements:
79
84
  - - ">="
80
85
  - !ruby/object:Gem::Version
86
+ hash: 3
81
87
  segments:
82
88
  - 0
83
89
  version: "0"
84
- type: :development
85
- version_requirements: *id005
90
+ name: diff-lcs
91
+ requirement: *id005
86
92
  - !ruby/object:Gem::Dependency
87
- name: json
93
+ type: :development
88
94
  prerelease: false
89
- requirement: &id006 !ruby/object:Gem::Requirement
95
+ version_requirements: &id006 !ruby/object:Gem::Requirement
90
96
  none: false
91
97
  requirements:
92
98
  - - ">="
93
99
  - !ruby/object:Gem::Version
100
+ hash: 3
94
101
  segments:
95
102
  - 0
96
103
  version: "0"
104
+ name: sinatra
105
+ requirement: *id006
106
+ - !ruby/object:Gem::Dependency
97
107
  type: :development
98
- version_requirements: *id006
108
+ prerelease: false
109
+ version_requirements: &id007 !ruby/object:Gem::Requirement
110
+ none: false
111
+ requirements:
112
+ - - ">="
113
+ - !ruby/object:Gem::Version
114
+ hash: 3
115
+ segments:
116
+ - 0
117
+ version: "0"
118
+ name: json
119
+ requirement: *id007
99
120
  description: Like a modern code version of the mythical beast with 100 serpent heads, Typhoeus runs HTTP requests in parallel while cleanly encapsulating handling logic.
100
121
  email: dbalatero@gmail.com
101
122
  executables: []
@@ -106,7 +127,6 @@ extra_rdoc_files:
106
127
  - LICENSE
107
128
  - README.textile
108
129
  files:
109
- - .gitignore
110
130
  - CHANGELOG.markdown
111
131
  - Gemfile
112
132
  - Gemfile.lock
@@ -175,8 +195,8 @@ homepage: http://github.com/dbalatero/typhoeus
175
195
  licenses: []
176
196
 
177
197
  post_install_message:
178
- rdoc_options:
179
- - --charset=UTF-8
198
+ rdoc_options: []
199
+
180
200
  require_paths:
181
201
  - lib
182
202
  required_ruby_version: !ruby/object:Gem::Requirement
@@ -184,6 +204,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
184
204
  requirements:
185
205
  - - ">="
186
206
  - !ruby/object:Gem::Version
207
+ hash: 3
187
208
  segments:
188
209
  - 0
189
210
  version: "0"
@@ -192,6 +213,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
192
213
  requirements:
193
214
  - - ">="
194
215
  - !ruby/object:Gem::Version
216
+ hash: 3
195
217
  segments:
196
218
  - 0
197
219
  version: "0"
@@ -203,6 +225,9 @@ signing_key:
203
225
  specification_version: 3
204
226
  summary: A library for interacting with web services (and building SOAs) at blinding speed.
205
227
  test_files:
228
+ - examples/file.rb
229
+ - examples/times.rb
230
+ - examples/twitter.rb
206
231
  - spec/servers/app.rb
207
232
  - spec/spec_helper.rb
208
233
  - spec/typhoeus/easy_spec.rb
@@ -218,6 +243,3 @@ test_files:
218
243
  - spec/typhoeus/request_spec.rb
219
244
  - spec/typhoeus/response_spec.rb
220
245
  - spec/typhoeus/utils_spec.rb
221
- - examples/file.rb
222
- - examples/times.rb
223
- - examples/twitter.rb
data/.gitignore DELETED
@@ -1,4 +0,0 @@
1
- .*.sw?
2
- *.gem
3
- .bundle
4
- .idea