typhoeus 0.1.15 → 0.1.16
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/typhoeus.rb +1 -1
- data/lib/typhoeus/easy.rb +6 -1
- data/lib/typhoeus/hydra.rb +2 -0
- data/lib/typhoeus/request.rb +3 -1
- metadata +1 -1
data/lib/typhoeus.rb
CHANGED
data/lib/typhoeus/easy.rb
CHANGED
@@ -20,7 +20,8 @@ module Typhoeus
|
|
20
20
|
:CURLOPT_MAXREDIRS => 68,
|
21
21
|
:CURLOPT_HTTPAUTH => 107,
|
22
22
|
:CURLOPT_USERPWD => 10000 + 5,
|
23
|
-
:CURLOPT_VERBOSE => 41
|
23
|
+
:CURLOPT_VERBOSE => 41,
|
24
|
+
:CURLOPT_PROXY => 10004
|
24
25
|
}
|
25
26
|
INFO_VALUES = {
|
26
27
|
:CURLINFO_RESPONSE_CODE => 2097154,
|
@@ -45,6 +46,10 @@ module Typhoeus
|
|
45
46
|
@headers = hash
|
46
47
|
end
|
47
48
|
|
49
|
+
def proxy=(proxy)
|
50
|
+
set_option(OPTION_VALUES[:CURLOPT_PROXY], proxy)
|
51
|
+
end
|
52
|
+
|
48
53
|
def auth=(authinfo)
|
49
54
|
set_option(OPTION_VALUES[:CURLOPT_USERPWD], "#{authinfo[:username]}:#{authinfo[:password]}")
|
50
55
|
set_option(OPTION_VALUES[:CURLOPT_HTTPAUTH], authinfo[:method]) if authinfo[:method]
|
data/lib/typhoeus/hydra.rb
CHANGED
@@ -124,6 +124,8 @@ module Typhoeus
|
|
124
124
|
easy.timeout = request.timeout if request.timeout
|
125
125
|
easy.follow_location = request.follow_location if request.follow_location
|
126
126
|
easy.max_redirects = request.max_redirects if request.max_redirects
|
127
|
+
easy.proxy = request.proxy if request.proxy
|
128
|
+
|
127
129
|
easy.on_success do |easy|
|
128
130
|
queue_next
|
129
131
|
handle_request(request, response_from_easy(easy, request))
|
data/lib/typhoeus/request.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
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
|
3
|
+
attr_accessor :method, :params, :body, :headers, :timeout, :user_agent, :response, :cache_timeout, :follow_location, :max_redirects, :proxy
|
4
4
|
attr_reader :url
|
5
5
|
|
6
6
|
def initialize(url, options = {})
|
@@ -13,6 +13,8 @@ module Typhoeus
|
|
13
13
|
@cache_timeout = options[:cache_timeout]
|
14
14
|
@follow_location = options[:follow_location]
|
15
15
|
@max_redirects = options[:max_redirects]
|
16
|
+
@proxy = options[:proxy]
|
17
|
+
|
16
18
|
if @method == :post
|
17
19
|
@url = url
|
18
20
|
else
|