excon 0.65.0 → 0.66.0
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of excon might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/lib/excon/connection.rb +1 -1
- data/lib/excon/constants.rb +2 -0
- data/lib/excon/error.rb +1 -0
- data/lib/excon/middlewares/mock.rb +2 -1
- data/lib/excon/middlewares/redirect_follower.rb +24 -2
- data/lib/excon/socket.rb +1 -0
- data/lib/excon/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 353be74596fc596f8436dac3da4ebaba40f006e4ad4973429cf25c6c54c41923
|
4
|
+
data.tar.gz: 156b667f3a4474033b115aa09818b3fba2288160aa7774c82459bb4708158264
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 26a8d197845c79aa756b6b29adfa65e7b4f340eeb27b7beccc69605134d67f254b44198cb88f583f193ff0362a9601420689109f535a875f2cb32f30b2299fd2
|
7
|
+
data.tar.gz: 4d9672acc8e2e3fe657ebaebd00478583a39438d02d20535a315e6d02fc3b902923d8c26b7e8f113205b123071d01c414d71be5e35402573f4b994b5d3f4dab6
|
data/lib/excon/connection.rb
CHANGED
@@ -440,7 +440,7 @@ module Excon
|
|
440
440
|
datum[:stack].response_call(datum)
|
441
441
|
rescue => error
|
442
442
|
case error
|
443
|
-
when Excon::Errors::HTTPStatusError, Excon::Errors::Timeout
|
443
|
+
when Excon::Errors::HTTPStatusError, Excon::Errors::Timeout, Excon::Errors::TooManyRedirects
|
444
444
|
raise(error)
|
445
445
|
else
|
446
446
|
raise_socket_error(error)
|
data/lib/excon/constants.rb
CHANGED
data/lib/excon/error.rb
CHANGED
@@ -26,11 +26,12 @@ module Excon
|
|
26
26
|
end
|
27
27
|
|
28
28
|
if stub = Excon.stub_for(datum)
|
29
|
+
datum[:remote_ip] ||= '127.0.0.1'
|
29
30
|
datum[:response] = {
|
30
31
|
:body => '',
|
31
32
|
:headers => {},
|
32
33
|
:status => 200,
|
33
|
-
:remote_ip =>
|
34
|
+
:remote_ip => datum[:remote_ip]
|
34
35
|
}
|
35
36
|
|
36
37
|
stub_datum = case stub.last
|
@@ -2,6 +2,18 @@
|
|
2
2
|
module Excon
|
3
3
|
module Middleware
|
4
4
|
class RedirectFollower < Excon::Middleware::Base
|
5
|
+
def self.valid_parameter_keys
|
6
|
+
[
|
7
|
+
:redirects_remaining,
|
8
|
+
:redirect_limit
|
9
|
+
]
|
10
|
+
end
|
11
|
+
|
12
|
+
def request_call(datum)
|
13
|
+
datum[:redirects_remaining] ||= datum[:redirect_limit] ||
|
14
|
+
Excon::DEFAULT_REDIRECT_LIMIT
|
15
|
+
@stack.request_call(datum)
|
16
|
+
end
|
5
17
|
|
6
18
|
def get_header(datum, header)
|
7
19
|
_, header_value = datum[:response][:headers].detect do |key, value|
|
@@ -14,14 +26,21 @@ module Excon
|
|
14
26
|
if datum.has_key?(:response)
|
15
27
|
case datum[:response][:status]
|
16
28
|
when 301, 302, 303, 307, 308
|
29
|
+
if datum[:redirects_remaining] <= 0
|
30
|
+
raise Excon::Errors::TooManyRedirects
|
31
|
+
end
|
32
|
+
|
33
|
+
datum[:redirects_remaining] -= 1
|
34
|
+
|
17
35
|
uri_parser = datum[:uri_parser] || Excon.defaults[:uri_parser]
|
18
36
|
|
19
37
|
location = get_header(datum, 'Location')
|
20
38
|
base_uri = Excon::Utils.request_uri(datum)
|
21
39
|
uri = uri_parser.join(base_uri, location)
|
22
40
|
|
23
|
-
# delete old/redirect response
|
41
|
+
# delete old/redirect response and remote_ip
|
24
42
|
response = datum.delete(:response)
|
43
|
+
datum.delete(:remote_ip)
|
25
44
|
|
26
45
|
params = datum.dup
|
27
46
|
params.delete(:connection)
|
@@ -52,7 +71,10 @@ module Excon
|
|
52
71
|
params.merge!(:password => Utils.unescape_uri(uri.password)) if uri.password
|
53
72
|
|
54
73
|
response = Excon::Connection.new(params).request
|
55
|
-
datum.merge!({
|
74
|
+
datum.merge!({
|
75
|
+
:remote_ip => response.remote_ip,
|
76
|
+
:response => response.data
|
77
|
+
})
|
56
78
|
else
|
57
79
|
@stack.response_call(datum)
|
58
80
|
end
|
data/lib/excon/socket.rb
CHANGED
data/lib/excon/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: excon
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.66.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- dpiddy (Dan Peterson)
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2019-
|
13
|
+
date: 2019-08-06 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: rspec
|