down 5.2.3 → 5.2.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/down.gemspec +1 -1
- data/lib/down/net_http.rb +11 -7
- data/lib/down/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: c9fc55f0895c397eb0ebe2096c09962ac64beb208565e0602088bbe77250e6cd
|
4
|
+
data.tar.gz: e988a2af579a4f728fc1f24f7d32aab4e617b777516c8f2cb7c204606a62b444
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4a64b2b56f04640bf9255ae20bec88cc4f65f6a862d040197383972240679fdcf1a0434101cc91d0482f2ad4b3dc0356a3c41d1315ff5673aa4fc73fb168380e
|
7
|
+
data.tar.gz: e967d81189426102f33c10a1d7105f1c4df436efedf83f3288890ccc8b75cb85506589ab2a6c895f500467fa1103c7ac678c701e76c3d8722239fc999eb0f850
|
data/CHANGELOG.md
CHANGED
data/down.gemspec
CHANGED
@@ -27,7 +27,7 @@ Gem::Specification.new do |spec|
|
|
27
27
|
spec.add_development_dependency "http", "~> 4.3"
|
28
28
|
end
|
29
29
|
spec.add_development_dependency "posix-spawn" unless RUBY_ENGINE == "jruby"
|
30
|
-
spec.add_development_dependency "http_parser.rb"
|
30
|
+
spec.add_development_dependency "http_parser.rb" unless RUBY_ENGINE == "jruby"
|
31
31
|
spec.add_development_dependency "docker-api"
|
32
32
|
spec.add_development_dependency "warning" if RUBY_VERSION >= "2.4"
|
33
33
|
end
|
data/lib/down/net_http.rb
CHANGED
@@ -158,7 +158,11 @@ module Down
|
|
158
158
|
|
159
159
|
# forward cookies on the redirect
|
160
160
|
if !exception.io.meta["set-cookie"].to_s.empty?
|
161
|
-
options["Cookie"]
|
161
|
+
options["Cookie"] ||= ''
|
162
|
+
# Add new cookies avoiding duplication
|
163
|
+
new_cookies = exception.io.meta["set-cookie"].to_s.split(',').map(&:strip)
|
164
|
+
old_cookies = options["Cookie"].split(',')
|
165
|
+
options["Cookie"] = (old_cookies | new_cookies).join(',')
|
162
166
|
end
|
163
167
|
|
164
168
|
follows_remaining -= 1
|
@@ -202,13 +206,13 @@ module Down
|
|
202
206
|
|
203
207
|
begin
|
204
208
|
response = http.start do
|
205
|
-
http.request(request) do |
|
206
|
-
unless
|
207
|
-
yield
|
209
|
+
http.request(request) do |resp|
|
210
|
+
unless resp.is_a?(Net::HTTPRedirection)
|
211
|
+
yield resp
|
208
212
|
# In certain cases the caller wants to download only one portion
|
209
213
|
# of the file and close the connection, so we tell Net::HTTP that
|
210
214
|
# it shouldn't continue retrieving it.
|
211
|
-
|
215
|
+
resp.instance_variable_set("@read", true)
|
212
216
|
end
|
213
217
|
end
|
214
218
|
end
|
@@ -310,8 +314,8 @@ module Down
|
|
310
314
|
def rebuild_response_from_open_uri_exception(exception)
|
311
315
|
code, message = exception.io.status
|
312
316
|
|
313
|
-
response_class = Net::HTTPResponse::CODE_TO_OBJ.fetch(code) do |
|
314
|
-
Net::HTTPResponse::CODE_CLASS_TO_OBJ.fetch(
|
317
|
+
response_class = Net::HTTPResponse::CODE_TO_OBJ.fetch(code) do |c|
|
318
|
+
Net::HTTPResponse::CODE_CLASS_TO_OBJ.fetch(c[0]) do
|
315
319
|
Net::HTTPUnknownResponse
|
316
320
|
end
|
317
321
|
end
|
data/lib/down/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: down
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 5.2.
|
4
|
+
version: 5.2.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Janko Marohnić
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-09-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: addressable
|