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 2023-11-15 21:08:02 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/rubygem-http (Old) and /work/SRC/openSUSE:Factory/.rubygem-http.new.17445 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "rubygem-http" Wed Nov 15 21:08:02 2023 rev:4 rq:1126375 version:5.1.1 Changes: -------- --- /work/SRC/openSUSE:Factory/rubygem-http/rubygem-http.changes 2022-08-09 15:26:44.733349719 +0200 +++ /work/SRC/openSUSE:Factory/.rubygem-http.new.17445/rubygem-http.changes 2023-11-15 21:09:20.533923524 +0100 @@ -1,0 +2,5 @@ +Tue Nov 14 18:29:37 UTC 2023 - Dan Äermák <dan.cer...@posteo.net> + +- New upstream release 5.1.1, see bundled CHANGES.md + +------------------------------------------------------------------- Old: ---- http-5.1.0.gem New: ---- http-5.1.1.gem ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ rubygem-http.spec ++++++ --- /var/tmp/diff_new_pack.ZLEf6J/_old 2023-11-15 21:09:20.993940496 +0100 +++ /var/tmp/diff_new_pack.ZLEf6J/_new 2023-11-15 21:09:20.993940496 +0100 @@ -1,7 +1,7 @@ # # spec file for package rubygem-http # -# Copyright (c) 2022 SUSE LLC +# Copyright (c) 2023 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -24,11 +24,10 @@ # Name: rubygem-http -Version: 5.1.0 +Version: 5.1.1 Release: 0 %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 @@ -37,7 +36,6 @@ Source1: gem2rpm.yml 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 ++++++ http-5.1.0.gem -> http-5.1.1.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 2022-06-17 04:52:36.000000000 +0200 +++ new/.github/workflows/ci.yml 2022-12-18 00:32:49.000000000 +0100 @@ -38,6 +38,26 @@ path-to-lcov: ./coverage/lcov/lcov.info parallel: true + test-flaky: + runs-on: ${{ matrix.os }} + + strategy: + matrix: + ruby: [ jruby-9.3 ] + os: [ ubuntu-latest ] + + steps: + - uses: actions/checkout@v3 + + - uses: ruby/setup-ruby@v1 + with: + ruby-version: ${{ matrix.ruby }} + bundler-cache: true + + - name: bundle exec rspec + continue-on-error: true + run: bundle exec rspec --format progress --force-colour + coveralls: needs: test runs-on: ubuntu-latest diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/.rubocop_todo.yml new/.rubocop_todo.yml --- old/.rubocop_todo.yml 2022-06-17 04:52:36.000000000 +0200 +++ new/.rubocop_todo.yml 2022-12-18 00:32:49.000000000 +0100 @@ -74,7 +74,7 @@ - 'lib/http/request.rb' - 'lib/http/response.rb' -# Offense count: 69 +# Offense count: 70 # Configuration parameters: CountComments, Max, CountAsOne, ExcludedMethods, IgnoredMethods. # IgnoredMethods: refine Metrics/BlockLength: @@ -98,6 +98,7 @@ - 'spec/lib/http/response/parser_spec.rb' - 'spec/lib/http/response/status_spec.rb' - 'spec/lib/http/response_spec.rb' + - 'spec/lib/http/uri_spec.rb' - 'spec/lib/http_spec.rb' - 'spec/support/http_handling_shared.rb' diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/CHANGES.md new/CHANGES.md --- old/CHANGES.md 2022-06-17 04:52:36.000000000 +0200 +++ new/CHANGES.md 2022-12-18 00:32:49.000000000 +0100 @@ -1,3 +1,13 @@ +## 5.1.1 (2022-12-17) + +* [#731](https://github.com/httprb/http/pull/731) + Strip brackets from IPv6 addresses in `HTTP::URI`. + ([@jeraki]) + +* [#722](https://github.com/httprb/http/pull/722) + Add `on_redirect` callback. + ([@benubois]) + ## 5.1.0 (2022-06-17) * Drop ruby-2.5 support. @@ -988,3 +998,5 @@ [@YuLeven]: https://github.com/YuLeven [@drwl]: https://github.com/drwl [@tkellogg]: https://github.com/tkellogg +[@jeraki]: https://github.com/jeraki +[@benubois]: https://github.com/benubois diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/README.md new/README.md --- old/README.md 2022-06-17 04:52:36.000000000 +0200 +++ new/README.md 2022-12-18 00:32:49.000000000 +0100 @@ -113,7 +113,8 @@ - Ruby 2.6 - Ruby 2.7 - Ruby 3.0 -- JRuby 9.2 +- Ruby 3.1 +- JRuby 9.3 If something doesn't work on one of these versions, it's a bug. Binary files old/checksums.yaml.gz and new/checksums.yaml.gz differ 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 2022-06-17 04:52:36.000000000 +0200 +++ new/lib/http/redirector.rb 2022-12-18 00:32:49.000000000 +0100 @@ -40,8 +40,9 @@ # @option opts [Boolean] :strict (true) redirector hops policy # @option opts [#to_i] :max_hops (5) maximum allowed amount of hops def initialize(opts = {}) - @strict = opts.fetch(:strict, true) - @max_hops = opts.fetch(:max_hops, 5).to_i + @strict = opts.fetch(:strict, true) + @max_hops = opts.fetch(:max_hops, 5).to_i + @on_redirect = opts.fetch(:on_redirect, nil) end # Follows redirects until non-redirect response found @@ -65,6 +66,7 @@ unless cookie_jar.empty? @request.headers.set(Headers::COOKIE, cookie_jar.cookies.map { |c| "#{c.name}=#{c.value}" }.join("; ")) end + @on_redirect.call @response, @request if @on_redirect.respond_to?(:call) @response = yield @request collect_cookies_from_response end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/http/uri.rb new/lib/http/uri.rb --- old/lib/http/uri.rb 2022-06-17 04:52:36.000000000 +0200 +++ new/lib/http/uri.rb 2022-12-18 00:32:49.000000000 +0100 @@ -9,7 +9,6 @@ def_delegators :@uri, :scheme, :normalized_scheme, :scheme= def_delegators :@uri, :user, :normalized_user, :user= def_delegators :@uri, :password, :normalized_password, :password= - def_delegators :@uri, :host, :normalized_host, :host= def_delegators :@uri, :authority, :normalized_authority, :authority= def_delegators :@uri, :origin, :origin= def_delegators :@uri, :normalized_port, :port= @@ -20,6 +19,18 @@ def_delegators :@uri, :fragment, :normalized_fragment, :fragment= def_delegators :@uri, :omit, :join, :normalize + # Host, either a domain name or IP address. If the host is an IPv6 address, it will be returned + # without brackets surrounding it. + # + # @return [String] The host of the URI + attr_reader :host + + # Normalized host, either a domain name or IP address. If the host is an IPv6 address, it will + # be returned without brackets surrounding it. + # + # @return [String] The normalized host of the URI + attr_reader :normalized_host + # @private HTTP_SCHEME = "http" @@ -83,6 +94,9 @@ else raise TypeError, "expected Hash for options, got #{options_or_uri.class}" end + + @host = process_ipv6_brackets(@uri.host) + @normalized_host = process_ipv6_brackets(@uri.normalized_host) end # Are these URI objects equal? Normalizes both URIs prior to comparison @@ -110,6 +124,17 @@ @hash ||= to_s.hash * -1 end + # Sets the host component for the URI. + # + # @param [String, #to_str] new_host The new host component. + # @return [void] + def host=(new_host) + @uri.host = process_ipv6_brackets(new_host, :brackets => true) + + @host = process_ipv6_brackets(@uri.host) + @normalized_host = process_ipv6_brackets(@uri.normalized_host) + end + # Port number, either as specified or the default if unspecified # # @return [Integer] port number @@ -146,5 +171,25 @@ def inspect format("#<%s:0x%014x URI:%s>", self.class.name, object_id << 1, to_s) end + + private + + # Process a URI host, adding or removing surrounding brackets if the host is an IPv6 address. + # + # @param [Boolean] brackets When true, brackets will be added to IPv6 addresses if missing. When + # false, they will be removed if present. + # + # @return [String] Host with IPv6 address brackets added or removed + def process_ipv6_brackets(raw_host, brackets: false) + ip = IPAddr.new(raw_host) + + if ip.ipv6? + brackets ? "[#{ip}]" : ip.to_s + else + raw_host + end + rescue IPAddr::Error + raw_host + end 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 2022-06-17 04:52:36.000000000 +0200 +++ new/lib/http/version.rb 2022-12-18 00:32:49.000000000 +0100 @@ -1,5 +1,5 @@ # frozen_string_literal: true module HTTP - VERSION = "5.1.0" + VERSION = "5.1.1" end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/metadata new/metadata --- old/metadata 2022-06-17 04:52:36.000000000 +0200 +++ new/metadata 2022-12-18 00:32:49.000000000 +0100 @@ -1,7 +1,7 @@ --- !ruby/object:Gem::Specification name: http version: !ruby/object:Gem::Version - version: 5.1.0 + version: 5.1.1 platform: ruby authors: - Tony Arcieri @@ -11,7 +11,7 @@ autorequire: bindir: bin cert_chain: [] -date: 2022-06-17 00:00:00.000000000 Z +date: 2022-12-17 00:00:00.000000000 Z dependencies: - !ruby/object:Gem::Dependency name: addressable @@ -192,7 +192,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.1.0/CHANGES.md + changelog_uri: https://github.com/httprb/http/blob/v5.1.1/CHANGES.md rubygems_mfa_required: 'true' post_install_message: rdoc_options: [] @@ -209,7 +209,7 @@ - !ruby/object:Gem::Version version: '0' requirements: [] -rubygems_version: 3.1.6 +rubygems_version: 3.0.3 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 2022-06-17 04:52:36.000000000 +0200 +++ new/spec/lib/http/client_spec.rb 2022-12-18 00:32:49.000000000 +0100 @@ -1,10 +1,12 @@ # coding: utf-8 # frozen_string_literal: true +require "cgi" +require "logger" + 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 } 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 2022-06-17 04:52:36.000000000 +0200 +++ new/spec/lib/http/redirector_spec.rb 2022-12-18 00:32:49.000000000 +0100 @@ -148,6 +148,32 @@ expect(cookies["deleted"]).to eq nil end + context "with on_redirect callback" do + let(:options) do + { + :on_redirect => proc do |response, location| + @redirect_response = response + @redirect_location = location + end + } + end + + it "calls on_redirect" do + req = HTTP::Request.new :verb => :head, :uri => "http://example.com" + hops = [ + redirect_response(301, "http://example.com/1"), + redirect_response(301, "http://example.com/2"), + simple_response(200, "foo") + ] + + redirector.perform(req, hops.shift) do |prev_req, _| + expect(@redirect_location.uri.to_s).to eq prev_req.uri.to_s + expect(@redirect_response.code).to eq 301 + hops.shift + end + end + end + context "following 300 redirect" do context "with strict mode" do let(:options) { {:strict => true} } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/spec/lib/http/uri_spec.rb new/spec/lib/http/uri_spec.rb --- old/spec/lib/http/uri_spec.rb 2022-06-17 04:52:36.000000000 +0200 +++ new/spec/lib/http/uri_spec.rb 2022-12-18 00:32:49.000000000 +0100 @@ -1,11 +1,15 @@ # frozen_string_literal: true RSpec.describe HTTP::URI do + let(:example_ipv6_address) { "2606:2800:220:1:248:1893:25c8:1946" } + let(:example_http_uri_string) { "http://example.com" } let(:example_https_uri_string) { "https://example.com" } + let(:example_ipv6_uri_string) { "https://[#{example_ipv6_address}]" } subject(:http_uri) { described_class.parse(example_http_uri_string) } subject(:https_uri) { described_class.parse(example_https_uri_string) } + subject(:ipv6_uri) { described_class.parse(example_ipv6_uri_string) } it "knows URI schemes" do expect(http_uri.scheme).to eq "http" @@ -20,6 +24,41 @@ expect(https_uri.port).to eq 443 end + describe "#host" do + it "strips brackets from IPv6 addresses" do + expect(ipv6_uri.host).to eq("2606:2800:220:1:248:1893:25c8:1946") + end + end + + describe "#normalized_host" do + it "strips brackets from IPv6 addresses" do + expect(ipv6_uri.normalized_host).to eq("2606:2800:220:1:248:1893:25c8:1946") + end + end + + describe "#host=" do + it "updates cached values for #host and #normalized_host" do + expect(http_uri.host).to eq("example.com") + expect(http_uri.normalized_host).to eq("example.com") + + http_uri.host = "[#{example_ipv6_address}]" + + expect(http_uri.host).to eq(example_ipv6_address) + expect(http_uri.normalized_host).to eq(example_ipv6_address) + end + + it "ensures IPv6 addresses are bracketed in the inner Addressable::URI" do + expect(http_uri.host).to eq("example.com") + expect(http_uri.normalized_host).to eq("example.com") + + http_uri.host = example_ipv6_address + + expect(http_uri.host).to eq(example_ipv6_address) + expect(http_uri.normalized_host).to eq(example_ipv6_address) + expect(http_uri.instance_variable_get(:@uri).host).to eq("[#{example_ipv6_address}]") + end + end + describe "#dup" do it "doesn't share internal value between duplicates" do duplicated_uri = http_uri.dup diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/spec/support/dummy_server/servlet.rb new/spec/support/dummy_server/servlet.rb --- old/spec/support/dummy_server/servlet.rb 2022-06-17 04:52:36.000000000 +0200 +++ new/spec/support/dummy_server/servlet.rb 2022-12-18 00:32:49.000000000 +0100 @@ -1,6 +1,8 @@ # encoding: UTF-8 # frozen_string_literal: true +require "cgi" + class DummyServer < WEBrick::HTTPServer class Servlet < WEBrick::HTTPServlet::AbstractServlet # rubocop:disable Metrics/ClassLength def self.sockets