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 2021-10-25 15:17:37
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/rubygem-http (Old)
 and      /work/SRC/openSUSE:Factory/.rubygem-http.new.1890 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "rubygem-http"

Mon Oct 25 15:17:37 2021 rev:2 rq:927266 version:5.0.4

Changes:
--------
--- /work/SRC/openSUSE:Factory/rubygem-http/rubygem-http.changes        
2021-08-26 23:15:58.208216041 +0200
+++ /work/SRC/openSUSE:Factory/.rubygem-http.new.1890/rubygem-http.changes      
2021-10-25 15:18:46.185725765 +0200
@@ -1,0 +2,51 @@
+Mon Oct 25 09:00:00 UTC 2021 - Dan ??erm??k <dcer...@suse.com>
+
+- New upstream release 5.0.4
+
+## 5.0.4 (2021-10-07)
+
+* [#698](https://github.com/httprb/http/pull/698)
+  Fix `HTTP::Timeout::Global#connect_ssl`.
+  ([@tarcieri])
+
+## 5.0.3 (2021-10-06)
+
+* [#695](https://github.com/httprb/http/pull/695)
+  Revert DNS resolving feature.
+  ([@PhilCoggins])
+
+* [#694](https://github.com/httprb/http/pull/694)
+  Fix cookies extraction.
+  ([@flosacca])
+
+## 5.0.2 (2021-09-10)
+
+* [#686](https://github.com/httprb/http/pull/686)
+  Correctly reset the parser.
+  ([@bryanp])
+
+* [#684](https://github.com/httprb/http/pull/684)
+  Don't set Content-Length for GET, HEAD, DELETE, or CONNECT requests without 
a BODY.
+  ([@jyn514])
+
+* [#679](https://github.com/httprb/http/pull/679)
+  Use features on redirected requests.
+  ([@nomis])
+
+* [#678](https://github.com/schwern)
+  Restore `HTTP::Response` `:uri` option for backwards compatibility.
+  ([@schwern])
+
+* [#676](https://github.com/httprb/http/pull/676)
+  Update addressable because of CVE-2021-32740.
+  ([@matheussilvasantos])
+
+* [#653](https://github.com/httprb/http/pull/653)
+  Avoid force encodings on frozen strings.
+  ([@bvicenzo])
+
+* [#638](https://github.com/httprb/http/pull/638)
+  DNS failover handling.
+  ([@midnight-wonderer])
+
+-------------------------------------------------------------------

Old:
----
  http-5.0.1.gem

New:
----
  http-5.0.4.gem

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

Other differences:
------------------
++++++ rubygem-http.spec ++++++
--- /var/tmp/diff_new_pack.fUf5WR/_old  2021-10-25 15:18:46.589726018 +0200
+++ /var/tmp/diff_new_pack.fUf5WR/_new  2021-10-25 15:18:46.593726020 +0200
@@ -25,7 +25,7 @@
 # of those fields
 #
 Name:           rubygem-http
-Version:        5.0.1
+Version:        5.0.4
 Release:        0
 Summary:        HTTP should be easy
 License:        MIT

++++++ http-5.0.1.gem -> http-5.0.4.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-06-26 19:59:24.000000000 +0200
+++ new/.github/workflows/ci.yml        2021-10-07 20:24:26.000000000 +0200
@@ -2,9 +2,9 @@
 
 on:
   push:
-    branches: [ master ]
+    branches: [ main ]
   pull_request:
-    branches: [ master ]
+    branches: [ main ]
 
 env:
   BUNDLE_WITHOUT: "development"
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/CHANGES.md new/CHANGES.md
--- old/CHANGES.md      2021-06-26 19:59:24.000000000 +0200
+++ new/CHANGES.md      2021-10-07 20:24:26.000000000 +0200
@@ -1,7 +1,54 @@
+## 5.0.4 (2021-10-07)
+
+* [#698](https://github.com/httprb/http/pull/698)
+  Fix `HTTP::Timeout::Global#connect_ssl`.
+  ([@tarcieri])
+
+## 5.0.3 (2021-10-06)
+
+* [#695](https://github.com/httprb/http/pull/695)
+  Revert DNS resolving feature.
+  ([@PhilCoggins])
+
+* [#694](https://github.com/httprb/http/pull/694)
+  Fix cookies extraction.
+  ([@flosacca])
+
+## 5.0.2 (2021-09-10)
+
+* [#686](https://github.com/httprb/http/pull/686)
+  Correctly reset the parser.
+  ([@bryanp])
+
+* [#684](https://github.com/httprb/http/pull/684)
+  Don't set Content-Length for GET, HEAD, DELETE, or CONNECT requests without 
a BODY.
+  ([@jyn514])
+
+* [#679](https://github.com/httprb/http/pull/679)
+  Use features on redirected requests.
+  ([@nomis])
+
+* [#678](https://github.com/schwern)
+  Restore `HTTP::Response` `:uri` option for backwards compatibility.
+  ([@schwern])
+
+* [#676](https://github.com/httprb/http/pull/676)
+  Update addressable because of CVE-2021-32740.
+  ([@matheussilvasantos])
+
+* [#653](https://github.com/httprb/http/pull/653)
+  Avoid force encodings on frozen strings.
+  ([@bvicenzo])
+
+* [#638](https://github.com/httprb/http/pull/638)
+  DNS failover handling.
+  ([@midnight-wonderer])  
+
+
 ## 5.0.1 (2021-06-26)
 
 * [#670](https://github.com/httprb/http/pull/670)
-  Revert `Response#parse` behavior introduced in #540.
+  Revert `Response#parse` behavior introduced in [#540].
   ([@DannyBen])
 
 * [#669](https://github.com/httprb/http/pull/669)
@@ -12,6 +59,7 @@
   Bump llhttp-ffi to 0.3.0.
   ([@bryanp])
 
+
 ## 5.0.0 (2021-05-12)
 
 * [#656](https://github.com/httprb/http/pull/656)
@@ -912,3 +960,11 @@
 [@meanphil]: https://github.com/meanphil
 [@odinhb]: https://github.com/odinhb
 [@DannyBen]: https://github.com/DannyBen
+[@jyn514]: https://github.com/jyn514
+[@bvicenzo]: https://github.com/bvicenzo
+[@nomis]: https://github.com/nomis
+[@midnight-wonderer]: https://github.com/midnight-wonderer
+[@schwern]: https://github.com/schwern
+[@matheussilvasantos]: https://github.com/matheussilvasantos
+[@PhilCoggins]: https://github.com/PhilCoggins
+[@flosacca]: https://github.com/flosacca
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/Gemfile new/Gemfile
--- old/Gemfile 2021-06-26 19:59:24.000000000 +0200
+++ new/Gemfile 2021-10-07 20:24:26.000000000 +0200
@@ -27,7 +27,7 @@
 
   gem "backports"
 
-  gem "rubocop"
+  gem "rubocop", "~> 1.21"
   gem "rubocop-performance"
   gem "rubocop-rake"
   gem "rubocop-rspec"
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/README.md new/README.md
--- old/README.md       2021-06-26 19:59:24.000000000 +0200
+++ new/README.md       2021-10-07 20:24:26.000000000 +0200
@@ -1,16 +1,12 @@
-# ![http.rb](https://raw.github.com/httprb/http.rb/master/logo.png)
+# ![http.rb](https://raw.github.com/httprb/http.rb/main/logo.png)
 
-[![Gem 
Version](https://img.shields.io/gem/v/http?logo=ruby)](https://rubygems.org/gems/http)
-[![Build 
Status](https://github.com/httprb/http/workflows/CI/badge.svg)](https://github.com/httprb/http/actions?query=workflow:CI)
-[![Code 
Climate](https://codeclimate.com/github/httprb/http.svg?branch=master)](https://codeclimate.com/github/httprb/http)
-[![MIT 
licensed](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/httprb/http/blob/master/LICENSE.txt)
+[![Gem Version][gem-image]][gem-link]
+[![MIT licensed][license-image]][license-link]
+[![Build Status][build-image]][build-link]
+[![Code Climate][codeclimate-image]][codeclimate-link]
 
 [Documentation]
 
-_NOTE: This is the 5.x **development** branch.  For the 4.x **stable** branch, 
please see:_
-
-https://github.com/httprb/http/tree/4-x-stable
-
 ## About
 
 HTTP (The Gem! a.k.a. http.rb) is an easy-to-use client library for making 
requests
@@ -21,63 +17,16 @@
 This library isn't just yet another wrapper around `Net::HTTP`. It implements 
the HTTP
 protocol natively and outsources the parsing to native extensions.
 
-[requests]: http://docs.python-requests.org/en/latest/
-[llhttp]: https://llhttp.org/
-
-
-## Another Ruby HTTP library? Why should I care?
+### Why http.rb?
 
-There are a lot of HTTP libraries to choose from in the Ruby ecosystem.
-So why would you choose this one?
-
-Top three reasons:
-
-1. **Clean API**: http.rb offers an easy-to-use API that should be a
+- **Clean API**: http.rb offers an easy-to-use API that should be a
    breath of fresh air after using something like Net::HTTP.
 
-2. **Maturity**: http.rb is one of the most mature Ruby HTTP clients, 
supporting
+- **Maturity**: http.rb is one of the most mature Ruby HTTP clients, supporting
    features like persistent connections and fine-grained timeouts.
 
-3. **Performance**: using native parsers and a clean, lightweight 
implementation,
-   http.rb achieves the best performance of any Ruby HTTP library which
-   implements the HTTP protocol in Ruby instead of C:
-
-  | HTTP client              | Time   | Implementation        |
-  |--------------------------|--------|-----------------------|
-  | curb (persistent)        | 2.519  | libcurl wrapper       |
-  | em-http-request          | 2.731  | EM + http_parser.rb   |
-  | Typhoeus                 | 2.851  | libcurl wrapper       |
-  | StreamlyFFI (persistent) | 2.853  | libcurl wrapper       |
-  | http.rb (persistent)     | 2.970  | Ruby + http_parser.rb |
-  | http.rb                  | 3.588  | Ruby + http_parser.rb |
-  | HTTParty                 | 3.931  | Net::HTTP wrapper     |
-  | Net::HTTP                | 3.959  | Pure Ruby             |
-  | Net::HTTP (persistent)   | 4.043  | Pure Ruby             |
-  | open-uri                 | 4.479  | Net::HTTP wrapper     |
-  | Excon (persistent)       | 4.618  | Pure Ruby             |
-  | Excon                    | 4.701  | Pure Ruby             |
-  | RestClient               | 26.838 | Net::HTTP wrapper     |
-
-Benchmarks performed using excon's benchmarking tool
-
-DISCLAIMER: Most benchmarks you find in READMEs are crap,
-including this one. These are out-of-date. If you care about
-performance, benchmark for yourself for your own use cases!
-
-## Help and Discussion
-
-If you need help or just want to talk about the http.rb,
-visit the http.rb Google Group:
-
-https://groups.google.com/forum/#!forum/httprb
-
-You can join by email by sending a message to:
-
-[httprb+subscr...@googlegroups.com](mailto:httprb+subscr...@googlegroups.com)
-
-If you believe you've found a bug, please report it at:
-
-https://github.com/httprb/http/issues
+- **Performance**: using native parsers and a clean, lightweight 
implementation,
+   http.rb achieves high performance while implementing HTTP in Ruby instead 
of C.
 
 
 ## Installation
@@ -112,10 +61,9 @@
 
 The following API documentation is also available:
 
-* [YARD API documentation](https://www.rubydoc.info/github/httprb/http)
-* [Chainable module (all chainable 
methods)](https://www.rubydoc.info/github/httprb/http/HTTP/Chainable)
+- [YARD API documentation](https://www.rubydoc.info/github/httprb/http)
+- [Chainable module (all chainable 
methods)](https://www.rubydoc.info/github/httprb/http/HTTP/Chainable)
 
-[documentation]: https://github.com/httprb/http/wiki
 
 ### Basic Usage
 
@@ -142,7 +90,7 @@
 ```
 
 The response body can be streamed with `HTTP::Response::Body#readpartial`.
-In practice, you'll want to bind the HTTP::Response::Body to a local variable
+In practice, you'll want to bind the `HTTP::Response::Body` to a local variable
 and call `#readpartial` on it repeatedly until it returns `nil`:
 
 ```ruby
@@ -159,13 +107,13 @@
 
 ## Supported Ruby Versions
 
-This library aims to support and is [tested against][travis] the following Ruby
-versions:
+This library aims to support and is [tested against][build-link]
+the following Ruby  versions:
 
-* Ruby 2.6
-* Ruby 2.7
-* Ruby 3.0
-* JRuby 9.2
+- Ruby 2.6
+- Ruby 2.7
+- Ruby 3.0
+- JRuby 9.2
 
 If something doesn't work on one of these versions, it's a bug.
 
@@ -180,20 +128,36 @@
 exist at the time of a major release, support for that Ruby version may be
 dropped.
 
-[travis]: http://travis-ci.org/httprb/http
-
 
 ## Contributing to http.rb
 
-* Fork http.rb on GitHub
-* Make your changes
-* Ensure all tests pass (`bundle exec rake`)
-* Send a pull request
-* If we like them we'll merge them
-* If we've accepted a patch, feel free to ask for commit access!
+- Fork http.rb on GitHub
+- Make your changes
+- Ensure all tests pass (`bundle exec rake`)
+- Send a pull request
+- If we like them we'll merge them
+- If we've accepted a patch, feel free to ask for commit access!
 
 
 ## Copyright
 
-Copyright (c) 2011-2021 Tony Arcieri, Alexey V. Zapparov, Erik Michaels-Ober, 
Zachary Anker.
+Copyright ?? 2011-2021 Tony Arcieri, Alexey V. Zapparov, Erik Michaels-Ober, 
Zachary Anker.
 See LICENSE.txt for further details.
+
+
+[//]: # (badges)
+
+[gem-image]: https://img.shields.io/gem/v/http?logo=ruby
+[gem-link]: https://rubygems.org/gems/http
+[license-image]: https://img.shields.io/badge/license-MIT-blue.svg
+[license-link]: https://github.com/httprb/http/blob/main/LICENSE.txt
+[build-image]: https://github.com/httprb/http/workflows/CI/badge.svg
+[build-link]: https://github.com/httprb/http/actions/workflows/ci.yml
+[codeclimate-image]: https://codeclimate.com/github/httprb/http.svg?branch=main
+[codeclimate-link]: https://codeclimate.com/github/httprb/http
+
+[//]: # (links)
+
+[documentation]: https://github.com/httprb/http/wiki
+[requests]: http://docs.python-requests.org/en/latest/
+[llhttp]: https://llhttp.org/
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-06-26 19:59:24.000000000 +0200
+++ new/http.gemspec    2021-10-07 20:24:26.000000000 +0200
@@ -27,10 +27,10 @@
 
   gem.required_ruby_version = ">= 2.5"
 
-  gem.add_runtime_dependency "addressable",    "~> 2.3"
+  gem.add_runtime_dependency "addressable",    "~> 2.8"
   gem.add_runtime_dependency "http-cookie",    "~> 1.0"
   gem.add_runtime_dependency "http-form_data", "~> 2.2"
-  gem.add_runtime_dependency "llhttp-ffi",     "~> 0.3.0"
+  gem.add_runtime_dependency "llhttp-ffi",     "~> 0.4.0"
 
   gem.add_development_dependency "bundler", "~> 2.0"
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lib/http/client.rb new/lib/http/client.rb
--- old/lib/http/client.rb      2021-06-26 19:59:24.000000000 +0200
+++ new/lib/http/client.rb      2021-10-07 20:24:26.000000000 +0200
@@ -32,7 +32,7 @@
       return res unless opts.follow
 
       Redirector.new(opts.follow).perform(req, res) do |request|
-        perform(request, opts)
+        perform(wrap_request(request, opts), opts)
       end
     end
 
@@ -52,9 +52,7 @@
         :body           => body
       )
 
-      opts.features.inject(req) do |request, (_name, feature)|
-        feature.wrap_request(request)
-      end
+      wrap_request(req, opts)
     end
 
     # @!method persistent?
@@ -104,6 +102,12 @@
 
     private
 
+    def wrap_request(req, opts)
+      opts.features.inject(req) do |request, (_name, feature)|
+        feature.wrap_request(request)
+      end
+    end
+
     def build_response(req, options)
       Response.new(
         :status        => @connection.status_code,
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lib/http/features/auto_inflate.rb 
new/lib/http/features/auto_inflate.rb
--- old/lib/http/features/auto_inflate.rb       2021-06-26 19:59:24.000000000 
+0200
+++ new/lib/http/features/auto_inflate.rb       2021-10-07 20:24:26.000000000 
+0200
@@ -21,8 +21,6 @@
           :request       => response.request
         }
 
-        options[:uri] = response.uri if response.uri
-
         Response.new(options)
       end
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lib/http/request/writer.rb 
new/lib/http/request/writer.rb
--- old/lib/http/request/writer.rb      2021-06-26 19:59:24.000000000 +0200
+++ new/lib/http/request/writer.rb      2021-10-07 20:24:26.000000000 +0200
@@ -47,7 +47,11 @@
       # Adds the headers to the header array for the given request body we are 
working
       # with
       def add_body_type_headers
-        return if @headers[Headers::CONTENT_LENGTH] || chunked?
+        return if @headers[Headers::CONTENT_LENGTH] || chunked? || (
+          @body.source.nil? && %w[GET HEAD DELETE CONNECT].any? do |method|
+            @request_header[0].start_with?("#{method} ")
+          end
+        )
 
         @request_header << "#{Headers::CONTENT_LENGTH}: #{@body.size}"
       end
@@ -57,7 +61,7 @@
       def join_headers
         # join the headers array with crlfs, stick two on the end because
         # that ends the request header
-        @request_header.join(CRLF) + CRLF * 2
+        @request_header.join(CRLF) + (CRLF * 2)
       end
 
       # Writes HTTP request data into the socket.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lib/http/response/body.rb 
new/lib/http/response/body.rb
--- old/lib/http/response/body.rb       2021-06-26 19:59:24.000000000 +0200
+++ new/lib/http/response/body.rb       2021-10-07 20:24:26.000000000 +0200
@@ -27,7 +27,9 @@
       # (see HTTP::Client#readpartial)
       def readpartial(*args)
         stream!
-        @stream.readpartial(*args)&.force_encoding(@encoding)
+        chunk = @stream.readpartial(*args)
+
+        String.new(chunk, :encoding => @encoding) if chunk
       end
 
       # Iterate over the body, allowing it to be enumerable
@@ -45,11 +47,11 @@
 
         begin
           @streaming  = false
-          @contents   = String.new("").force_encoding(@encoding)
+          @contents   = String.new("", :encoding => @encoding)
 
           while (chunk = @stream.readpartial)
-            @contents << chunk.force_encoding(@encoding)
-            chunk.clear # deallocate string
+            @contents << String.new(chunk, :encoding => @encoding)
+            chunk = nil # deallocate string
           end
         rescue
           @contents = nil
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lib/http/response/parser.rb 
new/lib/http/response/parser.rb
--- old/lib/http/response/parser.rb     2021-06-26 19:59:24.000000000 +0200
+++ new/lib/http/response/parser.rb     2021-10-07 20:24:26.000000000 +0200
@@ -15,7 +15,7 @@
       end
 
       def reset
-        @parser.finish
+        @parser.reset
         @handler.reset
         @header_finished = false
         @message_finished = false
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-06-26 19:59:24.000000000 +0200
+++ new/lib/http/response.rb    2021-10-07 20:24:26.000000000 +0200
@@ -40,10 +40,11 @@
     # @option opts [HTTP::Connection] :connection
     # @option opts [String] :encoding Encoding to use when reading body
     # @option opts [String] :body
-    # @option opts [HTTP::Request] request
+    # @option opts [HTTP::Request] request The request this is in response to.
+    # @option opts [String] :uri (DEPRECATED) used to populate a missing 
request
     def initialize(opts)
       @version       = opts.fetch(:version)
-      @request       = opts.fetch(:request)
+      @request       = init_request(opts)
       @status        = HTTP::Response::Status.new(opts.fetch(:status))
       @headers       = HTTP::Headers.coerce(opts[:headers] || {})
       @proxy_headers = HTTP::Headers.coerce(opts[:proxy_headers] || {})
@@ -137,8 +138,8 @@
     def_delegator :content_type, :charset
 
     def cookies
-      @cookies ||= headers.each_with_object CookieJar.new do |(k, v), jar|
-        jar.parse(v, uri) if k == Headers::SET_COOKIE
+      @cookies ||= headers.get(Headers::SET_COOKIE).each_with_object 
CookieJar.new do |v, jar|
+        jar.parse(v, uri)
       end
     end
 
@@ -164,5 +165,22 @@
     def inspect
       "#<#{self.class}/#{@version} #{code} #{reason} #{headers.to_h.inspect}>"
     end
+
+    private
+
+    # Initialize an HTTP::Request from options.
+    #
+    # @return [HTTP::Request]
+    def init_request(opts)
+      raise ArgumentError, ":uri is for backwards compatibilty and conflicts 
with :request" \
+        if opts[:request] && opts[:uri]
+
+      # For backwards compatibilty
+      if opts[:uri]
+        HTTP::Request.new(:uri => opts[:uri], :verb => :get)
+      else
+        opts.fetch(:request)
+      end
+    end
   end
 end
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-06-26 19:59:24.000000000 +0200
+++ new/lib/http/timeout/global.rb      2021-10-07 20:24:26.000000000 +0200
@@ -35,12 +35,10 @@
         begin
           @socket.connect_nonblock
         rescue IO::WaitReadable
-          IO.select([@socket], nil, nil, @time_left)
-          log_time
+          wait_readable_or_timeout
           retry
         rescue IO::WaitWritable
-          IO.select(nil, [@socket], nil, @time_left)
-          log_time
+          wait_writable_or_timeout
           retry
         end
       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-06-26 19:59:24.000000000 +0200
+++ new/lib/http/version.rb     2021-10-07 20:24:26.000000000 +0200
@@ -1,5 +1,5 @@
 # frozen_string_literal: true
 
 module HTTP
-  VERSION = "5.0.1"
+  VERSION = "5.0.4"
 end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/metadata new/metadata
--- old/metadata        2021-06-26 19:59:24.000000000 +0200
+++ new/metadata        2021-10-07 20:24:26.000000000 +0200
@@ -1,7 +1,7 @@
 --- !ruby/object:Gem::Specification
 name: http
 version: !ruby/object:Gem::Version
-  version: 5.0.1
+  version: 5.0.4
 platform: ruby
 authors:
 - Tony Arcieri
@@ -11,7 +11,7 @@
 autorequire:
 bindir: bin
 cert_chain: []
-date: 2021-06-26 00:00:00.000000000 Z
+date: 2021-10-07 00:00:00.000000000 Z
 dependencies:
 - !ruby/object:Gem::Dependency
   name: addressable
@@ -19,14 +19,14 @@
     requirements:
     - - "~>"
       - !ruby/object:Gem::Version
-        version: '2.3'
+        version: '2.8'
   type: :runtime
   prerelease: false
   version_requirements: !ruby/object:Gem::Requirement
     requirements:
     - - "~>"
       - !ruby/object:Gem::Version
-        version: '2.3'
+        version: '2.8'
 - !ruby/object:Gem::Dependency
   name: http-cookie
   requirement: !ruby/object:Gem::Requirement
@@ -61,14 +61,14 @@
     requirements:
     - - "~>"
       - !ruby/object:Gem::Version
-        version: 0.3.0
+        version: 0.4.0
   type: :runtime
   prerelease: false
   version_requirements: !ruby/object:Gem::Requirement
     requirements:
     - - "~>"
       - !ruby/object:Gem::Version
-        version: 0.3.0
+        version: 0.4.0
 - !ruby/object:Gem::Dependency
   name: bundler
   requirement: !ruby/object:Gem::Requirement
@@ -191,7 +191,7 @@
   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.1/CHANGES.md
+  changelog_uri: https://github.com/httprb/http/blob/v5.0.4/CHANGES.md
 post_install_message:
 rdoc_options: []
 require_paths:
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-06-26 19:59:24.000000000 +0200
+++ new/spec/lib/http/client_spec.rb    2021-10-07 20:24:26.000000000 +0200
@@ -4,6 +4,7 @@
 require "support/http_handling_shared"
 require "support/dummy_server"
 require "support/ssl_helper"
+require "logger"
 
 RSpec.describe HTTP::Client do
   run_server(:dummy) { DummyServer.new }
@@ -115,6 +116,39 @@
     end
   end
 
+  describe "following redirects with logging" do
+    let(:logger) do
+      logger           = Logger.new(logdev)
+      logger.formatter = ->(severity, _, _, message) { format("** %s 
**\n%s\n", severity, message) }
+      logger.level     = Logger::INFO
+      logger
+    end
+
+    let(:logdev) { StringIO.new }
+
+    it "logs all requests" do
+      client = StubbedClient.new(:follow => true, :features => { :logging => { 
:logger => logger } }).stub(
+        "http://example.com/";  => redirect_response("/1"),
+        "http://example.com/1"; => redirect_response("/2"),
+        "http://example.com/2"; => redirect_response("/3"),
+        "http://example.com/3"; => simple_response("OK")
+      )
+
+      expect { client.get("http://example.com/";) }.not_to raise_error
+
+      expect(logdev.string).to eq <<~OUTPUT
+        ** INFO **
+        > GET http://example.com/
+        ** INFO **
+        > GET http://example.com/1
+        ** INFO **
+        > GET http://example.com/2
+        ** INFO **
+        > GET http://example.com/3
+      OUTPUT
+    end
+  end
+
   describe "parsing params" do
     let(:client) { HTTP::Client.new }
     before { allow(client).to receive :perform }
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/spec/lib/http/features/auto_inflate_spec.rb 
new/spec/lib/http/features/auto_inflate_spec.rb
--- old/spec/lib/http/features/auto_inflate_spec.rb     2021-06-26 
19:59:24.000000000 +0200
+++ new/spec/lib/http/features/auto_inflate_spec.rb     2021-10-07 
20:24:26.000000000 +0200
@@ -74,7 +74,6 @@
           :status     => 200,
           :headers    => {:content_encoding => "gzip"},
           :connection => connection,
-          :uri        => "https://example.com";,
           :request    => HTTP::Request.new(:verb => :get, :uri => 
"https://example.com";)
         )
       end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/spec/lib/http/features/instrumentation_spec.rb 
new/spec/lib/http/features/instrumentation_spec.rb
--- old/spec/lib/http/features/instrumentation_spec.rb  2021-06-26 
19:59:24.000000000 +0200
+++ new/spec/lib/http/features/instrumentation_spec.rb  2021-10-07 
20:24:26.000000000 +0200
@@ -46,7 +46,6 @@
     let(:response) do
       HTTP::Response.new(
         :version => "1.1",
-        :uri     => "https://example.com";,
         :status  => 200,
         :headers => {:content_type => "application/json"},
         :body    => '{"success": true}',
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/spec/lib/http/features/logging_spec.rb 
new/spec/lib/http/features/logging_spec.rb
--- old/spec/lib/http/features/logging_spec.rb  2021-06-26 19:59:24.000000000 
+0200
+++ new/spec/lib/http/features/logging_spec.rb  2021-10-07 20:24:26.000000000 
+0200
@@ -42,7 +42,6 @@
     let(:response) do
       HTTP::Response.new(
         :version => "1.1",
-        :uri     => "https://example.com";,
         :status  => 200,
         :headers => {:content_type => "application/json"},
         :body    => '{"success": true}',
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/spec/lib/http/request/body_spec.rb 
new/spec/lib/http/request/body_spec.rb
--- old/spec/lib/http/request/body_spec.rb      2021-06-26 19:59:24.000000000 
+0200
+++ new/spec/lib/http/request/body_spec.rb      2021-10-07 20:24:26.000000000 
+0200
@@ -118,10 +118,10 @@
     end
 
     context "when body is a non-Enumerable IO" do
-      let(:body) { FakeIO.new("a" * 16 * 1024 + "b" * 10 * 1024) }
+      let(:body) { FakeIO.new(("a" * 16 * 1024) + ("b" * 10 * 1024)) }
 
       it "yields chunks of content" do
-        expect(chunks.inject("", :+)).to eq "a" * 16 * 1024 + "b" * 10 * 1024
+        expect(chunks.inject("", :+)).to eq ("a" * 16 * 1024) + ("b" * 10 * 
1024)
       end
     end
 
@@ -148,7 +148,7 @@
     end
 
     context "when body is an Enumerable IO" do
-      let(:data) { "a" * 16 * 1024 + "b" * 10 * 1024 }
+      let(:data) { ("a" * 16 * 1024) + ("b" * 10 * 1024) }
       let(:body) { StringIO.new data }
 
       it "yields chunks of content" do
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/spec/lib/http/request/writer_spec.rb 
new/spec/lib/http/request/writer_spec.rb
--- old/spec/lib/http/request/writer_spec.rb    2021-06-26 19:59:24.000000000 
+0200
+++ new/spec/lib/http/request/writer_spec.rb    2021-10-07 20:24:26.000000000 
+0200
@@ -47,9 +47,20 @@
       end
     end
 
-    context "when body is empty" do
+    context "when body is not set" do
       let(:body) { HTTP::Request::Body.new(nil) }
 
+      it "doesn't write anything to the socket and doesn't set Content-Length" 
do
+        writer.stream
+        expect(io.string).to eq [
+          "#{headerstart}\r\n\r\n"
+        ].join
+      end
+    end
+
+    context "when body is empty" do
+      let(:body) { HTTP::Request::Body.new("") }
+
       it "doesn't write anything to the socket and sets Content-Length" do
         writer.stream
         expect(io.string).to eq [
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-06-26 19:59:24.000000000 
+0200
+++ new/spec/lib/http/response/body_spec.rb     2021-10-07 20:24:26.000000000 
+0200
@@ -2,7 +2,7 @@
 
 RSpec.describe HTTP::Response::Body do
   let(:connection) { double(:sequence_id => 0) }
-  let(:chunks)     { [String.new("Hello, "), String.new("World!")] }
+  let(:chunks)     { ["Hello, ", "World!"] }
 
   before do
     allow(connection).to receive(:readpartial) { chunks.shift }
@@ -16,7 +16,7 @@
   end
 
   context "when body empty" do
-    let(:chunks) { [String.new("")] }
+    let(:chunks) { [""] }
 
     it "returns responds to empty? with true" do
       expect(subject).to be_empty
@@ -45,12 +45,12 @@
     it "returns content in specified encoding" do
       body = described_class.new(connection)
       expect(connection).to receive(:readpartial).
-        and_return(String.new("content").force_encoding(Encoding::UTF_8))
+        and_return(String.new("content", :encoding => Encoding::UTF_8))
       expect(body.readpartial.encoding).to eq Encoding::BINARY
 
       body = described_class.new(connection, :encoding => Encoding::UTF_8)
       expect(connection).to receive(:readpartial).
-        and_return(String.new("content").force_encoding(Encoding::BINARY))
+        and_return(String.new("content", :encoding => Encoding::BINARY))
       expect(body.readpartial.encoding).to eq Encoding::UTF_8
     end
   end
@@ -59,7 +59,7 @@
     let(:chunks) do
       body = Zlib::Deflate.deflate("Hi, HTTP here ???")
       len  = body.length
-      [String.new(body[0, len / 2]), String.new(body[(len / 2)..-1])]
+      [body[0, len / 2], body[(len / 2)..-1]]
     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/parser_spec.rb 
new/spec/lib/http/response/parser_spec.rb
--- old/spec/lib/http/response/parser_spec.rb   2021-06-26 19:59:24.000000000 
+0200
+++ new/spec/lib/http/response/parser_spec.rb   2021-10-07 20:24:26.000000000 
+0200
@@ -46,9 +46,9 @@
   context "when got 100 Continue response" do
     let :raw_response do
       "HTTP/1.1 100 Continue\r\n\r\n" \
-      "HTTP/1.1 200 OK\r\n" \
-      "Content-Length: 12\r\n\r\n" \
-      "Hello World!"
+        "HTTP/1.1 200 OK\r\n" \
+        "Content-Length: 12\r\n\r\n" \
+        "Hello World!"
     end
 
     context "when response is feeded in one part" do
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-06-26 19:59:24.000000000 +0200
+++ new/spec/lib/http/response_spec.rb  2021-10-07 20:24:26.000000000 +0200
@@ -4,6 +4,7 @@
   let(:body)          { "Hello world!" }
   let(:uri)           { "http://example.com/"; }
   let(:headers)       { {} }
+  let(:request)       { HTTP::Request.new(:verb => :get, :uri => uri) }
 
   subject(:response) do
     HTTP::Response.new(
@@ -11,8 +12,7 @@
       :version => "1.1",
       :headers => headers,
       :body    => body,
-      :uri     => uri,
-      :request => HTTP::Request.new(:verb => :get, :uri => 
"http://example.com";)
+      :request => request
     )
   end
 
@@ -167,7 +167,7 @@
         :version    => "1.1",
         :status     => 200,
         :connection => connection,
-        :request    => HTTP::Request.new(:verb => :get, :uri => 
"http://example.com";)
+        :request    => request
       )
     end
 
@@ -184,4 +184,43 @@
     end
     it { is_expected.not_to be_chunked }
   end
+
+  describe "backwards compatibilty with :uri" do
+    context "with no :verb" do
+      subject(:response) do
+        HTTP::Response.new(
+          :status  => 200,
+          :version => "1.1",
+          :headers => headers,
+          :body    => body,
+          :uri     => uri
+        )
+      end
+
+      it "defaults the uri to :uri" do
+        expect(response.request.uri.to_s).to eq uri
+      end
+
+      it "defaults to the verb to :get" do
+        expect(response.request.verb).to eq :get
+      end
+    end
+
+    context "with both a :request and :uri" do
+      subject(:response) do
+        HTTP::Response.new(
+          :status  => 200,
+          :version => "1.1",
+          :headers => headers,
+          :body    => body,
+          :uri     => uri,
+          :request => request
+        )
+      end
+
+      it "raises ArgumentError" do
+        expect { response }.to raise_error(ArgumentError)
+      end
+    end
+  end
 end

Reply via email to