typhoeus 0.3.3 → 0.4.0

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.
Files changed (59) hide show
  1. data/{CHANGELOG.markdown → CHANGELOG.md} +21 -12
  2. data/LICENSE +2 -0
  3. data/README.md +455 -0
  4. data/Rakefile +6 -26
  5. data/lib/typhoeus.rb +4 -6
  6. data/lib/typhoeus/curl.rb +453 -0
  7. data/lib/typhoeus/easy.rb +60 -358
  8. data/lib/typhoeus/easy/auth.rb +14 -0
  9. data/lib/typhoeus/easy/callbacks.rb +33 -0
  10. data/lib/typhoeus/easy/ffi_helper.rb +61 -0
  11. data/lib/typhoeus/easy/infos.rb +90 -0
  12. data/lib/typhoeus/easy/options.rb +115 -0
  13. data/lib/typhoeus/easy/proxy.rb +20 -0
  14. data/lib/typhoeus/easy/ssl.rb +82 -0
  15. data/lib/typhoeus/form.rb +30 -1
  16. data/lib/typhoeus/{normalized_header_hash.rb → header.rb} +2 -6
  17. data/lib/typhoeus/hydra.rb +9 -12
  18. data/lib/typhoeus/hydra_mock.rb +2 -2
  19. data/lib/typhoeus/multi.rb +118 -9
  20. data/lib/typhoeus/param_processor.rb +43 -0
  21. data/lib/typhoeus/request.rb +18 -21
  22. data/lib/typhoeus/response.rb +5 -4
  23. data/lib/typhoeus/utils.rb +14 -27
  24. data/lib/typhoeus/version.rb +1 -1
  25. metadata +155 -152
  26. data/Gemfile.lock +0 -37
  27. data/ext/typhoeus/.gitignore +0 -7
  28. data/ext/typhoeus/extconf.rb +0 -65
  29. data/ext/typhoeus/native.c +0 -12
  30. data/ext/typhoeus/native.h +0 -22
  31. data/ext/typhoeus/typhoeus_easy.c +0 -232
  32. data/ext/typhoeus/typhoeus_easy.h +0 -20
  33. data/ext/typhoeus/typhoeus_form.c +0 -59
  34. data/ext/typhoeus/typhoeus_form.h +0 -13
  35. data/ext/typhoeus/typhoeus_multi.c +0 -217
  36. data/ext/typhoeus/typhoeus_multi.h +0 -16
  37. data/lib/typhoeus/.gitignore +0 -1
  38. data/lib/typhoeus/service.rb +0 -20
  39. data/spec/fixtures/placeholder.gif +0 -0
  40. data/spec/fixtures/placeholder.txt +0 -1
  41. data/spec/fixtures/placeholder.ukn +0 -0
  42. data/spec/fixtures/result_set.xml +0 -60
  43. data/spec/servers/app.rb +0 -97
  44. data/spec/spec_helper.rb +0 -19
  45. data/spec/support/typhoeus_localhost_server.rb +0 -58
  46. data/spec/typhoeus/easy_spec.rb +0 -391
  47. data/spec/typhoeus/filter_spec.rb +0 -35
  48. data/spec/typhoeus/form_spec.rb +0 -117
  49. data/spec/typhoeus/hydra_mock_spec.rb +0 -300
  50. data/spec/typhoeus/hydra_spec.rb +0 -602
  51. data/spec/typhoeus/multi_spec.rb +0 -74
  52. data/spec/typhoeus/normalized_header_hash_spec.rb +0 -41
  53. data/spec/typhoeus/remote_method_spec.rb +0 -141
  54. data/spec/typhoeus/remote_proxy_object_spec.rb +0 -65
  55. data/spec/typhoeus/remote_spec.rb +0 -695
  56. data/spec/typhoeus/request_spec.rb +0 -387
  57. data/spec/typhoeus/response_spec.rb +0 -192
  58. data/spec/typhoeus/utils_spec.rb +0 -22
  59. data/typhoeus.gemspec +0 -33
@@ -1,5 +1,3 @@
1
- require 'tempfile'
2
-
3
1
  module Typhoeus
4
2
  module Utils
5
3
  # Taken from Rack::Utils, 1.2.1 to remove Rack dependency.
@@ -12,31 +10,7 @@ module Typhoeus
12
10
 
13
11
  # Params are NOT escaped.
14
12
  def traverse_params_hash(hash, result = nil, current_key = nil)
15
- result ||= { :files => [], :params => [] }
16
-
17
- hash.keys.sort { |a, b| a.to_s <=> b.to_s }.collect do |key|
18
- new_key = (current_key ? "#{current_key}[#{key}]" : key).to_s
19
- case hash[key]
20
- when Hash
21
- traverse_params_hash(hash[key], result, new_key)
22
- when Array
23
- hash[key].each do |v|
24
- result[:params] << [new_key, v.to_s]
25
- end
26
- when File, Tempfile
27
- filename = File.basename(hash[key].path)
28
- types = MIME::Types.type_for(filename)
29
- result[:files] << [
30
- new_key,
31
- filename,
32
- types.empty? ? 'application/octet-stream' : types[0].to_s,
33
- File.expand_path(hash[key].path)
34
- ]
35
- else
36
- result[:params] << [new_key, hash[key].to_s]
37
- end
38
- end
39
- result
13
+ result = ParamProcessor.traverse_params_hash hash, result, current_key
40
14
  end
41
15
  module_function :traverse_params_hash
42
16
 
@@ -59,5 +33,18 @@ module Typhoeus
59
33
  end
60
34
  end
61
35
  module_function :bytesize
36
+
37
+ # Return a byteslice from a string; uses String#[] under Ruby 1.8 and
38
+ # String#byteslice under 1.9.
39
+ if ''.respond_to?(:byteslice)
40
+ def byteslice(string, *args)
41
+ string.byteslice(*args)
42
+ end
43
+ else
44
+ def byteslice(string, *args)
45
+ string[*args]
46
+ end
47
+ end
48
+ module_function :byteslice
62
49
  end
63
50
  end
@@ -1,3 +1,3 @@
1
1
  module Typhoeus
2
- VERSION = '0.3.3'
2
+ VERSION = '0.4.0'
3
3
  end
metadata CHANGED
@@ -1,205 +1,208 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: typhoeus
3
- version: !ruby/object:Gem::Version
4
- hash: 21
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.4.0
5
5
  prerelease:
6
- segments:
7
- - 0
8
- - 3
9
- - 3
10
- version: 0.3.3
11
6
  platform: ruby
12
- authors:
7
+ authors:
13
8
  - David Balatero
14
9
  - Paul Dix
10
+ - Hans Hasselberg
15
11
  autorequire:
16
12
  bindir: bin
17
13
  cert_chain: []
18
-
19
- date: 2011-11-17 00:00:00 Z
20
- dependencies:
21
- - !ruby/object:Gem::Dependency
22
- name: mime-types
14
+ date: 2012-06-08 00:00:00.000000000 Z
15
+ dependencies:
16
+ - !ruby/object:Gem::Dependency
17
+ name: ffi
18
+ requirement: !ruby/object:Gem::Requirement
19
+ none: false
20
+ requirements:
21
+ - - ~>
22
+ - !ruby/object:Gem::Version
23
+ version: '1.0'
24
+ type: :runtime
23
25
  prerelease: false
24
- requirement: &id001 !ruby/object:Gem::Requirement
25
- none: false
26
- requirements:
27
- - - ">="
28
- - !ruby/object:Gem::Version
29
- hash: 3
30
- segments:
31
- - 0
32
- version: "0"
26
+ version_requirements: !ruby/object:Gem::Requirement
27
+ none: false
28
+ requirements:
29
+ - - ~>
30
+ - !ruby/object:Gem::Version
31
+ version: '1.0'
32
+ - !ruby/object:Gem::Dependency
33
+ name: mime-types
34
+ requirement: !ruby/object:Gem::Requirement
35
+ none: false
36
+ requirements:
37
+ - - ~>
38
+ - !ruby/object:Gem::Version
39
+ version: '1.18'
33
40
  type: :runtime
34
- version_requirements: *id001
35
- - !ruby/object:Gem::Dependency
36
- name: rspec
37
41
  prerelease: false
38
- requirement: &id002 !ruby/object:Gem::Requirement
42
+ version_requirements: !ruby/object:Gem::Requirement
43
+ none: false
44
+ requirements:
45
+ - - ~>
46
+ - !ruby/object:Gem::Version
47
+ version: '1.18'
48
+ - !ruby/object:Gem::Dependency
49
+ name: sinatra
50
+ requirement: !ruby/object:Gem::Requirement
39
51
  none: false
40
- requirements:
52
+ requirements:
41
53
  - - ~>
42
- - !ruby/object:Gem::Version
43
- hash: 15
44
- segments:
45
- - 2
46
- - 6
47
- version: "2.6"
54
+ - !ruby/object:Gem::Version
55
+ version: '1.3'
48
56
  type: :development
49
- version_requirements: *id002
50
- - !ruby/object:Gem::Dependency
51
- name: diff-lcs
52
57
  prerelease: false
53
- requirement: &id003 !ruby/object:Gem::Requirement
54
- none: false
55
- requirements:
56
- - - ">="
57
- - !ruby/object:Gem::Version
58
- hash: 3
59
- segments:
60
- - 0
61
- version: "0"
58
+ version_requirements: !ruby/object:Gem::Requirement
59
+ none: false
60
+ requirements:
61
+ - - ~>
62
+ - !ruby/object:Gem::Version
63
+ version: '1.3'
64
+ - !ruby/object:Gem::Dependency
65
+ name: json
66
+ requirement: !ruby/object:Gem::Requirement
67
+ none: false
68
+ requirements:
69
+ - - ~>
70
+ - !ruby/object:Gem::Version
71
+ version: '1.7'
72
+ type: :development
73
+ prerelease: false
74
+ version_requirements: !ruby/object:Gem::Requirement
75
+ none: false
76
+ requirements:
77
+ - - ~>
78
+ - !ruby/object:Gem::Version
79
+ version: '1.7'
80
+ - !ruby/object:Gem::Dependency
81
+ name: rake
82
+ requirement: !ruby/object:Gem::Requirement
83
+ none: false
84
+ requirements:
85
+ - - ~>
86
+ - !ruby/object:Gem::Version
87
+ version: '0.9'
62
88
  type: :development
63
- version_requirements: *id003
64
- - !ruby/object:Gem::Dependency
65
- name: sinatra
66
89
  prerelease: false
67
- requirement: &id004 !ruby/object:Gem::Requirement
68
- none: false
69
- requirements:
70
- - - ">="
71
- - !ruby/object:Gem::Version
72
- hash: 3
73
- segments:
74
- - 0
75
- version: "0"
90
+ version_requirements: !ruby/object:Gem::Requirement
91
+ none: false
92
+ requirements:
93
+ - - ~>
94
+ - !ruby/object:Gem::Version
95
+ version: '0.9'
96
+ - !ruby/object:Gem::Dependency
97
+ name: mocha
98
+ requirement: !ruby/object:Gem::Requirement
99
+ none: false
100
+ requirements:
101
+ - - ~>
102
+ - !ruby/object:Gem::Version
103
+ version: '0.10'
76
104
  type: :development
77
- version_requirements: *id004
78
- - !ruby/object:Gem::Dependency
79
- name: json
80
105
  prerelease: false
81
- requirement: &id005 !ruby/object:Gem::Requirement
82
- none: false
83
- requirements:
84
- - - ">="
85
- - !ruby/object:Gem::Version
86
- hash: 3
87
- segments:
88
- - 0
89
- version: "0"
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ none: false
108
+ requirements:
109
+ - - ~>
110
+ - !ruby/object:Gem::Version
111
+ version: '0.10'
112
+ - !ruby/object:Gem::Dependency
113
+ name: rspec
114
+ requirement: !ruby/object:Gem::Requirement
115
+ none: false
116
+ requirements:
117
+ - - ~>
118
+ - !ruby/object:Gem::Version
119
+ version: '2.10'
90
120
  type: :development
91
- version_requirements: *id005
92
- - !ruby/object:Gem::Dependency
93
- name: rake
94
121
  prerelease: false
95
- requirement: &id006 !ruby/object:Gem::Requirement
96
- none: false
97
- requirements:
98
- - - ">="
99
- - !ruby/object:Gem::Version
100
- hash: 3
101
- segments:
102
- - 0
103
- version: "0"
122
+ version_requirements: !ruby/object:Gem::Requirement
123
+ none: false
124
+ requirements:
125
+ - - ~>
126
+ - !ruby/object:Gem::Version
127
+ version: '2.10'
128
+ - !ruby/object:Gem::Dependency
129
+ name: guard-rspec
130
+ requirement: !ruby/object:Gem::Requirement
131
+ none: false
132
+ requirements:
133
+ - - ~>
134
+ - !ruby/object:Gem::Version
135
+ version: '0.6'
104
136
  type: :development
105
- version_requirements: *id006
106
- 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.
107
- email: dbalatero@gmail.com
137
+ prerelease: false
138
+ version_requirements: !ruby/object:Gem::Requirement
139
+ none: false
140
+ requirements:
141
+ - - ~>
142
+ - !ruby/object:Gem::Version
143
+ version: '0.6'
144
+ description: Like a modern code version of the mythical beast with 100 serpent heads,
145
+ Typhoeus runs HTTP requests in parallel while cleanly encapsulating handling logic.
146
+ email:
147
+ - hans.hasselberg@gmail.com
108
148
  executables: []
109
-
110
- extensions:
111
- - ext/typhoeus/extconf.rb
149
+ extensions: []
112
150
  extra_rdoc_files: []
113
-
114
- files:
115
- - ext/typhoeus/.gitignore
116
- - ext/typhoeus/extconf.rb
117
- - ext/typhoeus/native.c
118
- - ext/typhoeus/native.h
119
- - ext/typhoeus/typhoeus_easy.c
120
- - ext/typhoeus/typhoeus_easy.h
121
- - ext/typhoeus/typhoeus_form.c
122
- - ext/typhoeus/typhoeus_form.h
123
- - ext/typhoeus/typhoeus_multi.c
124
- - ext/typhoeus/typhoeus_multi.h
125
- - lib/typhoeus.rb
126
- - lib/typhoeus/.gitignore
151
+ files:
152
+ - lib/typhoeus/curl.rb
153
+ - lib/typhoeus/easy/auth.rb
154
+ - lib/typhoeus/easy/callbacks.rb
155
+ - lib/typhoeus/easy/ffi_helper.rb
156
+ - lib/typhoeus/easy/infos.rb
157
+ - lib/typhoeus/easy/options.rb
158
+ - lib/typhoeus/easy/proxy.rb
159
+ - lib/typhoeus/easy/ssl.rb
127
160
  - lib/typhoeus/easy.rb
128
161
  - lib/typhoeus/filter.rb
129
162
  - lib/typhoeus/form.rb
130
- - lib/typhoeus/hydra.rb
163
+ - lib/typhoeus/header.rb
131
164
  - lib/typhoeus/hydra/callbacks.rb
132
165
  - lib/typhoeus/hydra/connect_options.rb
133
166
  - lib/typhoeus/hydra/stubbing.rb
167
+ - lib/typhoeus/hydra.rb
134
168
  - lib/typhoeus/hydra_mock.rb
135
169
  - lib/typhoeus/multi.rb
136
- - lib/typhoeus/normalized_header_hash.rb
170
+ - lib/typhoeus/param_processor.rb
137
171
  - lib/typhoeus/remote.rb
138
172
  - lib/typhoeus/remote_method.rb
139
173
  - lib/typhoeus/remote_proxy_object.rb
140
174
  - lib/typhoeus/request.rb
141
175
  - lib/typhoeus/response.rb
142
- - lib/typhoeus/service.rb
143
176
  - lib/typhoeus/utils.rb
144
177
  - lib/typhoeus/version.rb
145
- - spec/fixtures/placeholder.gif
146
- - spec/fixtures/placeholder.txt
147
- - spec/fixtures/placeholder.ukn
148
- - spec/fixtures/result_set.xml
149
- - spec/servers/app.rb
150
- - spec/spec_helper.rb
151
- - spec/support/typhoeus_localhost_server.rb
152
- - spec/typhoeus/easy_spec.rb
153
- - spec/typhoeus/filter_spec.rb
154
- - spec/typhoeus/form_spec.rb
155
- - spec/typhoeus/hydra_mock_spec.rb
156
- - spec/typhoeus/hydra_spec.rb
157
- - spec/typhoeus/multi_spec.rb
158
- - spec/typhoeus/normalized_header_hash_spec.rb
159
- - spec/typhoeus/remote_method_spec.rb
160
- - spec/typhoeus/remote_proxy_object_spec.rb
161
- - spec/typhoeus/remote_spec.rb
162
- - spec/typhoeus/request_spec.rb
163
- - spec/typhoeus/response_spec.rb
164
- - spec/typhoeus/utils_spec.rb
165
- - CHANGELOG.markdown
178
+ - lib/typhoeus.rb
179
+ - CHANGELOG.md
166
180
  - Gemfile
167
- - Gemfile.lock
168
181
  - LICENSE
182
+ - README.md
169
183
  - Rakefile
170
- - typhoeus.gemspec
171
- homepage: https://github.com/dbalatero/typhoeus
184
+ homepage: https://github.com/typhoeus/typhoeus
172
185
  licenses: []
173
-
174
186
  post_install_message:
175
187
  rdoc_options: []
176
-
177
- require_paths:
188
+ require_paths:
178
189
  - lib
179
- required_ruby_version: !ruby/object:Gem::Requirement
190
+ required_ruby_version: !ruby/object:Gem::Requirement
180
191
  none: false
181
- requirements:
182
- - - ">="
183
- - !ruby/object:Gem::Version
184
- hash: 3
185
- segments:
186
- - 0
187
- version: "0"
188
- required_rubygems_version: !ruby/object:Gem::Requirement
192
+ requirements:
193
+ - - ! '>='
194
+ - !ruby/object:Gem::Version
195
+ version: '0'
196
+ required_rubygems_version: !ruby/object:Gem::Requirement
189
197
  none: false
190
- requirements:
191
- - - ">="
192
- - !ruby/object:Gem::Version
193
- hash: 3
194
- segments:
195
- - 0
196
- version: "0"
198
+ requirements:
199
+ - - ! '>='
200
+ - !ruby/object:Gem::Version
201
+ version: 1.3.6
197
202
  requirements: []
198
-
199
- rubyforge_project: "[none]"
200
- rubygems_version: 1.8.10
203
+ rubyforge_project: ! '[none]'
204
+ rubygems_version: 1.8.24
201
205
  signing_key:
202
206
  specification_version: 3
203
207
  summary: Parallel HTTP library on top of libcurl multi.
204
208
  test_files: []
205
-
data/Gemfile.lock DELETED
@@ -1,37 +0,0 @@
1
- PATH
2
- remote: .
3
- specs:
4
- typhoeus (0.3.2)
5
- mime-types
6
-
7
- GEM
8
- remote: http://rubygems.org/
9
- specs:
10
- diff-lcs (1.1.2)
11
- json (1.5.3)
12
- mime-types (1.16)
13
- rack (1.3.0)
14
- rake (0.9.2)
15
- rspec (2.6.0)
16
- rspec-core (~> 2.6.0)
17
- rspec-expectations (~> 2.6.0)
18
- rspec-mocks (~> 2.6.0)
19
- rspec-core (2.6.4)
20
- rspec-expectations (2.6.0)
21
- diff-lcs (~> 1.1.2)
22
- rspec-mocks (2.6.0)
23
- sinatra (1.2.6)
24
- rack (~> 1.1)
25
- tilt (< 2.0, >= 1.2.2)
26
- tilt (1.3.2)
27
-
28
- PLATFORMS
29
- ruby
30
-
31
- DEPENDENCIES
32
- diff-lcs
33
- json
34
- rake
35
- rspec (~> 2.6)
36
- sinatra
37
- typhoeus!