open-uri 0.4.0 → 0.4.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.
- checksums.yaml +4 -4
- data/lib/open-uri.rb +7 -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: 78f03a56856bfc2aa1dbdd08478f6bda3ea2c29f83d7cd99ef762f5c0b52e067
|
4
|
+
data.tar.gz: cbd9c8771d3eb265509ad998d1331098f1866000e07ab8cfaa3dfaac4f31a360
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 23431550f621fade4ae9fa17ab13212dfc4a4d401d44e0b483e0315f223eb237610fb761acdc36c2eba70259aed5f11fc1fec748cdc75b8390dd2873a00f3ff0
|
7
|
+
data.tar.gz: dbb275774fe23edfaf364819ebabe871378831f3fa758a25aa9641040887cd878945b84d2a42b32d0436d0ecfcf35e2358be143028b25cce0bcbb57b5fa73176
|
data/lib/open-uri.rb
CHANGED
@@ -91,7 +91,7 @@ end
|
|
91
91
|
|
92
92
|
module OpenURI
|
93
93
|
|
94
|
-
VERSION = "0.4.
|
94
|
+
VERSION = "0.4.1"
|
95
95
|
|
96
96
|
Options = {
|
97
97
|
:proxy => true,
|
@@ -108,6 +108,7 @@ module OpenURI
|
|
108
108
|
:ftp_active_mode => false,
|
109
109
|
:redirect => true,
|
110
110
|
:encoding => nil,
|
111
|
+
:max_redirects => 64,
|
111
112
|
}
|
112
113
|
|
113
114
|
def OpenURI.check_options(options) # :nodoc:
|
@@ -211,6 +212,7 @@ module OpenURI
|
|
211
212
|
end
|
212
213
|
|
213
214
|
uri_set = {}
|
215
|
+
max_redirects = options[:max_redirects]
|
214
216
|
buf = nil
|
215
217
|
while true
|
216
218
|
redirect = catch(:open_uri_redirect) {
|
@@ -238,6 +240,7 @@ module OpenURI
|
|
238
240
|
uri = redirect
|
239
241
|
raise "HTTP redirection loop: #{uri}" if uri_set.include? uri.to_s
|
240
242
|
uri_set[uri.to_s] = true
|
243
|
+
raise TooManyRedirects.new("Too many redirects", buf.io) if max_redirects && uri_set.size > max_redirects
|
241
244
|
else
|
242
245
|
break
|
243
246
|
end
|
@@ -392,6 +395,9 @@ module OpenURI
|
|
392
395
|
attr_reader :uri
|
393
396
|
end
|
394
397
|
|
398
|
+
class TooManyRedirects < HTTPError
|
399
|
+
end
|
400
|
+
|
395
401
|
class Buffer # :nodoc: all
|
396
402
|
def initialize
|
397
403
|
@io = StringIO.new
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: open-uri
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tanaka Akira
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-12-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: uri
|