From fa65925c0998ee0cc6cc6644c44792c9e742a644 Mon Sep 17 00:00:00 2001 From: Mark Bumiller Date: Thu, 19 Feb 2026 07:57:19 -0500 Subject: [PATCH 1/6] Add latest ruby - trying to fix build --- .github/workflows/ci.yml | 1 + down.gemspec | 1 + lib/down/net_http.rb | 6 +++--- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 605363e..533e317 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -22,6 +22,7 @@ jobs: - "3.2" - "3.3" - "3.4" + - "4.0" - "jruby-9.4" services: diff --git a/down.gemspec b/down.gemspec index a2092f3..97a2b4c 100644 --- a/down.gemspec +++ b/down.gemspec @@ -16,6 +16,7 @@ Gem::Specification.new do |spec| spec.require_path = "lib" spec.add_dependency "addressable", "~> 2.8" + spec.add_dependency "base64", "~> 0.3" spec.add_development_dependency "minitest", "~> 5.8" spec.add_development_dependency "mocha", "~> 1.5" diff --git a/lib/down/net_http.rb b/lib/down/net_http.rb index 996182a..9e773f8 100644 --- a/lib/down/net_http.rb +++ b/lib/down/net_http.rb @@ -93,7 +93,7 @@ def download(url, *args, **options) uri.password = nil end - open_uri_file = open_uri(uri, open_uri_options, follows_remaining: max_redirects, auth_on_redirect: ) + open_uri_file = open_uri(uri, open_uri_options, follows_remaining: max_redirects, auth_on_redirect: auth_on_redirect) # Handle the fact that open-uri returns StringIOs for small files. extname = extension ? ".#{extension}" : File.extname(open_uri_file.base_uri.path) @@ -117,7 +117,7 @@ def open(url, *args, **options) # Create a Fiber that halts when response headers are received. request = Fiber.new do - net_http_request(uri, options, follows_remaining: max_redirects, auth_on_redirect:) do |response| + net_http_request(uri, options, follows_remaining: max_redirects, auth_on_redirect: auth_on_redirect) do |response| Fiber.yield response end end @@ -249,7 +249,7 @@ def net_http_request(uri, options, follows_remaining:, auth_on_redirect:, &block uri.password = nil unless auth_on_redirect end - net_http_request(location, options, follows_remaining: follows_remaining - 1, auth_on_redirect:, &block) + net_http_request(location, options, follows_remaining: follows_remaining - 1, auth_on_redirect: auth_on_redirect, &block) end end From 305270f1b3ef9bca70a9659e469de5c00c04f6ff Mon Sep 17 00:00:00 2001 From: Mark Bumiller Date: Thu, 19 Feb 2026 08:06:11 -0500 Subject: [PATCH 2/6] pinning httpx to prevent failures temp hack to make sure tests pass on all rubies --- down.gemspec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/down.gemspec b/down.gemspec index 97a2b4c..2829a56 100644 --- a/down.gemspec +++ b/down.gemspec @@ -21,7 +21,7 @@ Gem::Specification.new do |spec| spec.add_development_dependency "minitest", "~> 5.8" spec.add_development_dependency "mocha", "~> 1.5" spec.add_development_dependency "rake" - spec.add_development_dependency "httpx", RUBY_VERSION >= "2.7" ? "~> 1.0" : "~> 0.24" + spec.add_development_dependency "httpx", RUBY_VERSION >= "2.7" ? "~> 1.0" : "~> 0.24", "<1.4.4" spec.add_development_dependency "http", RUBY_VERSION >= "2.5" ? "~> 5.0" : "~> 4.3" spec.add_development_dependency "warning" spec.add_development_dependency "csv" From 2755c217900311c87fee6769cdd2d644e211b2a9 Mon Sep 17 00:00:00 2001 From: Mark Bumiller Date: Thu, 19 Feb 2026 08:16:04 -0500 Subject: [PATCH 3/6] build fix * unpin httpx * code to support * remove older rubies --- .github/workflows/ci.yml | 3 --- down.gemspec | 6 +++--- lib/down/httpx.rb | 8 ++++++-- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 533e317..855d92e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -13,9 +13,6 @@ jobs: fail-fast: false matrix: ruby: - - "2.4" - - "2.5" - - "2.6" - "2.7" - "3.0" - "3.1" diff --git a/down.gemspec b/down.gemspec index 2829a56..69151a9 100644 --- a/down.gemspec +++ b/down.gemspec @@ -4,7 +4,7 @@ Gem::Specification.new do |spec| spec.name = "down" spec.version = Down::VERSION - spec.required_ruby_version = ">= 2.4" + spec.required_ruby_version = ">= 2.7" spec.summary = "Robust streaming downloads using Net::HTTP, http.rb or HTTPX." spec.homepage = "https://github.com/janko/down" @@ -21,8 +21,8 @@ Gem::Specification.new do |spec| spec.add_development_dependency "minitest", "~> 5.8" spec.add_development_dependency "mocha", "~> 1.5" spec.add_development_dependency "rake" - spec.add_development_dependency "httpx", RUBY_VERSION >= "2.7" ? "~> 1.0" : "~> 0.24", "<1.4.4" - spec.add_development_dependency "http", RUBY_VERSION >= "2.5" ? "~> 5.0" : "~> 4.3" + spec.add_development_dependency "httpx", "~> 1.0" + spec.add_development_dependency "http", "~> 5.0" spec.add_development_dependency "warning" spec.add_development_dependency "csv" end diff --git a/lib/down/httpx.rb b/lib/down/httpx.rb index 73a60ac..1c001fc 100644 --- a/lib/down/httpx.rb +++ b/lib/down/httpx.rb @@ -105,7 +105,11 @@ def open(url, rewindable: true, **options, &block) # Yields chunks of the response body to the block. def stream_body(response, &block) - response.each(&block) + if response.respond_to?(:each) + response.each(&block) + else + response.body.each(&block) + end rescue => exception request_error!(exception) end @@ -130,7 +134,7 @@ def send_request(client, method, url, **options, &block) end client = block.call(client) if block - client.request(method.to_s.upcase, uri, stream: true, **options) + client.request(method.to_s.upcase, uri, **options, stream: true) rescue => exception request_error!(exception) end From bbfeba985f272f4bb42b0d02cdc961be3812260e Mon Sep 17 00:00:00 2001 From: Mark Bumiller Date: Thu, 19 Feb 2026 08:19:01 -0500 Subject: [PATCH 4/6] back to pinning --- down.gemspec | 2 +- lib/down/httpx.rb | 6 +----- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/down.gemspec b/down.gemspec index 69151a9..2b38e8c 100644 --- a/down.gemspec +++ b/down.gemspec @@ -21,7 +21,7 @@ Gem::Specification.new do |spec| spec.add_development_dependency "minitest", "~> 5.8" spec.add_development_dependency "mocha", "~> 1.5" spec.add_development_dependency "rake" - spec.add_development_dependency "httpx", "~> 1.0" + spec.add_development_dependency "httpx", "~> 1.0", "< 1.4.4" spec.add_development_dependency "http", "~> 5.0" spec.add_development_dependency "warning" spec.add_development_dependency "csv" diff --git a/lib/down/httpx.rb b/lib/down/httpx.rb index 1c001fc..899fb7b 100644 --- a/lib/down/httpx.rb +++ b/lib/down/httpx.rb @@ -105,11 +105,7 @@ def open(url, rewindable: true, **options, &block) # Yields chunks of the response body to the block. def stream_body(response, &block) - if response.respond_to?(:each) - response.each(&block) - else - response.body.each(&block) - end + response.each(&block) rescue => exception request_error!(exception) end From 02ad09aed51a9affdb51c0f5c3cf649728668f6e Mon Sep 17 00:00:00 2001 From: Mark Bumiller Date: Thu, 19 Feb 2026 08:19:47 -0500 Subject: [PATCH 5/6] fix missing revert --- lib/down/httpx.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/down/httpx.rb b/lib/down/httpx.rb index 899fb7b..116f31f 100644 --- a/lib/down/httpx.rb +++ b/lib/down/httpx.rb @@ -130,7 +130,7 @@ def send_request(client, method, url, **options, &block) end client = block.call(client) if block - client.request(method.to_s.upcase, uri, **options, stream: true) + client.request(method.to_s.upcase, uri,stream: true, **options) rescue => exception request_error!(exception) end From ed0cc80ad76db07859774d8cf30188aa6515c536 Mon Sep 17 00:00:00 2001 From: Mark Bumiller Date: Thu, 19 Feb 2026 08:20:07 -0500 Subject: [PATCH 6/6] fix --- lib/down/httpx.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/down/httpx.rb b/lib/down/httpx.rb index 116f31f..73a60ac 100644 --- a/lib/down/httpx.rb +++ b/lib/down/httpx.rb @@ -130,7 +130,7 @@ def send_request(client, method, url, **options, &block) end client = block.call(client) if block - client.request(method.to_s.upcase, uri,stream: true, **options) + client.request(method.to_s.upcase, uri, stream: true, **options) rescue => exception request_error!(exception) end