typhoeus 0.2.0 → 0.2.1
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.
- data/.gitignore +1 -0
- data/CHANGELOG.markdown +14 -1
- data/Gemfile +2 -0
- data/Gemfile.lock +2 -0
- data/LICENSE +20 -0
- data/README.textile +39 -5
- data/Rakefile +8 -5
- data/VERSION +1 -1
- data/examples/file.rb +12 -0
- data/examples/times.rb +40 -0
- data/ext/typhoeus/.gitignore +2 -1
- data/ext/typhoeus/native.c +1 -0
- data/ext/typhoeus/native.h +1 -0
- data/ext/typhoeus/typhoeus_easy.c +32 -7
- data/ext/typhoeus/typhoeus_easy.h +1 -0
- data/ext/typhoeus/typhoeus_form.c +59 -0
- data/ext/typhoeus/typhoeus_form.h +13 -0
- data/ext/typhoeus/typhoeus_multi.c +15 -29
- data/lib/typhoeus.rb +1 -0
- data/lib/typhoeus/easy.rb +70 -48
- data/lib/typhoeus/form.rb +47 -0
- data/lib/typhoeus/hydra.rb +40 -7
- data/lib/typhoeus/hydra/connect_options.rb +19 -3
- data/lib/typhoeus/multi.rb +7 -5
- data/lib/typhoeus/remote.rb +1 -1
- data/lib/typhoeus/remote_proxy_object.rb +2 -0
- data/lib/typhoeus/request.rb +15 -3
- data/lib/typhoeus/response.rb +16 -1
- data/spec/fixtures/placeholder.gif +0 -0
- data/spec/fixtures/placeholder.txt +1 -0
- data/spec/fixtures/placeholder.ukn +0 -0
- data/spec/servers/app.rb +9 -0
- data/spec/spec.opts +1 -0
- data/spec/spec_helper.rb +3 -0
- data/spec/typhoeus/easy_spec.rb +55 -6
- data/spec/typhoeus/filter_spec.rb +2 -2
- data/spec/typhoeus/form_spec.rb +106 -0
- data/spec/typhoeus/hydra_mock_spec.rb +1 -1
- data/spec/typhoeus/hydra_spec.rb +108 -38
- data/spec/typhoeus/multi_spec.rb +1 -1
- data/spec/typhoeus/normalized_header_hash_spec.rb +1 -1
- data/spec/typhoeus/remote_method_spec.rb +2 -2
- data/spec/typhoeus/remote_proxy_object_spec.rb +1 -1
- data/spec/typhoeus/remote_spec.rb +1 -1
- data/spec/typhoeus/request_spec.rb +31 -2
- data/spec/typhoeus/response_spec.rb +13 -1
- data/spec/typhoeus/utils_spec.rb +1 -1
- data/typhoeus.gemspec +23 -6
- metadata +39 -19
data/spec/typhoeus/multi_spec.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
require File.dirname(__FILE__) + '/../spec_helper'
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
|
2
2
|
|
3
3
|
describe Typhoeus::RemoteMethod do
|
4
4
|
it "should take options" do
|
@@ -138,4 +138,4 @@ describe Typhoeus::RemoteMethod do
|
|
138
138
|
Typhoeus::RemoteMethod.new(:cache_responses => 30).cache_ttl.should == 30
|
139
139
|
end
|
140
140
|
end
|
141
|
-
end
|
141
|
+
end
|
@@ -1,4 +1,4 @@
|
|
1
|
-
require File.dirname(__FILE__) + '/../spec_helper'
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
|
2
2
|
|
3
3
|
describe Typhoeus::Request do
|
4
4
|
describe "#inspect" do
|
@@ -25,7 +25,7 @@ describe Typhoeus::Request do
|
|
25
25
|
it "should dump the method" do
|
26
26
|
@request.inspect.should =~ /:get/
|
27
27
|
end
|
28
|
-
|
28
|
+
|
29
29
|
it "should dump out headers" do
|
30
30
|
@request.inspect.should =~ /"Content-Type"\s*=>\s*"text\/html"/
|
31
31
|
end
|
@@ -213,6 +213,35 @@ describe Typhoeus::Request do
|
|
213
213
|
good.should be_true
|
214
214
|
end
|
215
215
|
|
216
|
+
describe "time info" do
|
217
|
+
it "should have time" do
|
218
|
+
response = Typhoeus::Request.get("http://localhost:3000")
|
219
|
+
response.time.should > 0
|
220
|
+
end
|
221
|
+
|
222
|
+
it "should have connect time" do
|
223
|
+
response = Typhoeus::Request.get("http://localhost:3000")
|
224
|
+
response.connect_time.should > 0
|
225
|
+
end
|
226
|
+
|
227
|
+
it "should have app connect time" do
|
228
|
+
response = Typhoeus::Request.get("http://localhost:3000")
|
229
|
+
response.app_connect_time.should > 0
|
230
|
+
end
|
231
|
+
|
232
|
+
it "should have start transfer time" do
|
233
|
+
response = Typhoeus::Request.get("http://localhost:3000")
|
234
|
+
response.start_transfer_time.should > 0
|
235
|
+
end
|
236
|
+
|
237
|
+
it "should have pre-transfer time" do
|
238
|
+
response = Typhoeus::Request.get("http://localhost:3000")
|
239
|
+
response.pretransfer_time.should > 0
|
240
|
+
end
|
241
|
+
|
242
|
+
end
|
243
|
+
|
244
|
+
|
216
245
|
describe "authentication" do
|
217
246
|
|
218
247
|
it "should allow to set username and password" do
|
@@ -1,6 +1,18 @@
|
|
1
|
-
require File.dirname(__FILE__) + '/../spec_helper'
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
|
2
2
|
|
3
3
|
describe Typhoeus::Response do
|
4
|
+
describe "timed_out?" do
|
5
|
+
it "should return true if curl return code is 28" do
|
6
|
+
response = Typhoeus::Response.new(:curl_return_code => 28)
|
7
|
+
response.should be_timed_out
|
8
|
+
end
|
9
|
+
|
10
|
+
it "should return false for not 28" do
|
11
|
+
response = Typhoeus::Response.new(:curl_return_code => 14)
|
12
|
+
response.should_not be_timed_out
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
4
16
|
describe "initialize" do
|
5
17
|
it "should store headers_hash" do
|
6
18
|
response = Typhoeus::Response.new(:headers_hash => {})
|
data/spec/typhoeus/utils_spec.rb
CHANGED
data/typhoeus.gemspec
CHANGED
@@ -5,27 +5,31 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{typhoeus}
|
8
|
-
s.version = "0.2.
|
8
|
+
s.version = "0.2.1"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
|
-
s.authors = ["Paul Dix"]
|
12
|
-
s.date = %q{
|
11
|
+
s.authors = ["Paul Dix", "David Balatero"]
|
12
|
+
s.date = %q{2011-01-28}
|
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
|
-
s.email = %q{
|
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
19
|
]
|
19
20
|
s.files = [
|
20
21
|
".gitignore",
|
21
22
|
"CHANGELOG.markdown",
|
22
23
|
"Gemfile",
|
23
24
|
"Gemfile.lock",
|
25
|
+
"LICENSE",
|
24
26
|
"README.textile",
|
25
27
|
"Rakefile",
|
26
28
|
"VERSION",
|
27
29
|
"benchmarks/profile.rb",
|
28
30
|
"benchmarks/vs_nethttp.rb",
|
31
|
+
"examples/file.rb",
|
32
|
+
"examples/times.rb",
|
29
33
|
"examples/twitter.rb",
|
30
34
|
"ext/typhoeus/.gitignore",
|
31
35
|
"ext/typhoeus/extconf.rb",
|
@@ -33,12 +37,15 @@ Gem::Specification.new do |s|
|
|
33
37
|
"ext/typhoeus/native.h",
|
34
38
|
"ext/typhoeus/typhoeus_easy.c",
|
35
39
|
"ext/typhoeus/typhoeus_easy.h",
|
40
|
+
"ext/typhoeus/typhoeus_form.c",
|
41
|
+
"ext/typhoeus/typhoeus_form.h",
|
36
42
|
"ext/typhoeus/typhoeus_multi.c",
|
37
43
|
"ext/typhoeus/typhoeus_multi.h",
|
38
44
|
"lib/typhoeus.rb",
|
39
45
|
"lib/typhoeus/.gitignore",
|
40
46
|
"lib/typhoeus/easy.rb",
|
41
47
|
"lib/typhoeus/filter.rb",
|
48
|
+
"lib/typhoeus/form.rb",
|
42
49
|
"lib/typhoeus/hydra.rb",
|
43
50
|
"lib/typhoeus/hydra/callbacks.rb",
|
44
51
|
"lib/typhoeus/hydra/connect_options.rb",
|
@@ -54,12 +61,16 @@ Gem::Specification.new do |s|
|
|
54
61
|
"lib/typhoeus/service.rb",
|
55
62
|
"lib/typhoeus/utils.rb",
|
56
63
|
"profilers/valgrind.rb",
|
64
|
+
"spec/fixtures/placeholder.gif",
|
65
|
+
"spec/fixtures/placeholder.txt",
|
66
|
+
"spec/fixtures/placeholder.ukn",
|
57
67
|
"spec/fixtures/result_set.xml",
|
58
68
|
"spec/servers/app.rb",
|
59
69
|
"spec/spec.opts",
|
60
70
|
"spec/spec_helper.rb",
|
61
71
|
"spec/typhoeus/easy_spec.rb",
|
62
72
|
"spec/typhoeus/filter_spec.rb",
|
73
|
+
"spec/typhoeus/form_spec.rb",
|
63
74
|
"spec/typhoeus/hydra_mock_spec.rb",
|
64
75
|
"spec/typhoeus/hydra_spec.rb",
|
65
76
|
"spec/typhoeus/multi_spec.rb",
|
@@ -72,7 +83,7 @@ Gem::Specification.new do |s|
|
|
72
83
|
"spec/typhoeus/utils_spec.rb",
|
73
84
|
"typhoeus.gemspec"
|
74
85
|
]
|
75
|
-
s.homepage = %q{http://github.com/
|
86
|
+
s.homepage = %q{http://github.com/dbalatero/typhoeus}
|
76
87
|
s.rdoc_options = ["--charset=UTF-8"]
|
77
88
|
s.require_paths = ["lib"]
|
78
89
|
s.rubygems_version = %q{1.3.7}
|
@@ -82,6 +93,7 @@ Gem::Specification.new do |s|
|
|
82
93
|
"spec/spec_helper.rb",
|
83
94
|
"spec/typhoeus/easy_spec.rb",
|
84
95
|
"spec/typhoeus/filter_spec.rb",
|
96
|
+
"spec/typhoeus/form_spec.rb",
|
85
97
|
"spec/typhoeus/hydra_mock_spec.rb",
|
86
98
|
"spec/typhoeus/hydra_spec.rb",
|
87
99
|
"spec/typhoeus/multi_spec.rb",
|
@@ -92,6 +104,8 @@ Gem::Specification.new do |s|
|
|
92
104
|
"spec/typhoeus/request_spec.rb",
|
93
105
|
"spec/typhoeus/response_spec.rb",
|
94
106
|
"spec/typhoeus/utils_spec.rb",
|
107
|
+
"examples/file.rb",
|
108
|
+
"examples/times.rb",
|
95
109
|
"examples/twitter.rb"
|
96
110
|
]
|
97
111
|
|
@@ -100,12 +114,14 @@ Gem::Specification.new do |s|
|
|
100
114
|
s.specification_version = 3
|
101
115
|
|
102
116
|
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
117
|
+
s.add_runtime_dependency(%q<mime-types>, [">= 0"])
|
103
118
|
s.add_development_dependency(%q<rspec>, [">= 0"])
|
104
119
|
s.add_development_dependency(%q<jeweler>, [">= 0"])
|
105
120
|
s.add_development_dependency(%q<diff-lcs>, [">= 0"])
|
106
121
|
s.add_development_dependency(%q<sinatra>, [">= 0"])
|
107
122
|
s.add_development_dependency(%q<json>, [">= 0"])
|
108
123
|
else
|
124
|
+
s.add_dependency(%q<mime-types>, [">= 0"])
|
109
125
|
s.add_dependency(%q<rspec>, [">= 0"])
|
110
126
|
s.add_dependency(%q<jeweler>, [">= 0"])
|
111
127
|
s.add_dependency(%q<diff-lcs>, [">= 0"])
|
@@ -113,6 +129,7 @@ Gem::Specification.new do |s|
|
|
113
129
|
s.add_dependency(%q<json>, [">= 0"])
|
114
130
|
end
|
115
131
|
else
|
132
|
+
s.add_dependency(%q<mime-types>, [">= 0"])
|
116
133
|
s.add_dependency(%q<rspec>, [">= 0"])
|
117
134
|
s.add_dependency(%q<jeweler>, [">= 0"])
|
118
135
|
s.add_dependency(%q<diff-lcs>, [">= 0"])
|
metadata
CHANGED
@@ -1,111 +1,123 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: typhoeus
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash: 23
|
5
4
|
prerelease: false
|
6
5
|
segments:
|
7
6
|
- 0
|
8
7
|
- 2
|
9
|
-
-
|
10
|
-
version: 0.2.
|
8
|
+
- 1
|
9
|
+
version: 0.2.1
|
11
10
|
platform: ruby
|
12
11
|
authors:
|
13
12
|
- Paul Dix
|
13
|
+
- David Balatero
|
14
14
|
autorequire:
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date:
|
18
|
+
date: 2011-01-28 00:00:00 -08:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
22
|
-
name:
|
22
|
+
name: mime-types
|
23
23
|
prerelease: false
|
24
24
|
requirement: &id001 !ruby/object:Gem::Requirement
|
25
25
|
none: false
|
26
26
|
requirements:
|
27
27
|
- - ">="
|
28
28
|
- !ruby/object:Gem::Version
|
29
|
-
hash: 3
|
30
29
|
segments:
|
31
30
|
- 0
|
32
31
|
version: "0"
|
33
|
-
type: :
|
32
|
+
type: :runtime
|
34
33
|
version_requirements: *id001
|
35
34
|
- !ruby/object:Gem::Dependency
|
36
|
-
name:
|
35
|
+
name: rspec
|
37
36
|
prerelease: false
|
38
37
|
requirement: &id002 !ruby/object:Gem::Requirement
|
39
38
|
none: false
|
40
39
|
requirements:
|
41
40
|
- - ">="
|
42
41
|
- !ruby/object:Gem::Version
|
43
|
-
hash: 3
|
44
42
|
segments:
|
45
43
|
- 0
|
46
44
|
version: "0"
|
47
45
|
type: :development
|
48
46
|
version_requirements: *id002
|
49
47
|
- !ruby/object:Gem::Dependency
|
50
|
-
name:
|
48
|
+
name: jeweler
|
51
49
|
prerelease: false
|
52
50
|
requirement: &id003 !ruby/object:Gem::Requirement
|
53
51
|
none: false
|
54
52
|
requirements:
|
55
53
|
- - ">="
|
56
54
|
- !ruby/object:Gem::Version
|
57
|
-
hash: 3
|
58
55
|
segments:
|
59
56
|
- 0
|
60
57
|
version: "0"
|
61
58
|
type: :development
|
62
59
|
version_requirements: *id003
|
63
60
|
- !ruby/object:Gem::Dependency
|
64
|
-
name:
|
61
|
+
name: diff-lcs
|
65
62
|
prerelease: false
|
66
63
|
requirement: &id004 !ruby/object:Gem::Requirement
|
67
64
|
none: false
|
68
65
|
requirements:
|
69
66
|
- - ">="
|
70
67
|
- !ruby/object:Gem::Version
|
71
|
-
hash: 3
|
72
68
|
segments:
|
73
69
|
- 0
|
74
70
|
version: "0"
|
75
71
|
type: :development
|
76
72
|
version_requirements: *id004
|
77
73
|
- !ruby/object:Gem::Dependency
|
78
|
-
name:
|
74
|
+
name: sinatra
|
79
75
|
prerelease: false
|
80
76
|
requirement: &id005 !ruby/object:Gem::Requirement
|
81
77
|
none: false
|
82
78
|
requirements:
|
83
79
|
- - ">="
|
84
80
|
- !ruby/object:Gem::Version
|
85
|
-
hash: 3
|
86
81
|
segments:
|
87
82
|
- 0
|
88
83
|
version: "0"
|
89
84
|
type: :development
|
90
85
|
version_requirements: *id005
|
86
|
+
- !ruby/object:Gem::Dependency
|
87
|
+
name: json
|
88
|
+
prerelease: false
|
89
|
+
requirement: &id006 !ruby/object:Gem::Requirement
|
90
|
+
none: false
|
91
|
+
requirements:
|
92
|
+
- - ">="
|
93
|
+
- !ruby/object:Gem::Version
|
94
|
+
segments:
|
95
|
+
- 0
|
96
|
+
version: "0"
|
97
|
+
type: :development
|
98
|
+
version_requirements: *id006
|
91
99
|
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.
|
92
|
-
email:
|
100
|
+
email: dbalatero@gmail.com
|
93
101
|
executables: []
|
94
102
|
|
95
103
|
extensions:
|
96
104
|
- ext/typhoeus/extconf.rb
|
97
105
|
extra_rdoc_files:
|
106
|
+
- LICENSE
|
98
107
|
- README.textile
|
99
108
|
files:
|
100
109
|
- .gitignore
|
101
110
|
- CHANGELOG.markdown
|
102
111
|
- Gemfile
|
103
112
|
- Gemfile.lock
|
113
|
+
- LICENSE
|
104
114
|
- README.textile
|
105
115
|
- Rakefile
|
106
116
|
- VERSION
|
107
117
|
- benchmarks/profile.rb
|
108
118
|
- benchmarks/vs_nethttp.rb
|
119
|
+
- examples/file.rb
|
120
|
+
- examples/times.rb
|
109
121
|
- examples/twitter.rb
|
110
122
|
- ext/typhoeus/.gitignore
|
111
123
|
- ext/typhoeus/extconf.rb
|
@@ -113,12 +125,15 @@ files:
|
|
113
125
|
- ext/typhoeus/native.h
|
114
126
|
- ext/typhoeus/typhoeus_easy.c
|
115
127
|
- ext/typhoeus/typhoeus_easy.h
|
128
|
+
- ext/typhoeus/typhoeus_form.c
|
129
|
+
- ext/typhoeus/typhoeus_form.h
|
116
130
|
- ext/typhoeus/typhoeus_multi.c
|
117
131
|
- ext/typhoeus/typhoeus_multi.h
|
118
132
|
- lib/typhoeus.rb
|
119
133
|
- lib/typhoeus/.gitignore
|
120
134
|
- lib/typhoeus/easy.rb
|
121
135
|
- lib/typhoeus/filter.rb
|
136
|
+
- lib/typhoeus/form.rb
|
122
137
|
- lib/typhoeus/hydra.rb
|
123
138
|
- lib/typhoeus/hydra/callbacks.rb
|
124
139
|
- lib/typhoeus/hydra/connect_options.rb
|
@@ -134,12 +149,16 @@ files:
|
|
134
149
|
- lib/typhoeus/service.rb
|
135
150
|
- lib/typhoeus/utils.rb
|
136
151
|
- profilers/valgrind.rb
|
152
|
+
- spec/fixtures/placeholder.gif
|
153
|
+
- spec/fixtures/placeholder.txt
|
154
|
+
- spec/fixtures/placeholder.ukn
|
137
155
|
- spec/fixtures/result_set.xml
|
138
156
|
- spec/servers/app.rb
|
139
157
|
- spec/spec.opts
|
140
158
|
- spec/spec_helper.rb
|
141
159
|
- spec/typhoeus/easy_spec.rb
|
142
160
|
- spec/typhoeus/filter_spec.rb
|
161
|
+
- spec/typhoeus/form_spec.rb
|
143
162
|
- spec/typhoeus/hydra_mock_spec.rb
|
144
163
|
- spec/typhoeus/hydra_spec.rb
|
145
164
|
- spec/typhoeus/multi_spec.rb
|
@@ -152,7 +171,7 @@ files:
|
|
152
171
|
- spec/typhoeus/utils_spec.rb
|
153
172
|
- typhoeus.gemspec
|
154
173
|
has_rdoc: true
|
155
|
-
homepage: http://github.com/
|
174
|
+
homepage: http://github.com/dbalatero/typhoeus
|
156
175
|
licenses: []
|
157
176
|
|
158
177
|
post_install_message:
|
@@ -165,7 +184,6 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
165
184
|
requirements:
|
166
185
|
- - ">="
|
167
186
|
- !ruby/object:Gem::Version
|
168
|
-
hash: 3
|
169
187
|
segments:
|
170
188
|
- 0
|
171
189
|
version: "0"
|
@@ -174,7 +192,6 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
174
192
|
requirements:
|
175
193
|
- - ">="
|
176
194
|
- !ruby/object:Gem::Version
|
177
|
-
hash: 3
|
178
195
|
segments:
|
179
196
|
- 0
|
180
197
|
version: "0"
|
@@ -190,6 +207,7 @@ test_files:
|
|
190
207
|
- spec/spec_helper.rb
|
191
208
|
- spec/typhoeus/easy_spec.rb
|
192
209
|
- spec/typhoeus/filter_spec.rb
|
210
|
+
- spec/typhoeus/form_spec.rb
|
193
211
|
- spec/typhoeus/hydra_mock_spec.rb
|
194
212
|
- spec/typhoeus/hydra_spec.rb
|
195
213
|
- spec/typhoeus/multi_spec.rb
|
@@ -200,4 +218,6 @@ test_files:
|
|
200
218
|
- spec/typhoeus/request_spec.rb
|
201
219
|
- spec/typhoeus/response_spec.rb
|
202
220
|
- spec/typhoeus/utils_spec.rb
|
221
|
+
- examples/file.rb
|
222
|
+
- examples/times.rb
|
203
223
|
- examples/twitter.rb
|