down 5.2.0 → 5.2.1

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d48d573f542ac195a462c3bab0ebe1546c8dd78b0a5210eed1d1fed1f66b674f
4
- data.tar.gz: 492b997d3e889475544267d753df5fb900d28728131602e6950a57dfacb7842c
3
+ metadata.gz: 1095c57cf19a452627af18374bc2a5b8db488edf1b0cb54ff52463bb3cd80cc9
4
+ data.tar.gz: 6c2d515848f66b359caa03270d8ab7e9250468ee945f07d954f71dfeb9aea157
5
5
  SHA512:
6
- metadata.gz: e0fa81667368033a51588f37ae8a5fca2198ce341268e5c6fc24a8241be1af7ce88cd4bc7e8076f69af41b3e0318a4c8733c28a9d173dcdae750b59a9e2401e6
7
- data.tar.gz: 568632e1c75daa84a838675ae49ceb844a4500e781b8303cf3c1259974b1d01a26e3d2420e08d0d544c81ef312dc790cafdd47fcdc2ed6f3a853b91f8a99bd48
6
+ metadata.gz: b4dd38131e47339dae85cf1ed0b2cf903de034a25a262b10588590774fe5904d46d8ee59415dbaa7a8ba997039da09339f7c47f22666d4fe0ed53da222a14172
7
+ data.tar.gz: a07b8d1eb3a4621f92d5547e45960861cd3000f609bc171631cc88138980715545463244ce8e4a1479c1bab309f1c1e76b1401c0b9d267f486784fc8355a7a97
data/CHANGELOG.md CHANGED
@@ -1,8 +1,12 @@
1
+ ## 5.2.1 (2021-04-26)
2
+
3
+ * Raise `Down::NotModified` on 304 response status in `Down::NetHttp#open` (@ellafeldmann)
4
+
1
5
  ## 5.2.0 (2020-09-20)
2
6
 
3
7
  * Add `:uri_normalizer` option to `Down::NetHttp` (@janko)
4
8
 
5
- * Add `:http_basic_authentication` option to `Down::NetHttp#download` (@janko)
9
+ * Add `:http_basic_authentication` option to `Down::NetHttp#open` (@janko)
6
10
 
7
11
  * Fix uninitialized instance variables warnings in `Down::ChunkedIO` (@janko)
8
12
 
data/README.md CHANGED
@@ -212,6 +212,7 @@ the `Down::Error` subclasses. This is Down's exception hierarchy:
212
212
  * `Down::TooLarge`
213
213
  * `Down::InvalidUrl`
214
214
  * `Down::TooManyRedirects`
215
+ * `Down::NotModified`
215
216
  * `Down::ResponseError`
216
217
  * `Down::ClientError`
217
218
  * `Down::NotFound`
data/lib/down/errors.rb CHANGED
@@ -13,6 +13,9 @@ module Down
13
13
  # raised when the number of redirects was larger than the specified maximum
14
14
  class TooManyRedirects < Error; end
15
15
 
16
+ # raised when the requested resource has not been modified
17
+ class NotModified < Error; end
18
+
16
19
  # raised when response returned 4xx or 5xx response
17
20
  class ResponseError < Error
18
21
  attr_reader :response
data/lib/down/net_http.rb CHANGED
@@ -216,7 +216,9 @@ module Down
216
216
  request_error!(exception)
217
217
  end
218
218
 
219
- if response.is_a?(Net::HTTPRedirection)
219
+ if response.is_a?(Net::HTTPNotModified)
220
+ raise Down::NotModified
221
+ elsif response.is_a?(Net::HTTPRedirection)
220
222
  raise Down::TooManyRedirects if follows_remaining == 0
221
223
 
222
224
  # fail if redirect URI is not a valid http or https URL
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.0"
4
+ VERSION = "5.2.1"
5
5
  end
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.0
4
+ version: 5.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Janko Marohnić
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-09-20 00:00:00.000000000 Z
11
+ date: 2021-04-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: addressable
@@ -136,7 +136,7 @@ dependencies:
136
136
  - - ">="
137
137
  - !ruby/object:Gem::Version
138
138
  version: '0'
139
- description:
139
+ description:
140
140
  email:
141
141
  - janko.marohnic@gmail.com
142
142
  executables: []
@@ -160,7 +160,7 @@ homepage: https://github.com/janko/down
160
160
  licenses:
161
161
  - MIT
162
162
  metadata: {}
163
- post_install_message:
163
+ post_install_message:
164
164
  rdoc_options: []
165
165
  require_paths:
166
166
  - lib
@@ -175,8 +175,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
175
175
  - !ruby/object:Gem::Version
176
176
  version: '0'
177
177
  requirements: []
178
- rubygems_version: 3.1.1
179
- signing_key:
178
+ rubygems_version: 3.2.3
179
+ signing_key:
180
180
  specification_version: 4
181
181
  summary: Robust streaming downloads using Net::HTTP, HTTP.rb or wget.
182
182
  test_files: []