Script 'mail_helper' called by obssrc
Hello community,

here is the log from the commit of package rubygem-http for openSUSE:Factory 
checked in at 2022-08-09 15:26:33
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/rubygem-http (Old)
 and      /work/SRC/openSUSE:Factory/.rubygem-http.new.1521 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "rubygem-http"

Tue Aug  9 15:26:33 2022 rev:3 rq:993486 version:5.1.0

Changes:
--------
--- /work/SRC/openSUSE:Factory/rubygem-http/rubygem-http.changes        
2021-10-25 15:18:46.185725765 +0200
+++ /work/SRC/openSUSE:Factory/.rubygem-http.new.1521/rubygem-http.changes      
2022-08-09 15:26:44.733349719 +0200
@@ -1,0 +2,23 @@
+Thu Aug  4 13:14:35 UTC 2022 - Stephan Kulow <[email protected]>
+
+updated to version 5.1.0
+ see installed CHANGES.md
+
+  ## 5.1.0 (2022-06-17)
+  
+  * Drop ruby-2.5 support.
+  
+  * [#715](https://github.com/httprb/http/pull/715)
+    Set default encoding to UTF-8 for `application/json`.
+    ([@drwl])
+  
+  * [#712](https://github.com/httprb/http/pull/712)
+    Recognize cookies set by redirect.
+    ([@tkellogg])
+  
+  * [#707](https://github.com/httprb/http/pull/707)
+    Distinguish connection timeouts.
+    ([@YuLeven])
+  
+
+-------------------------------------------------------------------

Old:
----
  http-5.0.4.gem

New:
----
  http-5.1.0.gem

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

Other differences:
------------------
++++++ rubygem-http.spec ++++++
--- /var/tmp/diff_new_pack.F3Gsls/_old  2022-08-09 15:26:45.185351011 +0200
+++ /var/tmp/diff_new_pack.F3Gsls/_new  2022-08-09 15:26:45.189351022 +0200
@@ -1,7 +1,7 @@
 #
 # spec file for package rubygem-http
 #
-# 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 http
-%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-http
-Version:        5.0.4
+Version:        5.1.0
 Release:        0
-Summary:        HTTP should be easy
-License:        MIT
-Group:          Development/Languages/Ruby
+%define mod_name http
+%define mod_full_name %{mod_name}-%{version}
+BuildRoot:      %{_tmppath}/%{name}-%{version}-build
+BuildRequires:  %{ruby >= 2.6}
+BuildRequires:  %{rubygem gem2rpm}
+BuildRequires:  ruby-macros >= 5
 URL:            https://github.com/httprb/http
 Source:         https://rubygems.org/gems/%{mod_full_name}.gem
 Source1:        gem2rpm.yml
-BuildRequires:  %{ruby >= 2.5}
-BuildRequires:  %{rubygem gem2rpm}
-BuildRequires:  ruby-macros >= 5
+Summary:        HTTP should be easy
+License:        MIT
+Group:          Development/Languages/Ruby
 
 %description
 An easy-to-use client library for making requests from Ruby. It uses a simple
@@ -54,7 +56,6 @@
 find %{buildroot}/%{_libdir}/ruby/gems/ \( -name '.rubocop*' -o -name 
'.github' -o -name '.yardopts' -o -name '.rspec' -o -name '.gitignore' \) | 
xargs rm -rf
 # /MANUAL
 
-
 %gem_packages
 
 %changelog

++++++ http-5.0.4.gem -> http-5.1.0.gem ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/.github/workflows/ci.yml new/.github/workflows/ci.yml
--- old/.github/workflows/ci.yml        2021-10-07 20:24:26.000000000 +0200
+++ new/.github/workflows/ci.yml        2022-06-17 04:52:36.000000000 +0200
@@ -16,11 +16,11 @@
 
     strategy:
       matrix:
-        ruby: [ ruby-2.5, ruby-2.6, ruby-2.7, ruby-3.0 ]
+        ruby: [ ruby-2.6, ruby-2.7, ruby-3.0, ruby-3.1 ]
         os: [ ubuntu-latest ]
 
     steps:
-      - uses: actions/checkout@v2
+      - uses: actions/checkout@v3
 
       - uses: ruby/setup-ruby@v1
         with:
@@ -52,11 +52,11 @@
     runs-on: ubuntu-latest
 
     steps:
-      - uses: actions/checkout@v2
+      - uses: actions/checkout@v3
 
       - uses: ruby/setup-ruby@v1
         with:
-          ruby-version: 2.5
+          ruby-version: 2.6
           bundler-cache: true
 
       - name: bundle exec rubocop
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/.rubocop.yml new/.rubocop.yml
--- old/.rubocop.yml    2021-10-07 20:24:26.000000000 +0200
+++ new/.rubocop.yml    2022-06-17 04:52:36.000000000 +0200
@@ -7,4 +7,4 @@
   DefaultFormatter: fuubar
   DisplayCopNames: true
   NewCops: enable
-  TargetRubyVersion: 2.5
+  TargetRubyVersion: 2.6
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/.rubocop_todo.yml new/.rubocop_todo.yml
--- old/.rubocop_todo.yml       2021-10-07 20:24:26.000000000 +0200
+++ new/.rubocop_todo.yml       2022-06-17 04:52:36.000000000 +0200
@@ -1,13 +1,21 @@
 # This configuration was generated by
-# `rubocop --auto-gen-config --auto-gen-only-exclude --exclude-limit 42`
-# on 2021-04-10 09:49:03 UTC using RuboCop version 1.12.1.
+# `rubocop --auto-gen-config --auto-gen-only-exclude --exclude-limit 100`
+# on 2022-06-16 14:35:44 UTC using RuboCop version 1.30.1.
 # The point is for the user to remove these configuration records
 # one by one as the offenses are removed from the code base.
 # Note that changes in the inspected code, or installation of new
 # versions of RuboCop, may require this file to be generated again.
 
+# Offense count: 1
+# This cop supports safe autocorrection (--autocorrect).
+# Configuration parameters: Include.
+# Include: **/*.gemspec
+Gemspec/DeprecatedAttributeAssignment:
+  Exclude:
+    - 'http.gemspec'
+
 # Offense count: 53
-# Cop supports --auto-correct.
+# This cop supports safe autocorrection (--autocorrect).
 # Configuration parameters: EnforcedStyle.
 # SupportedStyles: leading, trailing
 Layout/DotPosition:
@@ -22,8 +30,8 @@
     - 'spec/lib/http_spec.rb'
     - 'spec/support/http_handling_shared.rb'
 
-# Offense count: 174
-# Cop supports --auto-correct.
+# Offense count: 176
+# This cop supports safe autocorrection (--autocorrect).
 # Configuration parameters: EnforcedStyle, EnforcedStyleForEmptyBraces.
 # SupportedStyles: space, no_space, compact
 # SupportedStylesForEmptyBraces: space, no_space
@@ -66,7 +74,7 @@
     - 'lib/http/request.rb'
     - 'lib/http/response.rb'
 
-# Offense count: 66
+# Offense count: 69
 # Configuration parameters: CountComments, Max, CountAsOne, ExcludedMethods, 
IgnoredMethods.
 # IgnoredMethods: refine
 Metrics/BlockLength:
@@ -109,7 +117,7 @@
     - 'lib/http/chainable.rb'
     - 'lib/http/client.rb'
 
-# Offense count: 19
+# Offense count: 18
 # Configuration parameters: CountComments, Max, CountAsOne, ExcludedMethods, 
IgnoredMethods.
 Metrics/MethodLength:
   Exclude:
@@ -132,8 +140,13 @@
   Exclude:
     - 'lib/http/chainable.rb'
 
+# Offense count: 1
+Security/CompoundHash:
+  Exclude:
+    - 'lib/http/uri.rb'
+
 # Offense count: 2
-# Cop supports --auto-correct.
+# This cop supports safe autocorrection (--autocorrect).
 # Configuration parameters: EnforcedStyle.
 # SupportedStyles: separated, grouped
 Style/AccessorGrouping:
@@ -141,7 +154,7 @@
     - 'lib/http/request.rb'
 
 # Offense count: 4
-# Cop supports --auto-correct.
+# This cop supports safe autocorrection (--autocorrect).
 Style/EmptyCaseCondition:
   Exclude:
     - 'lib/http/client.rb'
@@ -150,7 +163,7 @@
     - 'lib/http/response/status.rb'
 
 # Offense count: 5
-# Cop supports --auto-correct.
+# This cop supports safe autocorrection (--autocorrect).
 Style/Encoding:
   Exclude:
     - 'spec/lib/http/client_spec.rb'
@@ -160,7 +173,7 @@
     - 'spec/support/dummy_server/servlet.rb'
 
 # Offense count: 17
-# Configuration parameters: SuspiciousParamNames.
+# Configuration parameters: SuspiciousParamNames, Allowlist.
 # SuspiciousParamNames: options, opts, args, params, parameters
 Style/OptionHash:
   Exclude:
@@ -183,8 +196,8 @@
     - 'lib/http/uri.rb'
 
 # Offense count: 3
-# Cop supports --auto-correct.
-# Configuration parameters: AutoCorrect, Max, AllowHeredoc, AllowURI, 
URISchemes, IgnoreCopDirectives, IgnoredPatterns.
+# This cop supports safe autocorrection (--autocorrect).
+# Configuration parameters: Max, AllowHeredoc, AllowURI, URISchemes, 
IgnoreCopDirectives, AllowedPatterns, IgnoredPatterns.
 # URISchemes: http, https
 Layout/LineLength:
   Exclude:
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/CHANGES.md new/CHANGES.md
--- old/CHANGES.md      2021-10-07 20:24:26.000000000 +0200
+++ new/CHANGES.md      2022-06-17 04:52:36.000000000 +0200
@@ -1,3 +1,19 @@
+## 5.1.0 (2022-06-17)
+
+* Drop ruby-2.5 support.
+
+* [#715](https://github.com/httprb/http/pull/715)
+  Set default encoding to UTF-8 for `application/json`.
+  ([@drwl])
+
+* [#712](https://github.com/httprb/http/pull/712)
+  Recognize cookies set by redirect.
+  ([@tkellogg])
+
+* [#707](https://github.com/httprb/http/pull/707)
+  Distinguish connection timeouts.
+  ([@YuLeven])
+
 ## 5.0.4 (2021-10-07)
 
 * [#698](https://github.com/httprb/http/pull/698)
@@ -42,7 +58,7 @@
 
 * [#638](https://github.com/httprb/http/pull/638)
   DNS failover handling.
-  ([@midnight-wonderer])  
+  ([@midnight-wonderer])
 
 
 ## 5.0.1 (2021-06-26)
@@ -112,6 +128,7 @@
 
 * [#576](https://github.com/httprb/http/pull/576)
   [#524](https://github.com/httprb/http/issues/524)
+  **BREAKING CHANGE**
   Preserve header names casing.
   ([@joshuaflanagan])
 
@@ -968,3 +985,6 @@
 [@matheussilvasantos]: https://github.com/matheussilvasantos
 [@PhilCoggins]: https://github.com/PhilCoggins
 [@flosacca]: https://github.com/flosacca
+[@YuLeven]: https://github.com/YuLeven
+[@drwl]: https://github.com/drwl
+[@tkellogg]: https://github.com/tkellogg
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/Gemfile new/Gemfile
--- old/Gemfile 2021-10-07 20:24:26.000000000 +0200
+++ new/Gemfile 2022-06-17 04:52:36.000000000 +0200
@@ -27,7 +27,7 @@
 
   gem "backports"
 
-  gem "rubocop", "~> 1.21"
+  gem "rubocop", "~> 1.30.0"
   gem "rubocop-performance"
   gem "rubocop-rake"
   gem "rubocop-rspec"
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/LICENSE.txt new/LICENSE.txt
--- old/LICENSE.txt     2021-10-07 20:24:26.000000000 +0200
+++ new/LICENSE.txt     2022-06-17 04:52:36.000000000 +0200
@@ -1,4 +1,4 @@
-Copyright (c) 2011-2021 Tony Arcieri, Erik Michaels-Ober, Alexey V. Zapparov, 
Zachary Anker
+Copyright (c) 2011-2022 Tony Arcieri, Erik Michaels-Ober, Alexey V. Zapparov, 
Zachary Anker
 
 Permission is hereby granted, free of charge, to any person obtaining
 a copy of this software and associated documentation files (the
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/README.md new/README.md
--- old/README.md       2021-10-07 20:24:26.000000000 +0200
+++ new/README.md       2022-06-17 04:52:36.000000000 +0200
@@ -141,7 +141,7 @@
 
 ## Copyright
 
-Copyright ?? 2011-2021 Tony Arcieri, Alexey V. Zapparov, Erik Michaels-Ober, 
Zachary Anker.
+Copyright ?? 2011-2022 Tony Arcieri, Alexey V. Zapparov, Erik Michaels-Ober, 
Zachary Anker.
 See LICENSE.txt for further details.
 
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/SECURITY.md new/SECURITY.md
--- old/SECURITY.md     1970-01-01 01:00:00.000000000 +0100
+++ new/SECURITY.md     2022-06-17 04:52:36.000000000 +0200
@@ -0,0 +1,5 @@
+# Security Policy
+
+## Reporting a Vulnerability
+
+Please report security issues to `[email protected]`
\ No newline at end of file
Binary files old/checksums.yaml.gz and new/checksums.yaml.gz differ
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/http.gemspec new/http.gemspec
--- old/http.gemspec    2021-10-07 20:24:26.000000000 +0200
+++ new/http.gemspec    2022-06-17 04:52:36.000000000 +0200
@@ -25,7 +25,7 @@
   gem.require_paths = ["lib"]
   gem.version       = HTTP::VERSION
 
-  gem.required_ruby_version = ">= 2.5"
+  gem.required_ruby_version = ">= 2.6"
 
   gem.add_runtime_dependency "addressable",    "~> 2.8"
   gem.add_runtime_dependency "http-cookie",    "~> 1.0"
@@ -35,9 +35,10 @@
   gem.add_development_dependency "bundler", "~> 2.0"
 
   gem.metadata = {
-    "source_code_uri" => "https://github.com/httprb/http";,
-    "wiki_uri"        => "https://github.com/httprb/http/wiki";,
-    "bug_tracker_uri" => "https://github.com/httprb/http/issues";,
-    "changelog_uri"   => 
"https://github.com/httprb/http/blob/v#{HTTP::VERSION}/CHANGES.md";
+    "source_code_uri"       => "https://github.com/httprb/http";,
+    "wiki_uri"              => "https://github.com/httprb/http/wiki";,
+    "bug_tracker_uri"       => "https://github.com/httprb/http/issues";,
+    "changelog_uri"         => 
"https://github.com/httprb/http/blob/v#{HTTP::VERSION}/CHANGES.md";,
+    "rubygems_mfa_required" => "true"
   }
 end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lib/http/errors.rb new/lib/http/errors.rb
--- old/lib/http/errors.rb      2021-10-07 20:24:26.000000000 +0200
+++ new/lib/http/errors.rb      2022-06-17 04:52:36.000000000 +0200
@@ -19,6 +19,9 @@
   # Generic Timeout error
   class TimeoutError < Error; end
 
+  # Timeout when first establishing the conncetion
+  class ConnectTimeoutError < TimeoutError; end
+
   # Header value is of unexpected format (similar to 
Net::HTTPHeaderSyntaxError)
   class HeaderError < Error; end
 end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lib/http/headers.rb new/lib/http/headers.rb
--- old/lib/http/headers.rb     2021-10-07 20:24:26.000000000 +0200
+++ new/lib/http/headers.rb     2022-06-17 04:52:36.000000000 +0200
@@ -111,7 +111,7 @@
     #
     # @return [Hash]
     def to_h
-      keys.map { |k| [k, self[k]] }.to_h
+      keys.to_h { |k| [k, self[k]] }
     end
     alias to_hash to_h
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lib/http/redirector.rb new/lib/http/redirector.rb
--- old/lib/http/redirector.rb  2021-10-07 20:24:26.000000000 +0200
+++ new/lib/http/redirector.rb  2022-06-17 04:52:36.000000000 +0200
@@ -49,6 +49,8 @@
       @request  = request
       @response = response
       @visited  = []
+      collect_cookies_from_request
+      collect_cookies_from_response
 
       while REDIRECT_CODES.include? @response.status.code
         @visited << "#{@request.verb} #{@request.uri}"
@@ -59,8 +61,12 @@
         @response.flush
 
         # XXX(ixti): using `Array#inject` to return `nil` if no Location 
header.
-        @request  = 
redirect_to(@response.headers.get(Headers::LOCATION).inject(:+))
+        @request = 
redirect_to(@response.headers.get(Headers::LOCATION).inject(:+))
+        unless cookie_jar.empty?
+          @request.headers.set(Headers::COOKIE, cookie_jar.cookies.map { |c| 
"#{c.name}=#{c.value}" }.join("; "))
+        end
         @response = yield @request
+        collect_cookies_from_response
       end
 
       @response
@@ -68,6 +74,48 @@
 
     private
 
+    # All known cookies. On the original request, this is only the original 
cookies, but after that,
+    # Set-Cookie headers can add, set or delete cookies.
+    def cookie_jar
+      # it seems that @response.cookies instance is reused between responses, 
so we have to "clone"
+      @cookie_jar ||= HTTP::CookieJar.new
+    end
+
+    def collect_cookies_from_request
+      request_cookie_header = @request.headers["Cookie"]
+      cookies =
+        if request_cookie_header
+          HTTP::Cookie.cookie_value_to_hash(request_cookie_header)
+        else
+          {}
+        end
+
+      cookies.each do |key, value|
+        cookie_jar.add(HTTP::Cookie.new(key, value, :path => 
@request.uri.path, :domain => @request.host))
+      end
+    end
+
+    # Carry cookies from one response to the next. Carrying cookies to the 
next response ends up
+    # carrying them to the next request as well.
+    #
+    # Note that this isn't part of the IETF standard, but all major browsers 
support setting cookies
+    # on redirect: https://blog.dubbelboer.com/2012/11/25/302-cookie.html
+    def collect_cookies_from_response
+      # Overwrite previous cookies
+      @response.cookies.each do |cookie|
+        if cookie.value == ""
+          cookie_jar.delete(cookie)
+        else
+          cookie_jar.add(cookie)
+        end
+      end
+
+      # I wish we could just do @response.cookes = cookie_jar
+      cookie_jar.each do |cookie|
+        @response.cookies.add(cookie)
+      end
+    end
+
     # Check if we reached max amount of redirect hops
     # @return [Boolean]
     def too_many_hops?
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lib/http/response/status.rb 
new/lib/http/response/status.rb
--- old/lib/http/response/status.rb     2021-10-07 20:24:26.000000000 +0200
+++ new/lib/http/response/status.rb     2022-06-17 04:52:36.000000000 +0200
@@ -69,7 +69,7 @@
       #   SYMBOL_CODES[:im_a_teapot]           # => 418
       #
       # @return [Hash<Symbol => Fixnum>]
-      SYMBOL_CODES = SYMBOLS.map { |k, v| [v, k] }.to_h.freeze
+      SYMBOL_CODES = SYMBOLS.to_h { |k, v| [v, k] }.freeze
 
       # @return [Fixnum] status code
       attr_reader :code
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lib/http/response.rb new/lib/http/response.rb
--- old/lib/http/response.rb    2021-10-07 20:24:26.000000000 +0200
+++ new/lib/http/response.rb    2022-06-17 04:52:36.000000000 +0200
@@ -53,7 +53,7 @@
         @body = opts.fetch(:body)
       else
         connection = opts.fetch(:connection)
-        encoding   = opts[:encoding] || charset || Encoding::BINARY
+        encoding = opts[:encoding] || charset || default_encoding
 
         @body = Response::Body.new(connection, :encoding => encoding)
       end
@@ -168,6 +168,12 @@
 
     private
 
+    def default_encoding
+      return Encoding::UTF_8 if mime_type == "application/json"
+
+      Encoding::BINARY
+    end
+
     # Initialize an HTTP::Request from options.
     #
     # @return [HTTP::Request]
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lib/http/timeout/global.rb 
new/lib/http/timeout/global.rb
--- old/lib/http/timeout/global.rb      2021-10-07 20:24:26.000000000 +0200
+++ new/lib/http/timeout/global.rb      2022-06-17 04:52:36.000000000 +0200
@@ -21,7 +21,7 @@
 
       def connect(socket_class, host, port, nodelay = false)
         reset_timer
-        ::Timeout.timeout(@time_left, TimeoutError) do
+        ::Timeout.timeout(@time_left, ConnectTimeoutError) do
           @socket = socket_class.open(host, port)
           @socket.setsockopt(Socket::IPPROTO_TCP, Socket::TCP_NODELAY, 1) if 
nodelay
         end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lib/http/timeout/per_operation.rb 
new/lib/http/timeout/per_operation.rb
--- old/lib/http/timeout/per_operation.rb       2021-10-07 20:24:26.000000000 
+0200
+++ new/lib/http/timeout/per_operation.rb       2022-06-17 04:52:36.000000000 
+0200
@@ -20,7 +20,7 @@
       end
 
       def connect(socket_class, host, port, nodelay = false)
-        ::Timeout.timeout(@connect_timeout, TimeoutError) do
+        ::Timeout.timeout(@connect_timeout, ConnectTimeoutError) do
           @socket = socket_class.open(host, port)
           @socket.setsockopt(Socket::IPPROTO_TCP, Socket::TCP_NODELAY, 1) if 
nodelay
         end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lib/http/version.rb new/lib/http/version.rb
--- old/lib/http/version.rb     2021-10-07 20:24:26.000000000 +0200
+++ new/lib/http/version.rb     2022-06-17 04:52:36.000000000 +0200
@@ -1,5 +1,5 @@
 # frozen_string_literal: true
 
 module HTTP
-  VERSION = "5.0.4"
+  VERSION = "5.1.0"
 end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/metadata new/metadata
--- old/metadata        2021-10-07 20:24:26.000000000 +0200
+++ new/metadata        2022-06-17 04:52:36.000000000 +0200
@@ -1,7 +1,7 @@
 --- !ruby/object:Gem::Specification
 name: http
 version: !ruby/object:Gem::Version
-  version: 5.0.4
+  version: 5.1.0
 platform: ruby
 authors:
 - Tony Arcieri
@@ -11,7 +11,7 @@
 autorequire:
 bindir: bin
 cert_chain: []
-date: 2021-10-07 00:00:00.000000000 Z
+date: 2022-06-17 00:00:00.000000000 Z
 dependencies:
 - !ruby/object:Gem::Dependency
   name: addressable
@@ -106,6 +106,7 @@
 - LICENSE.txt
 - README.md
 - Rakefile
+- SECURITY.md
 - http.gemspec
 - lib/http.rb
 - lib/http/chainable.rb
@@ -191,7 +192,8 @@
   source_code_uri: https://github.com/httprb/http
   wiki_uri: https://github.com/httprb/http/wiki
   bug_tracker_uri: https://github.com/httprb/http/issues
-  changelog_uri: https://github.com/httprb/http/blob/v5.0.4/CHANGES.md
+  changelog_uri: https://github.com/httprb/http/blob/v5.1.0/CHANGES.md
+  rubygems_mfa_required: 'true'
 post_install_message:
 rdoc_options: []
 require_paths:
@@ -200,14 +202,14 @@
   requirements:
   - - ">="
     - !ruby/object:Gem::Version
-      version: '2.5'
+      version: '2.6'
 required_rubygems_version: !ruby/object:Gem::Requirement
   requirements:
   - - ">="
     - !ruby/object:Gem::Version
       version: '0'
 requirements: []
-rubygems_version: 3.0.3
+rubygems_version: 3.1.6
 signing_key:
 specification_version: 4
 summary: HTTP should be easy
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/spec/lib/http/client_spec.rb 
new/spec/lib/http/client_spec.rb
--- old/spec/lib/http/client_spec.rb    2021-10-07 20:24:26.000000000 +0200
+++ new/spec/lib/http/client_spec.rb    2022-06-17 04:52:36.000000000 +0200
@@ -389,8 +389,8 @@
           client.use(:test_feature => feature_instance).
             timeout(0.001).
             request(:post, sleep_url)
-        end.to raise_error(HTTP::TimeoutError)
-        expect(feature_instance.captured_error).to be_a(HTTP::TimeoutError)
+        end.to raise_error(HTTP::ConnectTimeoutError)
+        expect(feature_instance.captured_error).to 
be_a(HTTP::ConnectTimeoutError)
       end
     end
   end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/spec/lib/http/redirector_spec.rb 
new/spec/lib/http/redirector_spec.rb
--- old/spec/lib/http/redirector_spec.rb        2021-10-07 20:24:26.000000000 
+0200
+++ new/spec/lib/http/redirector_spec.rb        2022-06-17 04:52:36.000000000 
+0200
@@ -11,8 +11,12 @@
     )
   end
 
-  def redirect_response(status, location)
-    simple_response status, "", "Location" => location
+  def redirect_response(status, location, set_cookie = {})
+    res = simple_response status, "", "Location" => location
+    set_cookie.each do |name, value|
+      res.headers.add("Set-Cookie", "#{name}=#{value}; path=/; httponly; 
secure; SameSite=none; Secure")
+    end
+    res
   end
 
   describe "#strict" do
@@ -89,6 +93,61 @@
       expect(res.to_s).to eq "http://example.com/123";
     end
 
+    it "returns cookies in response" do
+      req  = HTTP::Request.new :verb => :head, :uri => "http://example.com";
+      hops = [
+        redirect_response(301, "http://example.com/1";, {"foo" => "42"}),
+        redirect_response(301, "http://example.com/2";, {"bar" => "53", 
"deleted" => "foo"}),
+        redirect_response(301, "http://example.com/3";, {"baz" => "64", 
"deleted" => ""}),
+        redirect_response(301, "http://example.com/4";, {"baz" => "65"}),
+        simple_response(200, "bar")
+      ]
+
+      request_cookies = [
+        {"foo" => "42"},
+        {"foo" => "42", "bar" => "53", "deleted" => "foo"},
+        {"foo" => "42", "bar" => "53", "baz" => "64"},
+        {"foo" => "42", "bar" => "53", "baz" => "65"}
+      ]
+
+      res = redirector.perform(req, hops.shift) do |request|
+        req_cookie = 
HTTP::Cookie.cookie_value_to_hash(request.headers["Cookie"] || "")
+        expect(req_cookie).to eq request_cookies.shift
+        hops.shift
+      end
+      expect(res.to_s).to eq "bar"
+      cookies = res.cookies.cookies.to_h { |c| [c.name, c.value] }
+      expect(cookies["foo"]).to eq "42"
+      expect(cookies["bar"]).to eq "53"
+      expect(cookies["baz"]).to eq "65"
+      expect(cookies["deleted"]).to eq nil
+    end
+
+    it "returns original cookies in response" do
+      req = HTTP::Request.new :verb => :head, :uri => "http://example.com";
+      req.headers.set("Cookie", "foo=42; deleted=baz")
+      hops = [
+        redirect_response(301, "http://example.com/1";, {"bar" => "64", 
"deleted" => ""}),
+        simple_response(200, "bar")
+      ]
+
+      request_cookies = [
+        {"foo" => "42", "bar" => "64"},
+        {"foo" => "42", "bar" => "64"}
+      ]
+
+      res = redirector.perform(req, hops.shift) do |request|
+        req_cookie = 
HTTP::Cookie.cookie_value_to_hash(request.headers["Cookie"] || "")
+        expect(req_cookie).to eq request_cookies.shift
+        hops.shift
+      end
+      expect(res.to_s).to eq "bar"
+      cookies = res.cookies.cookies.to_h { |c| [c.name, c.value] }
+      expect(cookies["foo"]).to eq "42"
+      expect(cookies["bar"]).to eq "64"
+      expect(cookies["deleted"]).to eq nil
+    end
+
     context "following 300 redirect" do
       context "with strict mode" do
         let(:options) { {:strict => true} }
@@ -400,7 +459,7 @@
     describe "changing verbs during redirects" do
       let(:options) { {:strict => false} }
       let(:post_body) { HTTP::Request::Body.new("i might be way longer in real 
life") }
-      let(:cookie) { "dont eat my cookies" }
+      let(:cookie) { "dont=eat my cookies" }
 
       def a_dangerous_request(verb)
         HTTP::Request.new(
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/spec/lib/http/response/body_spec.rb 
new/spec/lib/http/response/body_spec.rb
--- old/spec/lib/http/response/body_spec.rb     2021-10-07 20:24:26.000000000 
+0200
+++ new/spec/lib/http/response/body_spec.rb     2022-06-17 04:52:36.000000000 
+0200
@@ -59,7 +59,7 @@
     let(:chunks) do
       body = Zlib::Deflate.deflate("Hi, HTTP here ???")
       len  = body.length
-      [body[0, len / 2], body[(len / 2)..-1]]
+      [body[0, len / 2], body[(len / 2)..]]
     end
     subject(:body) do
       inflater = HTTP::Response::Inflater.new(connection)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/spec/lib/http/response_spec.rb 
new/spec/lib/http/response_spec.rb
--- old/spec/lib/http/response_spec.rb  2021-10-07 20:24:26.000000000 +0200
+++ new/spec/lib/http/response_spec.rb  2022-06-17 04:52:36.000000000 +0200
@@ -223,4 +223,40 @@
       end
     end
   end
+
+  describe "#body" do
+    let(:connection) { double(:sequence_id => 0) }
+    let(:chunks)     { ["Hello, ", "World!"] }
+
+    subject(:response) do
+      HTTP::Response.new(
+        :status     => 200,
+        :version    => "1.1",
+        :headers    => headers,
+        :request    => request,
+        :connection => connection
+      )
+    end
+
+    before do
+      allow(connection).to receive(:readpartial) { chunks.shift }
+      allow(connection).to receive(:body_completed?) { chunks.empty? }
+    end
+
+    context "with no Content-Type" do
+      let(:headers) { {} }
+
+      it "returns a body with default binary encoding" do
+        expect(response.body.to_s.encoding).to eq Encoding::BINARY
+      end
+    end
+
+    context "with Content-Type: application/json" do
+      let(:headers) { {"Content-Type" => "application/json"} }
+
+      it "returns a body with a default UTF_8 encoding" do
+        expect(response.body.to_s.encoding).to eq Encoding::UTF_8
+      end
+    end
+  end
 end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/spec/support/http_handling_shared.rb 
new/spec/support/http_handling_shared.rb
--- old/spec/support/http_handling_shared.rb    2021-10-07 20:24:26.000000000 
+0200
+++ new/spec/support/http_handling_shared.rb    2022-06-17 04:52:36.000000000 
+0200
@@ -77,7 +77,7 @@
         sleep 1.25
       end
 
-      expect { response }.to raise_error(HTTP::TimeoutError, /execution/)
+      expect { response }.to raise_error(HTTP::ConnectTimeoutError, 
/execution/)
     end
 
     it "errors if reading takes too long" do

Reply via email to