marnen-typhoeus 0.3.4

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 (57) hide show
  1. data/CHANGELOG.markdown +84 -0
  2. data/Gemfile +3 -0
  3. data/Gemfile.lock +56 -0
  4. data/LICENSE +20 -0
  5. data/Rakefile +43 -0
  6. data/ext/typhoeus/.gitignore +7 -0
  7. data/ext/typhoeus/extconf.rb +65 -0
  8. data/ext/typhoeus/native.c +12 -0
  9. data/ext/typhoeus/native.h +22 -0
  10. data/ext/typhoeus/typhoeus_easy.c +232 -0
  11. data/ext/typhoeus/typhoeus_easy.h +20 -0
  12. data/ext/typhoeus/typhoeus_form.c +59 -0
  13. data/ext/typhoeus/typhoeus_form.h +13 -0
  14. data/ext/typhoeus/typhoeus_multi.c +217 -0
  15. data/ext/typhoeus/typhoeus_multi.h +16 -0
  16. data/lib/typhoeus.rb +58 -0
  17. data/lib/typhoeus/.gitignore +1 -0
  18. data/lib/typhoeus/easy.rb +413 -0
  19. data/lib/typhoeus/filter.rb +28 -0
  20. data/lib/typhoeus/form.rb +32 -0
  21. data/lib/typhoeus/hydra.rb +250 -0
  22. data/lib/typhoeus/hydra/callbacks.rb +24 -0
  23. data/lib/typhoeus/hydra/connect_options.rb +61 -0
  24. data/lib/typhoeus/hydra/stubbing.rb +68 -0
  25. data/lib/typhoeus/hydra_mock.rb +131 -0
  26. data/lib/typhoeus/multi.rb +37 -0
  27. data/lib/typhoeus/normalized_header_hash.rb +58 -0
  28. data/lib/typhoeus/remote.rb +306 -0
  29. data/lib/typhoeus/remote_method.rb +108 -0
  30. data/lib/typhoeus/remote_proxy_object.rb +50 -0
  31. data/lib/typhoeus/request.rb +269 -0
  32. data/lib/typhoeus/response.rb +122 -0
  33. data/lib/typhoeus/service.rb +20 -0
  34. data/lib/typhoeus/utils.rb +74 -0
  35. data/lib/typhoeus/version.rb +3 -0
  36. data/spec/fixtures/placeholder.gif +0 -0
  37. data/spec/fixtures/placeholder.txt +1 -0
  38. data/spec/fixtures/placeholder.ukn +0 -0
  39. data/spec/fixtures/result_set.xml +60 -0
  40. data/spec/servers/app.rb +97 -0
  41. data/spec/spec_helper.rb +19 -0
  42. data/spec/support/typhoeus_localhost_server.rb +58 -0
  43. data/spec/typhoeus/easy_spec.rb +391 -0
  44. data/spec/typhoeus/filter_spec.rb +35 -0
  45. data/spec/typhoeus/form_spec.rb +117 -0
  46. data/spec/typhoeus/hydra_mock_spec.rb +300 -0
  47. data/spec/typhoeus/hydra_spec.rb +602 -0
  48. data/spec/typhoeus/multi_spec.rb +74 -0
  49. data/spec/typhoeus/normalized_header_hash_spec.rb +41 -0
  50. data/spec/typhoeus/remote_method_spec.rb +141 -0
  51. data/spec/typhoeus/remote_proxy_object_spec.rb +65 -0
  52. data/spec/typhoeus/remote_spec.rb +695 -0
  53. data/spec/typhoeus/request_spec.rb +387 -0
  54. data/spec/typhoeus/response_spec.rb +192 -0
  55. data/spec/typhoeus/utils_spec.rb +22 -0
  56. data/typhoeus.gemspec +35 -0
  57. metadata +235 -0
@@ -0,0 +1,22 @@
1
+ require File.expand_path(File.dirname(__FILE__) + "/../spec_helper")
2
+
3
+ describe Typhoeus::Utils do
4
+ # Taken from Rack 1.2.1
5
+ describe "#escape" do
6
+ it "should escape correctly" do
7
+ Typhoeus::Utils.escape("fo<o>bar").should == "fo%3Co%3Ebar"
8
+ Typhoeus::Utils.escape("a space").should == "a+space"
9
+ Typhoeus::Utils.escape("q1!2\"'w$5&7/z8)?\\").
10
+ should == "q1%212%22%27w%245%267%2Fz8%29%3F%5C"
11
+ end
12
+
13
+ it "should escape correctly for multibyte characters" do
14
+ matz_name = "\xE3\x81\xBE\xE3\x81\xA4\xE3\x82\x82\xE3\x81\xA8".unpack("a*")[0] # Matsumoto
15
+ matz_name.force_encoding("UTF-8") if matz_name.respond_to? :force_encoding
16
+ Typhoeus::Utils.escape(matz_name).should == '%E3%81%BE%E3%81%A4%E3%82%82%E3%81%A8'
17
+ matz_name_sep = "\xE3\x81\xBE\xE3\x81\xA4 \xE3\x82\x82\xE3\x81\xA8".unpack("a*")[0] # Matsu moto
18
+ matz_name_sep.force_encoding("UTF-8") if matz_name_sep.respond_to? :force_encoding
19
+ Typhoeus::Utils.escape(matz_name_sep).should == '%E3%81%BE%E3%81%A4+%E3%82%82%E3%81%A8'
20
+ end
21
+ end
22
+ end
@@ -0,0 +1,35 @@
1
+ # encoding: utf-8
2
+
3
+ $:.unshift File.expand_path('../lib', __FILE__)
4
+ require 'typhoeus/version'
5
+
6
+ Gem::Specification.new do |s|
7
+ s.name = "marnen-typhoeus"
8
+ s.version = Typhoeus::VERSION
9
+ s.authors = ["David Balatero", "Paul Dix", "Marnen Laibow-Koser"]
10
+ s.email = ["dbalatero@gmail.com", "marnen@marnen.org"]
11
+ s.homepage = "https://github.com/marnen/typhoeus"
12
+ s.summary = "Parallel HTTP library on top of libcurl multi (Marnen's fork; original gem available at https://github.com/dbalatero/typhoeus)."
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
+ s.extensions = ["ext/typhoeus/extconf.rb"]
15
+ s.files = (`git ls-files ext lib spec`.split("\n")) + [
16
+ 'CHANGELOG.markdown',
17
+ 'Gemfile',
18
+ 'Gemfile.lock',
19
+ 'LICENSE',
20
+ 'Rakefile',
21
+ 'typhoeus.gemspec'
22
+ ]
23
+ s.platform = Gem::Platform::RUBY
24
+ s.require_path = 'lib'
25
+ s.rubyforge_project = '[none]'
26
+
27
+ s.add_runtime_dependency 'mime-types', ['>= 0']
28
+ s.add_development_dependency 'rspec', ["~> 2.6"]
29
+ s.add_development_dependency 'diff-lcs', [">= 0"]
30
+ s.add_development_dependency 'sinatra', [">= 0"]
31
+ s.add_development_dependency 'json', [">= 0"]
32
+ s.add_development_dependency 'rake', [">= 0"]
33
+ s.add_development_dependency 'pry-nav', [">= 0"]
34
+ s.add_development_dependency 'autotest', [">= 0"]
35
+ end
metadata ADDED
@@ -0,0 +1,235 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: marnen-typhoeus
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.3.4
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - David Balatero
9
+ - Paul Dix
10
+ - Marnen Laibow-Koser
11
+ autorequire:
12
+ bindir: bin
13
+ cert_chain: []
14
+ date: 2012-05-02 00:00:00.000000000 Z
15
+ dependencies:
16
+ - !ruby/object:Gem::Dependency
17
+ name: mime-types
18
+ requirement: !ruby/object:Gem::Requirement
19
+ none: false
20
+ requirements:
21
+ - - ! '>='
22
+ - !ruby/object:Gem::Version
23
+ version: '0'
24
+ type: :runtime
25
+ prerelease: false
26
+ version_requirements: !ruby/object:Gem::Requirement
27
+ none: false
28
+ requirements:
29
+ - - ! '>='
30
+ - !ruby/object:Gem::Version
31
+ version: '0'
32
+ - !ruby/object:Gem::Dependency
33
+ name: rspec
34
+ requirement: !ruby/object:Gem::Requirement
35
+ none: false
36
+ requirements:
37
+ - - ~>
38
+ - !ruby/object:Gem::Version
39
+ version: '2.6'
40
+ type: :development
41
+ prerelease: false
42
+ version_requirements: !ruby/object:Gem::Requirement
43
+ none: false
44
+ requirements:
45
+ - - ~>
46
+ - !ruby/object:Gem::Version
47
+ version: '2.6'
48
+ - !ruby/object:Gem::Dependency
49
+ name: diff-lcs
50
+ requirement: !ruby/object:Gem::Requirement
51
+ none: false
52
+ requirements:
53
+ - - ! '>='
54
+ - !ruby/object:Gem::Version
55
+ version: '0'
56
+ type: :development
57
+ prerelease: false
58
+ version_requirements: !ruby/object:Gem::Requirement
59
+ none: false
60
+ requirements:
61
+ - - ! '>='
62
+ - !ruby/object:Gem::Version
63
+ version: '0'
64
+ - !ruby/object:Gem::Dependency
65
+ name: sinatra
66
+ requirement: !ruby/object:Gem::Requirement
67
+ none: false
68
+ requirements:
69
+ - - ! '>='
70
+ - !ruby/object:Gem::Version
71
+ version: '0'
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: '0'
80
+ - !ruby/object:Gem::Dependency
81
+ name: json
82
+ requirement: !ruby/object:Gem::Requirement
83
+ none: false
84
+ requirements:
85
+ - - ! '>='
86
+ - !ruby/object:Gem::Version
87
+ version: '0'
88
+ type: :development
89
+ prerelease: false
90
+ version_requirements: !ruby/object:Gem::Requirement
91
+ none: false
92
+ requirements:
93
+ - - ! '>='
94
+ - !ruby/object:Gem::Version
95
+ version: '0'
96
+ - !ruby/object:Gem::Dependency
97
+ name: rake
98
+ requirement: !ruby/object:Gem::Requirement
99
+ none: false
100
+ requirements:
101
+ - - ! '>='
102
+ - !ruby/object:Gem::Version
103
+ version: '0'
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ none: false
108
+ requirements:
109
+ - - ! '>='
110
+ - !ruby/object:Gem::Version
111
+ version: '0'
112
+ - !ruby/object:Gem::Dependency
113
+ name: pry-nav
114
+ requirement: !ruby/object:Gem::Requirement
115
+ none: false
116
+ requirements:
117
+ - - ! '>='
118
+ - !ruby/object:Gem::Version
119
+ version: '0'
120
+ type: :development
121
+ prerelease: false
122
+ version_requirements: !ruby/object:Gem::Requirement
123
+ none: false
124
+ requirements:
125
+ - - ! '>='
126
+ - !ruby/object:Gem::Version
127
+ version: '0'
128
+ - !ruby/object:Gem::Dependency
129
+ name: autotest
130
+ requirement: !ruby/object:Gem::Requirement
131
+ none: false
132
+ requirements:
133
+ - - ! '>='
134
+ - !ruby/object:Gem::Version
135
+ version: '0'
136
+ type: :development
137
+ prerelease: false
138
+ version_requirements: !ruby/object:Gem::Requirement
139
+ none: false
140
+ requirements:
141
+ - - ! '>='
142
+ - !ruby/object:Gem::Version
143
+ version: '0'
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
+ - dbalatero@gmail.com
148
+ - marnen@marnen.org
149
+ executables: []
150
+ extensions:
151
+ - ext/typhoeus/extconf.rb
152
+ extra_rdoc_files: []
153
+ files:
154
+ - ext/typhoeus/.gitignore
155
+ - ext/typhoeus/extconf.rb
156
+ - ext/typhoeus/native.c
157
+ - ext/typhoeus/native.h
158
+ - ext/typhoeus/typhoeus_easy.c
159
+ - ext/typhoeus/typhoeus_easy.h
160
+ - ext/typhoeus/typhoeus_form.c
161
+ - ext/typhoeus/typhoeus_form.h
162
+ - ext/typhoeus/typhoeus_multi.c
163
+ - ext/typhoeus/typhoeus_multi.h
164
+ - lib/typhoeus.rb
165
+ - lib/typhoeus/.gitignore
166
+ - lib/typhoeus/easy.rb
167
+ - lib/typhoeus/filter.rb
168
+ - lib/typhoeus/form.rb
169
+ - lib/typhoeus/hydra.rb
170
+ - lib/typhoeus/hydra/callbacks.rb
171
+ - lib/typhoeus/hydra/connect_options.rb
172
+ - lib/typhoeus/hydra/stubbing.rb
173
+ - lib/typhoeus/hydra_mock.rb
174
+ - lib/typhoeus/multi.rb
175
+ - lib/typhoeus/normalized_header_hash.rb
176
+ - lib/typhoeus/remote.rb
177
+ - lib/typhoeus/remote_method.rb
178
+ - lib/typhoeus/remote_proxy_object.rb
179
+ - lib/typhoeus/request.rb
180
+ - lib/typhoeus/response.rb
181
+ - lib/typhoeus/service.rb
182
+ - lib/typhoeus/utils.rb
183
+ - lib/typhoeus/version.rb
184
+ - spec/fixtures/placeholder.gif
185
+ - spec/fixtures/placeholder.txt
186
+ - spec/fixtures/placeholder.ukn
187
+ - spec/fixtures/result_set.xml
188
+ - spec/servers/app.rb
189
+ - spec/spec_helper.rb
190
+ - spec/support/typhoeus_localhost_server.rb
191
+ - spec/typhoeus/easy_spec.rb
192
+ - spec/typhoeus/filter_spec.rb
193
+ - spec/typhoeus/form_spec.rb
194
+ - spec/typhoeus/hydra_mock_spec.rb
195
+ - spec/typhoeus/hydra_spec.rb
196
+ - spec/typhoeus/multi_spec.rb
197
+ - spec/typhoeus/normalized_header_hash_spec.rb
198
+ - spec/typhoeus/remote_method_spec.rb
199
+ - spec/typhoeus/remote_proxy_object_spec.rb
200
+ - spec/typhoeus/remote_spec.rb
201
+ - spec/typhoeus/request_spec.rb
202
+ - spec/typhoeus/response_spec.rb
203
+ - spec/typhoeus/utils_spec.rb
204
+ - CHANGELOG.markdown
205
+ - Gemfile
206
+ - Gemfile.lock
207
+ - LICENSE
208
+ - Rakefile
209
+ - typhoeus.gemspec
210
+ homepage: https://github.com/marnen/typhoeus
211
+ licenses: []
212
+ post_install_message:
213
+ rdoc_options: []
214
+ require_paths:
215
+ - lib
216
+ required_ruby_version: !ruby/object:Gem::Requirement
217
+ none: false
218
+ requirements:
219
+ - - ! '>='
220
+ - !ruby/object:Gem::Version
221
+ version: '0'
222
+ required_rubygems_version: !ruby/object:Gem::Requirement
223
+ none: false
224
+ requirements:
225
+ - - ! '>='
226
+ - !ruby/object:Gem::Version
227
+ version: '0'
228
+ requirements: []
229
+ rubyforge_project: ! '[none]'
230
+ rubygems_version: 1.8.24
231
+ signing_key:
232
+ specification_version: 3
233
+ summary: Parallel HTTP library on top of libcurl multi (Marnen's fork; original gem
234
+ available at https://github.com/dbalatero/typhoeus).
235
+ test_files: []