gravis-typhoeus 0.1.32 → 0.1.33
Sign up to get free protection for your applications and to get access to all the features.
- data/README.textile +11 -0
- data/lib/typhoeus/easy.rb +6 -2
- data/lib/typhoeus/hydra.rb +7 -0
- data/lib/typhoeus/request.rb +34 -1
- data/typhoeus.gemspec +2 -2
- metadata +4 -4
data/README.textile
CHANGED
@@ -216,6 +216,17 @@ e.ssl_key = "akey.key"
|
|
216
216
|
e.perform
|
217
217
|
</pre>
|
218
218
|
|
219
|
+
or directly to a Typhoeus::Request :
|
220
|
+
|
221
|
+
<pre>
|
222
|
+
e = Typhoeus::Request.get("https://example.com/action",
|
223
|
+
:ssl_cacert => "ca_file.cer",
|
224
|
+
:ssl_cert => "acert.crt",
|
225
|
+
:ssl_key => "akey.key",
|
226
|
+
[...]
|
227
|
+
end
|
228
|
+
</pre>
|
229
|
+
|
219
230
|
h2. NTLM authentication
|
220
231
|
|
221
232
|
Thanks for the authentication piece and this description go to Oleg Ivanov (morhekil). The major reason to start this fork was the need to perform NTLM authentication in Ruby. Now you can do it via Typhoeus::Easy interface using the following API.
|
data/lib/typhoeus/easy.rb
CHANGED
@@ -242,8 +242,12 @@ module Typhoeus
|
|
242
242
|
def perform
|
243
243
|
set_headers()
|
244
244
|
easy_perform()
|
245
|
-
resp_code = response_code()
|
246
|
-
|
245
|
+
resp_code = response_code()
|
246
|
+
if resp_code >= 200 && resp_code <= 299
|
247
|
+
success
|
248
|
+
else
|
249
|
+
failure
|
250
|
+
end
|
247
251
|
resp_code
|
248
252
|
end
|
249
253
|
|
data/lib/typhoeus/hydra.rb
CHANGED
@@ -142,6 +142,13 @@ module Typhoeus
|
|
142
142
|
easy.max_redirects = request.max_redirects if request.max_redirects
|
143
143
|
easy.proxy = request.proxy if request.proxy
|
144
144
|
easy.disable_ssl_peer_verification if request.disable_ssl_peer_verification
|
145
|
+
easy.ssl_cert = request.ssl_cert
|
146
|
+
easy.ssl_cert_type = request.ssl_cert_type
|
147
|
+
easy.ssl_key = request.ssl_key
|
148
|
+
easy.ssl_key_type = request.ssl_key_type
|
149
|
+
easy.ssl_key_password = request.ssl_key_password
|
150
|
+
easy.ssl_cacert = request.ssl_cacert
|
151
|
+
easy.ssl_capath = request.ssl_capath
|
145
152
|
|
146
153
|
easy.on_success do |easy|
|
147
154
|
queue_next
|
data/lib/typhoeus/request.rb
CHANGED
@@ -1,8 +1,34 @@
|
|
1
1
|
module Typhoeus
|
2
2
|
class Request
|
3
|
-
attr_accessor :method, :params, :body, :headers, :timeout, :user_agent, :response, :cache_timeout, :follow_location, :max_redirects, :proxy, :disable_ssl_peer_verification
|
3
|
+
attr_accessor :method, :params, :body, :headers, :timeout, :user_agent, :response, :cache_timeout, :follow_location, :max_redirects, :proxy, :disable_ssl_peer_verification, :ssl_cert, :ssl_cert_type, :ssl_key, :ssl_key_type, :ssl_key_password, :ssl_cacert, :ssl_capath
|
4
|
+
|
5
|
+
|
4
6
|
attr_reader :url
|
5
7
|
|
8
|
+
# Initialize a new Request
|
9
|
+
#
|
10
|
+
# Options:
|
11
|
+
# * +url+ : Endpoint (URL) of the request
|
12
|
+
# * +options+ : A hash containing options among :
|
13
|
+
# ** +:method+ : :get (default) / :post / :put
|
14
|
+
# ** +:params+ : params as a Hash
|
15
|
+
# ** +:body+
|
16
|
+
# ** +:timeout+ : timeout (ms)
|
17
|
+
# ** +:headers+ : headers as Hash
|
18
|
+
# ** +:user_agent+ : user agent (string)
|
19
|
+
# ** +:cache_timeout+ : cache timeout (ms)
|
20
|
+
# ** +:follow_location
|
21
|
+
# ** +:max_redirects
|
22
|
+
# ** +:proxy
|
23
|
+
# ** +:disable_ssl_peer_verification
|
24
|
+
# ** +:ssl_cert
|
25
|
+
# ** +:ssl_cert_type
|
26
|
+
# ** +:ssl_key
|
27
|
+
# ** +:ssl_key_type
|
28
|
+
# ** +:ssl_key_password
|
29
|
+
# ** +:ssl_cacert
|
30
|
+
# ** +:ssl_capath
|
31
|
+
#
|
6
32
|
def initialize(url, options = {})
|
7
33
|
@method = options[:method] || :get
|
8
34
|
@params = options[:params]
|
@@ -15,6 +41,13 @@ module Typhoeus
|
|
15
41
|
@max_redirects = options[:max_redirects]
|
16
42
|
@proxy = options[:proxy]
|
17
43
|
@disable_ssl_peer_verification = options[:disable_ssl_peer_verification]
|
44
|
+
@ssl_cert = options[:ssl_cert]
|
45
|
+
@ssl_cert_type = options[:ssl_cert_type]
|
46
|
+
@ssl_key = options[:ssl_key]
|
47
|
+
@ssl_key_type = options[:ssl_key_type]
|
48
|
+
@ssl_key_password = options[:ssl_key_password]
|
49
|
+
@ssl_cacert = options[:ssl_cacert]
|
50
|
+
@ssl_capath = options[:ssl_capath]
|
18
51
|
|
19
52
|
if @method == :post
|
20
53
|
@url = url
|
data/typhoeus.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{gravis-typhoeus}
|
8
|
-
s.version = "0.1.
|
8
|
+
s.version = "0.1.33"
|
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"]
|
12
|
-
s.date = %q{2010-
|
12
|
+
s.date = %q{2010-06-04}
|
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{paul@pauldix.net}
|
15
15
|
s.extensions = ["ext/typhoeus/extconf.rb"]
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gravis-typhoeus
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 89
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 1
|
9
|
-
-
|
10
|
-
version: 0.1.
|
9
|
+
- 33
|
10
|
+
version: 0.1.33
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Paul Dix
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2010-
|
18
|
+
date: 2010-06-04 00:00:00 +02:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|