From 00422fb4ce72b30ac82e3b46df4d9c2cb0df43fd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Rodr=C3=ADguez?= Date: Thu, 25 Mar 2021 12:04:05 +0100 Subject: [PATCH 1/5] Restore ruby 2.5 support As far as I know, this is the only stdlib that has dropped ruby 2.5, which hasn't yet reached its End of Life date. The motivation for this is that there's no gemified version of `net-http` that supports ruby 2.5, and that makes it hard for libraries depending on `net-http` to properly declare the dependency, since the only way is to drop support for ruby 2.5, which many maintainers will not yet want to do. The reason for wanting to declare the `net-http` dependency is mainly that it helps bundler & rubygems with avoiding double loads of different versions of `net-http` (the stdlib version and a higher gemified version). As far as I can observe from commit history, the only reason for dropping support for ruby 2.5 was that tests didn't pass, so I made them pass. --- .github/workflows/test.yml | 2 +- net-http.gemspec | 2 +- test/net/http/test_https.rb | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index cdb4aa69..e9830f37 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -7,7 +7,7 @@ jobs: name: build (${{ matrix.ruby }} / ${{ matrix.os }}) strategy: matrix: - ruby: [ '3.0', 2.7, 2.6, head ] + ruby: [ '3.0', 2.7, 2.6, 2.5, head ] os: [ ubuntu-latest, macos-latest ] runs-on: ${{ matrix.os }} steps: diff --git a/net-http.gemspec b/net-http.gemspec index f5ef4045..ae78b43c 100644 --- a/net-http.gemspec +++ b/net-http.gemspec @@ -16,7 +16,7 @@ Gem::Specification.new do |spec| spec.summary = %q{HTTP client api for Ruby.} spec.description = %q{HTTP client api for Ruby.} spec.homepage = "https://github.com/ruby/net-http" - spec.required_ruby_version = Gem::Requirement.new(">= 2.6.0") + spec.required_ruby_version = Gem::Requirement.new(">= 2.5.0") spec.licenses = ["Ruby", "BSD-2-Clause"] spec.metadata["homepage_uri"] = spec.homepage diff --git a/test/net/http/test_https.rb b/test/net/http/test_https.rb index e9aee15b..7c9c0480 100644 --- a/test/net/http/test_https.rb +++ b/test/net/http/test_https.rb @@ -45,7 +45,7 @@ def test_get assert_equal($test_net_http_data, res.body) } # TODO: OpenSSL 1.1.1h seems to yield only SERVER_CERT; need to check the incompatibility - certs.zip([CA_CERT, SERVER_CERT][-certs.size..]) do |actual, expected| + certs.zip([CA_CERT, SERVER_CERT][-certs.size..-1]) do |actual, expected| assert_equal(expected.to_der, actual.to_der) end rescue SystemCallError @@ -66,7 +66,7 @@ def test_get_SNI assert_equal($test_net_http_data, res.body) } # TODO: OpenSSL 1.1.1h seems to yield only SERVER_CERT; need to check the incompatibility - certs.zip([CA_CERT, SERVER_CERT][-certs.size..]) do |actual, expected| + certs.zip([CA_CERT, SERVER_CERT][-certs.size..-1]) do |actual, expected| assert_equal(expected.to_der, actual.to_der) end end From 759a540a73ea7fc95f67b6aef5d3d476b814c033 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Rodr=C3=ADguez?= Date: Thu, 25 Mar 2021 12:16:17 +0100 Subject: [PATCH 2/5] bundle update power_assert --- Gemfile.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile.lock b/Gemfile.lock index 67321d2a..6643e96a 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -12,7 +12,7 @@ GEM net-protocol (0.1.0) io-wait timeout - power_assert (1.1.5) + power_assert (2.0.0) rake (13.0.1) test-unit (3.3.5) power_assert From 3a9c23729587972203351ce7c4f36389e579c513 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Rodr=C3=ADguez?= Date: Thu, 25 Mar 2021 12:16:40 +0100 Subject: [PATCH 3/5] Bump locked bundler to 2.2.15 --- Gemfile.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile.lock b/Gemfile.lock index 6643e96a..7750630c 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -30,4 +30,4 @@ DEPENDENCIES webrick BUNDLED WITH - 2.1.4 + 2.2.15 From 0f0975148af41d4ec75dc0bcee283408e8f43856 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Rodr=C3=ADguez?= Date: Thu, 25 Mar 2021 12:17:02 +0100 Subject: [PATCH 4/5] bundle update test-unit --- Gemfile.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile.lock b/Gemfile.lock index 7750630c..9e421eee 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -14,7 +14,7 @@ GEM timeout power_assert (2.0.0) rake (13.0.1) - test-unit (3.3.5) + test-unit (3.4.0) power_assert timeout (0.1.1) uri (0.10.1) From 37c4116aa491cc4ba676f4f2940ad436d02f448e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Rodr=C3=ADguez?= Date: Thu, 25 Mar 2021 12:18:41 +0100 Subject: [PATCH 5/5] Run tests with bundler --- .github/workflows/test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index e9830f37..0af19b7e 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -21,4 +21,4 @@ jobs: gem install bundler --no-document bundle install - name: Run test - run: rake test + run: bundle exec rake test