down 5.5.0 → 5.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +16 -0
- data/README.md +0 -8
- data/down.gemspec +3 -2
- data/lib/down/chunked_io.rb +9 -1
- data/lib/down/net_http.rb +4 -4
- data/lib/down/version.rb +1 -1
- metadata +17 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 5e1ee0b81e91856c59a6c43aaca2b0d310249ab49b96e0eb9b32f76491a35c08
|
|
4
|
+
data.tar.gz: 182fe92d881b17ad97779d86715b8916c5c194f137b3e57bed6ab6b47b25d077
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 9d695a18d0f70d4bd6406e4bc21db7aa992a7ae10d9ccce87e42bccf7175a3ea73f438b4fc766d6c3512e72c3ff8635cc029fe1ee611d30fb2fd0e2c28ef1970
|
|
7
|
+
data.tar.gz: df566a6a80c99016a8cbe382110865c8bbfc1034a5b5e5527051f43181833ed9782deb04c74704a5b001d995793e92f4bca68fddbdce8eee1924005618a38caa
|
data/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,19 @@
|
|
|
1
|
+
## 5.6.0 (2026-04-25)
|
|
2
|
+
|
|
3
|
+
* Require Ruby 3.2+ (@janko)
|
|
4
|
+
|
|
5
|
+
* Return `Down::Chunked#gets(nil, n)` in specified encoding for `IO` compatibility (@janko)
|
|
6
|
+
|
|
7
|
+
* Allow net/http to transparently decompress response bodies again (@janko)
|
|
8
|
+
|
|
9
|
+
* Handle `:auth_on_redirect` for absolute redirects in net/http backend (@janko)
|
|
10
|
+
|
|
11
|
+
* Fix `#pos` not always being updated after `Down::ChunkedIO#gets` (@janko)
|
|
12
|
+
|
|
13
|
+
* Add `#eof` alias to `Down::ChunkedIO#eof?` for `IO` compatibility
|
|
14
|
+
|
|
15
|
+
* Add `#length` alias for `Down::ChunkedIO#size` for `multipart-post` gem compatibility (@janko)
|
|
16
|
+
|
|
1
17
|
## 5.5.0 (2026-03-18)
|
|
2
18
|
|
|
3
19
|
* Add support for http.rb 6.0 (@sferik)
|
data/README.md
CHANGED
|
@@ -473,13 +473,6 @@ its docs for ways to pass additional options.
|
|
|
473
473
|
|
|
474
474
|
## Development
|
|
475
475
|
|
|
476
|
-
Tests require that a [httpbin] server is running locally, which you can do via Docker:
|
|
477
|
-
|
|
478
|
-
```sh
|
|
479
|
-
$ docker pull kennethreitz/httpbin
|
|
480
|
-
$ docker run -p 80:80 kennethreitz/httpbin
|
|
481
|
-
```
|
|
482
|
-
|
|
483
476
|
Then you can run tests:
|
|
484
477
|
|
|
485
478
|
```
|
|
@@ -495,4 +488,3 @@ $ bundle exec rake test
|
|
|
495
488
|
[http.rb]: https://github.com/httprb/http
|
|
496
489
|
[HTTPX]: https://github.com/HoneyryderChuck/httpx
|
|
497
490
|
[Addressable::URI]: https://github.com/sporkmonger/addressable
|
|
498
|
-
[httpbin]: https://github.com/postmanlabs/httpbin
|
data/down.gemspec
CHANGED
|
@@ -4,7 +4,7 @@ Gem::Specification.new do |spec|
|
|
|
4
4
|
spec.name = "down"
|
|
5
5
|
spec.version = Down::VERSION
|
|
6
6
|
|
|
7
|
-
spec.required_ruby_version = ">= 2
|
|
7
|
+
spec.required_ruby_version = ">= 3.2"
|
|
8
8
|
|
|
9
9
|
spec.summary = "Robust streaming downloads using Net::HTTP, http.rb or HTTPX."
|
|
10
10
|
spec.homepage = "https://github.com/janko/down"
|
|
@@ -20,9 +20,10 @@ Gem::Specification.new do |spec|
|
|
|
20
20
|
|
|
21
21
|
spec.add_development_dependency "minitest", "~> 6.0"
|
|
22
22
|
spec.add_development_dependency "mocha", "~> 1.5"
|
|
23
|
+
spec.add_development_dependency "cgi"
|
|
23
24
|
spec.add_development_dependency "rake"
|
|
24
25
|
spec.add_development_dependency "httpx", "~> 1.0", "< 1.4.4"
|
|
25
|
-
spec.add_development_dependency "http",
|
|
26
|
+
spec.add_development_dependency "http", "~> 6.0"
|
|
26
27
|
spec.add_development_dependency "warning"
|
|
27
28
|
spec.add_development_dependency "csv"
|
|
28
29
|
end
|
data/lib/down/chunked_io.rb
CHANGED
|
@@ -42,6 +42,11 @@ module Down
|
|
|
42
42
|
retrieve_chunk # fetch first chunk so that we know whether the file is empty
|
|
43
43
|
end
|
|
44
44
|
|
|
45
|
+
# For compatibility with multipart-post gem.
|
|
46
|
+
def length
|
|
47
|
+
@size
|
|
48
|
+
end
|
|
49
|
+
|
|
45
50
|
# Yields elements of the underlying enumerator.
|
|
46
51
|
def each_chunk
|
|
47
52
|
fail IOError, "closed stream" if closed?
|
|
@@ -105,7 +110,7 @@ module Down
|
|
|
105
110
|
separator = separator_or_limit
|
|
106
111
|
end
|
|
107
112
|
|
|
108
|
-
return read(limit) if separator.nil?
|
|
113
|
+
return read(limit)&.force_encoding(@encoding) if separator.nil?
|
|
109
114
|
|
|
110
115
|
separator = "\n\n" if separator.empty?
|
|
111
116
|
|
|
@@ -124,6 +129,8 @@ module Down
|
|
|
124
129
|
data.clear # deallocate data
|
|
125
130
|
|
|
126
131
|
if extra
|
|
132
|
+
@position -= extra.bytesize
|
|
133
|
+
|
|
127
134
|
if cache
|
|
128
135
|
cache.pos -= extra.bytesize
|
|
129
136
|
else
|
|
@@ -238,6 +245,7 @@ module Down
|
|
|
238
245
|
return false if cache && !cache.eof?
|
|
239
246
|
@buffer.nil? && chunks_depleted?
|
|
240
247
|
end
|
|
248
|
+
alias eof eof?
|
|
241
249
|
|
|
242
250
|
# Implements IO#rewind semantics. Rewinds the Down::ChunkedIO by rewinding
|
|
243
251
|
# the cache and setting the position to the beginning of the file. Raises
|
data/lib/down/net_http.rb
CHANGED
|
@@ -246,6 +246,9 @@ module Down
|
|
|
246
246
|
location = uri + location
|
|
247
247
|
uri.user = nil unless auth_on_redirect
|
|
248
248
|
uri.password = nil unless auth_on_redirect
|
|
249
|
+
elsif auth_on_redirect && (uri.user || uri.password)
|
|
250
|
+
# for absolute redirects, carry over URI credentials since the new location won't have them
|
|
251
|
+
options[:http_basic_authentication] ||= [uri.user, uri.password]
|
|
249
252
|
end
|
|
250
253
|
|
|
251
254
|
net_http_request(location, options, follows_remaining: follows_remaining - 1, auth_on_redirect: auth_on_redirect, &block)
|
|
@@ -281,10 +284,7 @@ module Down
|
|
|
281
284
|
http.read_timeout = options[:read_timeout] if options.key?(:read_timeout)
|
|
282
285
|
http.open_timeout = options[:open_timeout] if options.key?(:open_timeout)
|
|
283
286
|
|
|
284
|
-
|
|
285
|
-
headers["Accept-Encoding"] = "" # Net::HTTP's inflater causes FiberErrors
|
|
286
|
-
|
|
287
|
-
get = Net::HTTP::Get.new(uri, headers)
|
|
287
|
+
get = Net::HTTP::Get.new(uri, options[:headers].to_h)
|
|
288
288
|
|
|
289
289
|
user, password = options[:http_basic_authentication] || [uri.user, uri.password]
|
|
290
290
|
get.basic_auth(user, password) if user || password
|
data/lib/down/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: down
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 5.
|
|
4
|
+
version: 5.6.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Janko Marohnić
|
|
@@ -65,6 +65,20 @@ dependencies:
|
|
|
65
65
|
- - "~>"
|
|
66
66
|
- !ruby/object:Gem::Version
|
|
67
67
|
version: '1.5'
|
|
68
|
+
- !ruby/object:Gem::Dependency
|
|
69
|
+
name: cgi
|
|
70
|
+
requirement: !ruby/object:Gem::Requirement
|
|
71
|
+
requirements:
|
|
72
|
+
- - ">="
|
|
73
|
+
- !ruby/object:Gem::Version
|
|
74
|
+
version: '0'
|
|
75
|
+
type: :development
|
|
76
|
+
prerelease: false
|
|
77
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
78
|
+
requirements:
|
|
79
|
+
- - ">="
|
|
80
|
+
- !ruby/object:Gem::Version
|
|
81
|
+
version: '0'
|
|
68
82
|
- !ruby/object:Gem::Dependency
|
|
69
83
|
name: rake
|
|
70
84
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -172,14 +186,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
172
186
|
requirements:
|
|
173
187
|
- - ">="
|
|
174
188
|
- !ruby/object:Gem::Version
|
|
175
|
-
version: '2
|
|
189
|
+
version: '3.2'
|
|
176
190
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
177
191
|
requirements:
|
|
178
192
|
- - ">="
|
|
179
193
|
- !ruby/object:Gem::Version
|
|
180
194
|
version: '0'
|
|
181
195
|
requirements: []
|
|
182
|
-
rubygems_version:
|
|
196
|
+
rubygems_version: 4.0.3
|
|
183
197
|
specification_version: 4
|
|
184
198
|
summary: Robust streaming downloads using Net::HTTP, http.rb or HTTPX.
|
|
185
199
|
test_files: []
|