polipus 0.3.5 → 0.3.6
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.
- checksums.yaml +8 -8
- data/lib/polipus/http.rb +12 -5
- data/lib/polipus/version.rb +1 -1
- data/spec/http_spec.rb +0 -6
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
NzFhNjEwZmMzMDMwNWRlZDMzODU1NDljMDBmNmUyZWQ5MDI1YmZlNQ==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
NGY4Njg0NzJkNWVkMDJlYWIxZWEyNzhmYTM3MDlmZGJkYmFlMGQ0MA==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
ZjJiMmU4YmI2NDRhMGMzNzJmNzlhZWRjNjg5YjQ0OGVkYWM5YTZhODk4NzEx
|
10
|
+
Y2JhNDEzMDMxMDE5ZDBkMDZlNjhlNGQ1NTI0OWE5YjlhNjAyZTM0NDc1N2Fk
|
11
|
+
MGIyNDIzOGRkMTZlODE1MmQwNzg4MTU4MzQ0ZDc1NjhiNzNhYzk=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
ZTQxOWFiNjI4YzI5MjhjMjQ0ODA3ODY0ZWNlZjZhZDE3YWE1OGJhMjdiN2Jm
|
14
|
+
NGY2YWJjNzE2OWFlZjAyYjM4Y2E2MzVlNTBlYzc5MjMwM2QyZTllNjg4OGVi
|
15
|
+
NzY5ZmRlZTliMTk1MWE4YmQ4MWNjYTA0OGFlZjhjZmRjZGU2M2I=
|
data/lib/polipus/http.rb
CHANGED
@@ -87,7 +87,6 @@ module Polipus
|
|
87
87
|
# The proxy address string
|
88
88
|
#
|
89
89
|
def proxy_host
|
90
|
-
return proxy_host_port.first unless @opts[:proxy_host_port].nil?
|
91
90
|
@opts[:proxy_host].respond_to?(:call) ? @opts[:proxy_host].call(self) : @opts[:proxy_host]
|
92
91
|
end
|
93
92
|
|
@@ -95,7 +94,6 @@ module Polipus
|
|
95
94
|
# The proxy port
|
96
95
|
#
|
97
96
|
def proxy_port
|
98
|
-
return proxy_host_port[1] unless @opts[:proxy_host_port].nil?
|
99
97
|
@opts[:proxy_port].respond_to?(:call) ? @opts[:proxy_port].call(self) : @opts[:proxy_port]
|
100
98
|
end
|
101
99
|
|
@@ -103,7 +101,6 @@ module Polipus
|
|
103
101
|
# The proxy username
|
104
102
|
#
|
105
103
|
def proxy_user
|
106
|
-
return proxy_host_port[2] unless @opts[:proxy_host_port].nil?
|
107
104
|
@opts[:proxy_user].respond_to?(:call) ? @opts[:proxy_user].call(self) : @opts[:proxy_user]
|
108
105
|
end
|
109
106
|
|
@@ -111,7 +108,7 @@ module Polipus
|
|
111
108
|
# The proxy password
|
112
109
|
#
|
113
110
|
def proxy_pass
|
114
|
-
return proxy_host_port[3] unless @opts[:proxy_host_port].nil?
|
111
|
+
#return proxy_host_port[3] unless @opts[:proxy_host_port].nil?
|
115
112
|
@opts[:proxy_pass].respond_to?(:call) ? @opts[:proxy_pass].call(self) : @opts[:proxy_pass]
|
116
113
|
end
|
117
114
|
|
@@ -234,7 +231,17 @@ module Polipus
|
|
234
231
|
@opts[:logger].debug { "Request #{url} using proxy: #{proxy_host}:#{proxy_port}" }
|
235
232
|
end
|
236
233
|
|
237
|
-
|
234
|
+
# Block has higher priority
|
235
|
+
unless @opts[:proxy_host_port].nil?
|
236
|
+
p_host, p_port, p_user, p_pass = proxy_host_port
|
237
|
+
else
|
238
|
+
p_host = proxy_host
|
239
|
+
p_port = proxy_port
|
240
|
+
p_user = proxy_user
|
241
|
+
p_pass = proxy_pass
|
242
|
+
end
|
243
|
+
|
244
|
+
http = Net::HTTP.new(url.host, url.port, p_host, p_port, p_user, p_pass)
|
238
245
|
|
239
246
|
http.read_timeout = read_timeout if read_timeout
|
240
247
|
http.open_timeout = open_timeout if open_timeout
|
data/lib/polipus/version.rb
CHANGED
data/spec/http_spec.rb
CHANGED
@@ -41,17 +41,11 @@ describe Polipus::HTTP do
|
|
41
41
|
it 'should set proxy correctly using shorthand method' do
|
42
42
|
http = Polipus::HTTP.new(proxy_host_port: -> _con { ['127.0.0.0', 8080] })
|
43
43
|
http.proxy_host_port.should eq ['127.0.0.0', 8080]
|
44
|
-
http.proxy_port.should be 8080
|
45
|
-
http.proxy_host.should eq '127.0.0.0'
|
46
44
|
end
|
47
45
|
|
48
46
|
it 'should set proxy w/ auth correctly using shorthand method' do
|
49
47
|
http = Polipus::HTTP.new(proxy_host_port: -> _con { ['127.0.0.0', 8080, 'a', 'b'] })
|
50
48
|
http.proxy_host_port.should eq ['127.0.0.0', 8080, 'a', 'b']
|
51
|
-
http.proxy_port.should be 8080
|
52
|
-
http.proxy_host.should eq '127.0.0.0'
|
53
|
-
http.proxy_user.should eq 'a'
|
54
|
-
http.proxy_pass.should eq 'b'
|
55
49
|
end
|
56
50
|
|
57
51
|
it 'should set proxy settings' do
|