down 5.4.0 → 5.4.1

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: e0544a70de3afab2a00c68df6923572a5533f05a0964b8c5186728019d04e55b
4
- data.tar.gz: 3474da6a6c7a182aa02deb72139002ebf97ac98bee9c4a833de2b0413e373924
3
+ metadata.gz: 5e25eaeebd866fe407bcb39282937568f1c5489feb0b3ac479d92c2b19d8920c
4
+ data.tar.gz: 151e9d28039d7698a32e25ff7b1dae39c32e871ed295809f11a586c5f6221bcc
5
5
  SHA512:
6
- metadata.gz: 64d22c0a25ddf60f2dea37cb03264ec5770a8c7877fb7a843052abca4b043ba9d2d0c8eed830fc2cec97bb852338b114e2907c357aaf4b68aad26a6860459f67
7
- data.tar.gz: 992209a7e4201cab464958bac0960ba4a6dc0344cd410b7ceaec2a02b89ebc1bd876396349204bb0bfe175a279fbdb41900c9fee85eee7e98d74eec7afa2e7a0
6
+ metadata.gz: 3ee68adf94333adcb92f9453ec0c65e23437458e6586f0078471ba8b5691d3ca0b5e377656a16fb6750ee585f255cd5af38218dbf873fd6b7e5e9ec1997a8997
7
+ data.tar.gz: 49f80f1b039ba67e86e1515aac927382249f2bdca33cb8d71e8be8753d82d6f69c56d010be4521c2e661a51662adb698478348949fc01ac22e1419212cfc640c
data/CHANGELOG.md CHANGED
@@ -1,3 +1,13 @@
1
+ ## 5.4.1 (2023-05-20)
2
+
3
+ * Handle additional params in `Content-Disposition` header (@janko)
4
+
5
+ * Add ability to detect response URI when using net/http (@aglushkov)
6
+
7
+ * Avoid deprecation warning in HTTPX (@ollym)
8
+
9
+ * Handle unknown response status in net/http backend (@janko)
10
+
1
11
  ## 5.4.0 (2022-12-26)
2
12
 
3
13
  * Add new HTTPX backend, which supports HTTP/2 protocol among other features (@HoneyryderChuck)
data/README.md CHANGED
@@ -511,17 +511,6 @@ wget.download("http://nature.com/forest.jpg")
511
511
  wget.open("http://nature.com/forest.jpg")
512
512
  ```
513
513
 
514
- ## Supported Ruby versions
515
-
516
- * MRI 2.3
517
- * MRI 2.4
518
- * MRI 2.5
519
- * MRI 2.6
520
- * MRI 2.7
521
- * MRI 3.0
522
- * MRI 3.1
523
- * JRuby 9.3
524
-
525
514
  ## Development
526
515
 
527
516
  Tests require that a [httpbin] server is running locally, which you can do via Docker:
data/lib/down/httpx.rb CHANGED
@@ -128,7 +128,7 @@ module Down
128
128
  end
129
129
  client = block.call(client) if block
130
130
 
131
- client.request(method, uri, stream: true, **options)
131
+ client.request(method.to_s.upcase, uri, stream: true, **options)
132
132
  rescue => exception
133
133
  request_error!(exception)
134
134
  end
@@ -172,4 +172,4 @@ module Down
172
172
  end
173
173
  end
174
174
  end
175
- end
175
+ end
data/lib/down/net_http.rb CHANGED
@@ -270,7 +270,7 @@ module Down
270
270
  headers = options[:headers].to_h
271
271
  headers["Accept-Encoding"] = "" # Net::HTTP's inflater causes FiberErrors
272
272
 
273
- get = Net::HTTP::Get.new(uri.request_uri, headers)
273
+ get = Net::HTTP::Get.new(uri, headers)
274
274
 
275
275
  user, password = options[:http_basic_authentication] || [uri.user, uri.password]
276
276
  get.basic_auth(user, password) if user || password
@@ -312,13 +312,14 @@ module Down
312
312
  # rebuild the Net::HTTP response object.
313
313
  def rebuild_response_from_open_uri_exception(exception)
314
314
  code, message = exception.io.status
315
+ message ||= "Unknown"
315
316
 
316
317
  response_class = Net::HTTPResponse::CODE_TO_OBJ.fetch(code) do |c|
317
318
  Net::HTTPResponse::CODE_CLASS_TO_OBJ.fetch(c[0]) do
318
319
  Net::HTTPUnknownResponse
319
320
  end
320
321
  end
321
- response = response_class.new(nil, code, message)
322
+ response = response_class.new(nil, code, message)
322
323
 
323
324
  exception.io.metas.each do |name, values|
324
325
  values.each { |value| response.add_field(name, value) }
data/lib/down/utils.rb CHANGED
@@ -11,7 +11,7 @@ module Down
11
11
  escaped_filename =
12
12
  content_disposition[/filename\*=UTF-8''(\S+)/, 1] ||
13
13
  content_disposition[/filename="([^"]*)"/, 1] ||
14
- content_disposition[/filename=(\S+)/, 1]
14
+ content_disposition[/filename=([^\s;]+)/, 1]
15
15
 
16
16
  filename = CGI.unescape(escaped_filename.to_s)
17
17
 
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.4.0"
4
+ VERSION = "5.4.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.4.0
4
+ version: 5.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Janko Marohnić
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-12-26 00:00:00.000000000 Z
11
+ date: 2023-05-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: addressable
@@ -182,7 +182,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
182
182
  - !ruby/object:Gem::Version
183
183
  version: '0'
184
184
  requirements: []
185
- rubygems_version: 3.4.1
185
+ rubygems_version: 3.4.12
186
186
  signing_key:
187
187
  specification_version: 4
188
188
  summary: Robust streaming downloads using Net::HTTP, HTTP.rb or wget.