Script 'mail_helper' called by obssrc
Hello community,

here is the log from the commit of package rubygem-down for openSUSE:Factory 
checked in at 2022-03-07 17:48:13
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/rubygem-down (Old)
 and      /work/SRC/openSUSE:Factory/.rubygem-down.new.1958 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "rubygem-down"

Mon Mar  7 17:48:13 2022 rev:2 rq:959947 version:5.3.0

Changes:
--------
--- /work/SRC/openSUSE:Factory/rubygem-down/rubygem-down.changes        
2021-08-25 21:00:10.793005883 +0200
+++ /work/SRC/openSUSE:Factory/.rubygem-down.new.1958/rubygem-down.changes      
2022-03-07 17:49:02.475083453 +0100
@@ -1,0 +2,17 @@
+Thu Mar  3 08:20:44 UTC 2022 - Stephan Kulow <co...@suse.com>
+
+updated to version 5.3.0
+ see installed CHANGELOG.md
+
+  ## 5.3.0 (2022-02-20)
+  
+  * Add `:extension` argument to `Down.download` for overriding tempfile 
extension (@razum2um)
+  
+  * Normalize response header names for http.rb and wget backends (@zarqman)
+  
+  ## 5.2.4 (2021-09-12)
+  
+  * Keep original cookies between redirections (@antprt)
+  
+
+-------------------------------------------------------------------

Old:
----
  down-5.2.3.gem

New:
----
  down-5.3.0.gem

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ rubygem-down.spec ++++++
--- /var/tmp/diff_new_pack.dZL0d9/_old  2022-03-07 17:49:03.051083286 +0100
+++ /var/tmp/diff_new_pack.dZL0d9/_new  2022-03-07 17:49:03.055083286 +0100
@@ -1,7 +1,7 @@
 #
 # spec file for package rubygem-down
 #
-# Copyright (c) 2021 SUSE LLC
+# Copyright (c) 2022 SUSE LLC
 #
 # All modifications and additions to the file contributed by third parties
 # remain the property of their copyright owners, unless otherwise agreed
@@ -16,26 +16,28 @@
 #
 
 
-%define mod_name down
-%define mod_full_name %{mod_name}-%{version}
 #
 # This file was generated with a gem2rpm.yml and not just plain gem2rpm.
 # All sections marked as MANUAL, license headers, summaries and descriptions
 # can be maintained in that file. Please consult this file before editing any
 # of those fields
 #
+
 Name:           rubygem-down
-Version:        5.2.3
+Version:        5.3.0
 Release:        0
-Summary:        Robust streaming downloads using Net::HTTP, HTTP.rb or wget
-License:        MIT
-Group:          Development/Languages/Ruby
-URL:            https://github.com/janko/down
-Source:         https://rubygems.org/gems/%{mod_full_name}.gem
-Source1:        gem2rpm.yml
+%define mod_name down
+%define mod_full_name %{mod_name}-%{version}
+BuildRoot:      %{_tmppath}/%{name}-%{version}-build
 BuildRequires:  %{ruby >= 2.3}
 BuildRequires:  %{rubygem gem2rpm}
 BuildRequires:  ruby-macros >= 5
+URL:            https://github.com/janko/down
+Source:         https://rubygems.org/gems/%{mod_full_name}.gem
+Source1:        gem2rpm.yml
+Summary:        Robust streaming downloads using Net::HTTP, HTTP.rb or wget
+License:        MIT
+Group:          Development/Languages/Ruby
 
 %description
 Robust streaming downloads using Net::HTTP, HTTP.rb or wget.

++++++ down-5.2.3.gem -> down-5.3.0.gem ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/CHANGELOG.md new/CHANGELOG.md
--- old/CHANGELOG.md    2021-08-03 19:23:28.000000000 +0200
+++ new/CHANGELOG.md    2022-02-20 09:36:52.000000000 +0100
@@ -1,3 +1,13 @@
+## 5.3.0 (2022-02-20)
+
+* Add `:extension` argument to `Down.download` for overriding tempfile 
extension (@razum2um)
+
+* Normalize response header names for http.rb and wget backends (@zarqman)
+
+## 5.2.4 (2021-09-12)
+
+* Keep original cookies between redirections (@antprt)
+
 ## 5.2.3 (2021-08-03)
 
 * Bump addressable version requirement to 2.8+ to remediate vulnerability 
(@aldodelgado)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/README.md new/README.md
--- old/README.md       2021-08-03 19:23:28.000000000 +0200
+++ new/README.md       2022-02-20 09:36:52.000000000 +0100
@@ -63,6 +63,13 @@
 In this case `Down.download` won't have any return value, so if you need a File
 object you'll have to create it manually.
 
+You can also keep the tempfile, but override the extension:
+
+```rb
+tempfile = Down.download("http://example.com/some/file";, extension: "txt")
+File.extname(tempfile.path) #=> ".txt"
+```
+
 ### Basic authentication
 
 `Down.download` and `Down.open` will automatically detect and apply HTTP basic
@@ -157,7 +164,7 @@
 ```rb
 remote_file = Down.open("http://example.com/image.jpg";)
 remote_file.data[:status]   #=> 200
-remote_file.data[:headers]  #=> { ... }
+remote_file.data[:headers]  #=> { "Content-Type" => "image/jpeg", ... } 
(header names are normalized)
 remote_file.data[:response] # returns the response object
 ```
 
Binary files old/checksums.yaml.gz and new/checksums.yaml.gz differ
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/down.gemspec new/down.gemspec
--- old/down.gemspec    2021-08-03 19:23:28.000000000 +0200
+++ new/down.gemspec    2022-02-20 09:36:52.000000000 +0100
@@ -27,7 +27,7 @@
     spec.add_development_dependency "http", "~> 4.3"
   end
   spec.add_development_dependency "posix-spawn" unless RUBY_ENGINE == "jruby"
-  spec.add_development_dependency "http_parser.rb"
+  spec.add_development_dependency "http_parser.rb" unless RUBY_ENGINE == 
"jruby"
   spec.add_development_dependency "docker-api"
   spec.add_development_dependency "warning" if RUBY_VERSION >= "2.4"
 end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lib/down/backend.rb new/lib/down/backend.rb
--- old/lib/down/backend.rb     2021-08-03 19:23:28.000000000 +0200
+++ new/lib/down/backend.rb     2022-02-20 09:36:52.000000000 +0100
@@ -29,5 +29,12 @@
 
       nil
     end
+
+    def normalize_headers(response_headers)
+      response_headers.inject({}) do |headers, (downcased_name, value)|
+        name = downcased_name.split("-").map(&:capitalize).join("-")
+        headers.merge!(name => value)
+      end
+    end
   end
 end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lib/down/http.rb new/lib/down/http.rb
--- old/lib/down/http.rb        2021-08-03 19:23:28.000000000 +0200
+++ new/lib/down/http.rb        2022-02-20 09:36:52.000000000 +0100
@@ -25,7 +25,7 @@
 
     # Downlods the remote file to disk. Accepts HTTP.rb options via a hash or a
     # block, and some additional options as well.
-    def download(url, max_size: nil, progress_proc: nil, content_length_proc: 
nil, destination: nil, **options, &block)
+    def download(url, max_size: nil, progress_proc: nil, content_length_proc: 
nil, destination: nil, extension: nil, **options, &block)
       response = request(url, **options, &block)
 
       content_length_proc.call(response.content_length) if content_length_proc 
&& response.content_length
@@ -34,7 +34,7 @@
         raise Down::TooLarge, "file is too large 
(#{response.content_length/1024/1024}MB, max is #{max_size/1024/1024}MB)"
       end
 
-      extname  = File.extname(response.uri.path)
+      extname  = extension ? ".#{extension}" : File.extname(response.uri.path)
       tempfile = Tempfile.new(["down-http", extname], binmode: true)
 
       stream_body(response) do |chunk|
@@ -71,7 +71,11 @@
         size:       response.content_length,
         encoding:   response.content_type.charset,
         rewindable: rewindable,
-        data:       { status: response.code, headers: response.headers.to_h, 
response: response },
+        data:       {
+          status:   response.code,
+          headers:  normalize_headers(response.headers.to_h),
+          response: response
+        },
       )
     end
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lib/down/net_http.rb new/lib/down/net_http.rb
--- old/lib/down/net_http.rb    2021-08-03 19:23:28.000000000 +0200
+++ new/lib/down/net_http.rb    2022-02-20 09:36:52.000000000 +0100
@@ -40,6 +40,7 @@
       destination         = options.delete(:destination)
       headers             = options.delete(:headers)
       uri_normalizer      = options.delete(:uri_normalizer)
+      extension           = options.delete(:extension)
 
       # Use open-uri's :content_lenth_proc or :progress_proc to raise an
       # exception early if the file is too large.
@@ -93,7 +94,8 @@
       open_uri_file = open_uri(uri, open_uri_options, follows_remaining: 
max_redirects)
 
       # Handle the fact that open-uri returns StringIOs for small files.
-      tempfile = ensure_tempfile(open_uri_file, 
File.extname(open_uri_file.base_uri.path))
+      extname = extension ? ".#{extension}" : 
File.extname(open_uri_file.base_uri.path)
+      tempfile = ensure_tempfile(open_uri_file, extname)
       OpenURI::Meta.init tempfile, open_uri_file # add back open-uri methods
       tempfile.extend Down::NetHttp::DownloadedFile
 
@@ -130,10 +132,7 @@
         on_close:   -> { request.resume }, # close HTTP connnection
         data: {
           status:   response.code.to_i,
-          headers:  response.each_header.inject({}) { |headers, 
(downcased_name, value)|
-                      name = 
downcased_name.split("-").map(&:capitalize).join("-")
-                      headers.merge!(name => value)
-                    },
+          headers:  normalize_headers(response.each_header),
           response: response,
         },
       )
@@ -158,7 +157,11 @@
 
       # forward cookies on the redirect
       if !exception.io.meta["set-cookie"].to_s.empty?
-        options["Cookie"] = exception.io.meta["set-cookie"]
+        options["Cookie"] ||= ''
+        # Add new cookies avoiding duplication
+        new_cookies = 
exception.io.meta["set-cookie"].to_s.split(',').map(&:strip)
+        old_cookies = options["Cookie"].split(',')
+        options["Cookie"] = (old_cookies | new_cookies).join(',')
       end
 
       follows_remaining -= 1
@@ -202,13 +205,13 @@
 
       begin
         response = http.start do
-          http.request(request) do |response|
-            unless response.is_a?(Net::HTTPRedirection)
-              yield response
+          http.request(request) do |resp|
+            unless resp.is_a?(Net::HTTPRedirection)
+              yield resp
               # In certain cases the caller wants to download only one portion
               # of the file and close the connection, so we tell Net::HTTP that
               # it shouldn't continue retrieving it.
-              response.instance_variable_set("@read", true)
+              resp.instance_variable_set("@read", true)
             end
           end
         end
@@ -310,8 +313,8 @@
     def rebuild_response_from_open_uri_exception(exception)
       code, message = exception.io.status
 
-      response_class = Net::HTTPResponse::CODE_TO_OBJ.fetch(code) do |code|
-        Net::HTTPResponse::CODE_CLASS_TO_OBJ.fetch(code[0]) do
+      response_class = Net::HTTPResponse::CODE_TO_OBJ.fetch(code) do |c|
+        Net::HTTPResponse::CODE_CLASS_TO_OBJ.fetch(c[0]) do
           Net::HTTPUnknownResponse
         end
       end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lib/down/version.rb new/lib/down/version.rb
--- old/lib/down/version.rb     2021-08-03 19:23:28.000000000 +0200
+++ new/lib/down/version.rb     2022-02-20 09:36:52.000000000 +0100
@@ -1,5 +1,5 @@
 # frozen-string-literal: true
 
 module Down
-  VERSION = "5.2.3"
+  VERSION = "5.3.0"
 end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lib/down/wget.rb new/lib/down/wget.rb
--- old/lib/down/wget.rb        2021-08-03 19:23:28.000000000 +0200
+++ new/lib/down/wget.rb        2022-02-20 09:36:52.000000000 +0100
@@ -29,7 +29,7 @@
 
     # Downlods the remote file to disk. Accepts wget command-line options and
     # some additional options as well.
-    def download(url, *args, max_size: nil, content_length_proc: nil, 
progress_proc: nil, destination: nil, **options)
+    def download(url, *args, max_size: nil, content_length_proc: nil, 
progress_proc: nil, destination: nil, extension: nil, **options)
       io = open(url, *args, **options, rewindable: false)
 
       content_length_proc.call(io.size) if content_length_proc && io.size
@@ -38,7 +38,7 @@
         raise Down::TooLarge, "file is too large (#{io.size/1024/1024}MB, max 
is #{max_size/1024/1024}MB)"
       end
 
-      extname  = File.extname(URI(url).path)
+      extname  = extension ? ".#{extension}" : File.extname(URI(url).path)
       tempfile = Tempfile.new(["down-wget", extname], binmode: true)
 
       until io.eof?
@@ -94,7 +94,7 @@
         raise Down::Error, "failed to parse response headers"
       end
 
-      headers = parser.headers
+      headers = normalize_headers(parser.headers)
       status  = parser.status_code
 
       content_length = headers["Content-Length"].to_i if 
headers["Content-Length"]
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/metadata new/metadata
--- old/metadata        2021-08-03 19:23:28.000000000 +0200
+++ new/metadata        2022-02-20 09:36:52.000000000 +0100
@@ -1,14 +1,14 @@
 --- !ruby/object:Gem::Specification
 name: down
 version: !ruby/object:Gem::Version
-  version: 5.2.3
+  version: 5.3.0
 platform: ruby
 authors:
 - Janko Marohni??
 autorequire:
 bindir: bin
 cert_chain: []
-date: 2021-08-03 00:00:00.000000000 Z
+date: 2022-02-20 00:00:00.000000000 Z
 dependencies:
 - !ruby/object:Gem::Dependency
   name: addressable
@@ -175,7 +175,7 @@
     - !ruby/object:Gem::Version
       version: '0'
 requirements: []
-rubygems_version: 3.2.15
+rubygems_version: 3.3.3
 signing_key:
 specification_version: 4
 summary: Robust streaming downloads using Net::HTTP, HTTP.rb or wget.

Reply via email to