down 5.2.1 → 5.2.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1095c57cf19a452627af18374bc2a5b8db488edf1b0cb54ff52463bb3cd80cc9
4
- data.tar.gz: 6c2d515848f66b359caa03270d8ab7e9250468ee945f07d954f71dfeb9aea157
3
+ metadata.gz: 5a49023a41da71285f7f87570bc92850fa41291f9efa37a0c34b54ed8d1c1e1a
4
+ data.tar.gz: 87d0aee326bb8752ff853046d3c1bbc32364d8d379ee6fb3bfd55e46fd60532e
5
5
  SHA512:
6
- metadata.gz: b4dd38131e47339dae85cf1ed0b2cf903de034a25a262b10588590774fe5904d46d8ee59415dbaa7a8ba997039da09339f7c47f22666d4fe0ed53da222a14172
7
- data.tar.gz: a07b8d1eb3a4621f92d5547e45960861cd3000f609bc171631cc88138980715545463244ce8e4a1479c1bab309f1c1e76b1401c0b9d267f486784fc8355a7a97
6
+ metadata.gz: b70f1f09562267bc15ef7ebf54b94e843e440a10dc4aed1c7e39cd55d545895f439f538416cdb9899b74ff803d5e8e749c734050261302848158f99937e7dd81
7
+ data.tar.gz: 9105364a02865aa4c93e5384d6df969277a158a94eb9414b0b6189685a4a5be7bf020ec00437fd2402f92a0aba9f2c3f545b497f71850604bd3af83c79ab6da4
data/CHANGELOG.md CHANGED
@@ -1,3 +1,9 @@
1
+ ## 5.2.2 (2021-05-27)
2
+
3
+ * Add info about received content length in `Down::TooLarge` error (@evheny0)
4
+
5
+ * Relax http.rb constraint to allow versions 5.x (@mgrunberg)
6
+
1
7
  ## 5.2.1 (2021-04-26)
2
8
 
3
9
  * Raise `Down::NotModified` on 304 response status in `Down::NetHttp#open` (@ellafeldmann)
data/README.md CHANGED
@@ -371,8 +371,8 @@ net_http.open("http://example.com/image.jpg")
371
371
  The `Down::Http` backend implements downloads using the [http.rb] gem.
372
372
 
373
373
  ```rb
374
- gem "down", "~> 4.4"
375
- gem "http", "~> 4.0"
374
+ gem "down", "~> 5.0"
375
+ gem "http", "~> 5.0"
376
376
  ```
377
377
  ```rb
378
378
  require "down/http"
data/down.gemspec CHANGED
@@ -20,7 +20,12 @@ Gem::Specification.new do |spec|
20
20
  spec.add_development_dependency "minitest", "~> 5.8"
21
21
  spec.add_development_dependency "mocha", "~> 1.5"
22
22
  spec.add_development_dependency "rake"
23
- spec.add_development_dependency "http", "~> 4.3"
23
+ # http 5.0 drop support of ruby 2.3 and 2.4. We still support those versions.
24
+ if RUBY_VERSION >= "2.5"
25
+ spec.add_development_dependency "http", "~> 5.0"
26
+ else
27
+ spec.add_development_dependency "http", "~> 4.3"
28
+ end
24
29
  spec.add_development_dependency "posix-spawn" unless RUBY_ENGINE == "jruby"
25
30
  spec.add_development_dependency "http_parser.rb"
26
31
  spec.add_development_dependency "docker-api"
data/lib/down/http.rb CHANGED
@@ -1,6 +1,6 @@
1
1
  # frozen-string-literal: true
2
2
 
3
- gem "http", ">= 2.1.0", "< 5"
3
+ gem "http", ">= 2.1.0", "< 6"
4
4
 
5
5
  require "http"
6
6
 
@@ -31,7 +31,7 @@ module Down
31
31
  content_length_proc.call(response.content_length) if content_length_proc && response.content_length
32
32
 
33
33
  if max_size && response.content_length && response.content_length > max_size
34
- raise Down::TooLarge, "file is too large (max is #{max_size/1024/1024}MB)"
34
+ raise Down::TooLarge, "file is too large (#{response.content_length/1024/1024}MB, max is #{max_size/1024/1024}MB)"
35
35
  end
36
36
 
37
37
  extname = File.extname(response.uri.path)
@@ -44,7 +44,7 @@ module Down
44
44
  progress_proc.call(tempfile.size) if progress_proc
45
45
 
46
46
  if max_size && tempfile.size > max_size
47
- raise Down::TooLarge, "file is too large (max is #{max_size/1024/1024}MB)"
47
+ raise Down::TooLarge, "file is too large (#{tempfile.size/1024/1024}MB, max is #{max_size/1024/1024}MB)"
48
48
  end
49
49
  end
50
50
 
data/lib/down/net_http.rb CHANGED
@@ -49,13 +49,13 @@ module Down
49
49
  open_uri_options = {
50
50
  content_length_proc: proc { |size|
51
51
  if size && max_size && size > max_size
52
- raise Down::TooLarge, "file is too large (max is #{max_size/1024/1024}MB)"
52
+ raise Down::TooLarge, "file is too large (#{size/1024/1024}MB, max is #{max_size/1024/1024}MB)"
53
53
  end
54
54
  content_length_proc.call(size) if content_length_proc
55
55
  },
56
56
  progress_proc: proc { |current_size|
57
57
  if max_size && current_size > max_size
58
- raise Down::TooLarge, "file is too large (max is #{max_size/1024/1024}MB)"
58
+ raise Down::TooLarge, "file is too large (#{current_size/1024/1024}MB, max is #{max_size/1024/1024}MB)"
59
59
  end
60
60
  progress_proc.call(current_size) if progress_proc
61
61
  },
data/lib/down/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen-string-literal: true
2
2
 
3
3
  module Down
4
- VERSION = "5.2.1"
4
+ VERSION = "5.2.2"
5
5
  end
data/lib/down/wget.rb CHANGED
@@ -35,7 +35,7 @@ module Down
35
35
  content_length_proc.call(io.size) if content_length_proc && io.size
36
36
 
37
37
  if max_size && io.size && io.size > max_size
38
- raise Down::TooLarge, "file is too large (max is #{max_size/1024/1024}MB)"
38
+ raise Down::TooLarge, "file is too large (#{io.size/1024/1024}MB, max is #{max_size/1024/1024}MB)"
39
39
  end
40
40
 
41
41
  extname = File.extname(URI(url).path)
@@ -49,7 +49,7 @@ module Down
49
49
  progress_proc.call(tempfile.size) if progress_proc
50
50
 
51
51
  if max_size && tempfile.size > max_size
52
- raise Down::TooLarge, "file is too large (max is #{max_size/1024/1024}MB)"
52
+ raise Down::TooLarge, "file is too large (#{tempfile.size/1024/1024}MB, max is #{max_size/1024/1024}MB)"
53
53
  end
54
54
  end
55
55
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: down
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.2.1
4
+ version: 5.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Janko Marohnić
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-04-26 00:00:00.000000000 Z
11
+ date: 2021-05-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: addressable
@@ -72,14 +72,14 @@ dependencies:
72
72
  requirements:
73
73
  - - "~>"
74
74
  - !ruby/object:Gem::Version
75
- version: '4.3'
75
+ version: '5.0'
76
76
  type: :development
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
80
  - - "~>"
81
81
  - !ruby/object:Gem::Version
82
- version: '4.3'
82
+ version: '5.0'
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: posix-spawn
85
85
  requirement: !ruby/object:Gem::Requirement
@@ -175,7 +175,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
175
175
  - !ruby/object:Gem::Version
176
176
  version: '0'
177
177
  requirements: []
178
- rubygems_version: 3.2.3
178
+ rubygems_version: 3.2.15
179
179
  signing_key:
180
180
  specification_version: 4
181
181
  summary: Robust streaming downloads using Net::HTTP, HTTP.rb or wget.