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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0e7b49c1d00aeebc4f368c816a422aa2525461786d7530ee4e02c7cfaf2fe475
4
- data.tar.gz: '009d5288c3aa7dbacd6cecf223352ecf05be0ab164b9e1f5e9d6f3d489c1c695'
3
+ metadata.gz: c9fc55f0895c397eb0ebe2096c09962ac64beb208565e0602088bbe77250e6cd
4
+ data.tar.gz: e988a2af579a4f728fc1f24f7d32aab4e617b777516c8f2cb7c204606a62b444
5
5
  SHA512:
6
- metadata.gz: 21f7f6691c45cf9a78fca48004839fdc510c6041ebbf42d15bf6f6f1334ed8a62ce8177c2888f06db7f53b8c43b605deb0a99db57545f6b7b1b391befaa2d48b
7
- data.tar.gz: ac1cd77390f8a28ffcbdadb2c5ccede6a43af015986a6582360214c14050f3d4b118df3e5bc777a9a3abffb6050cea64b789757cf757f25215304c7e8fd54102
6
+ metadata.gz: 4a64b2b56f04640bf9255ae20bec88cc4f65f6a862d040197383972240679fdcf1a0434101cc91d0482f2ad4b3dc0356a3c41d1315ff5673aa4fc73fb168380e
7
+ data.tar.gz: e967d81189426102f33c10a1d7105f1c4df436efedf83f3288890ccc8b75cb85506589ab2a6c895f500467fa1103c7ac678c701e76c3d8722239fc999eb0f850
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ ## 5.2.4 (2021-09-12)
2
+
3
+ * Keep original cookies between redirections (@antprt)
4
+
1
5
  ## 5.2.3 (2021-08-03)
2
6
 
3
7
  * Bump addressable version requirement to 2.8+ to remediate vulnerability (@aldodelgado)
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"] = exception.io.meta["set-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 |response|
206
- unless response.is_a?(Net::HTTPRedirection)
207
- yield response
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
- response.instance_variable_set("@read", true)
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 |code|
314
- Net::HTTPResponse::CODE_CLASS_TO_OBJ.fetch(code[0]) do
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
@@ -1,5 +1,5 @@
1
1
  # frozen-string-literal: true
2
2
 
3
3
  module Down
4
- VERSION = "5.2.3"
4
+ VERSION = "5.2.4"
5
5
  end
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.3
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-08-03 00:00:00.000000000 Z
11
+ date: 2021-09-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: addressable