down 4.8.0 → 4.8.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: 3d16d04f8312202b900d1384a3b859ffa9020eb1e4b00a83ad74f49d0211953d
4
- data.tar.gz: 2b473d352ee773333efe32bbd11d38597c3bf3edc66d1808c9888de3d0cc09cf
3
+ metadata.gz: ab86935222e38ea1981821660b1ae90ff71a4a739706468d2c7bfaadd48b4956
4
+ data.tar.gz: 8c8b1245a41f426e4ecd4c378c1bd3ed2ac967b92b58f421c3ea6dc9bee78c2e
5
5
  SHA512:
6
- metadata.gz: 93016da86cad0833589bb4a31068181675bb16a22d94de9332650782cea764b1ea815685202b8a8eea88dedff89b8f35cfd70f884104739437589adffab4b76b
7
- data.tar.gz: 4fbc673a14247f63e0616e0b87d4f5b6ad038dc2eecb476725a2d0c74424101c22a28d16700418979418b0b9f4c1d378e2c00cb6f6c9b91f1412bcd5ee36c890
6
+ metadata.gz: 73bd4f1f52e1791171b9ed3d68b50d4ac294e12de2bb947df04d3fffb2bb960904ff35c5f89d158add762b137652818720c0ea05ac41ebc119d7d34d57e5cbdb
7
+ data.tar.gz: d0b0f7c9e3ef8e602beeb7ef8b3216c090c863ea1434c8cf40096da6833546aa525cc1b99b3b448ed92d70494d0e25f6d0df72dcf286b59c0b335c9fcd6885ac
@@ -1,170 +1,176 @@
1
+ ## 4.8.1 (2019-05-01)
2
+
3
+ * Make `ChunkedIO#read`/`#readpartial` with length always return strings in binary encoding (@janko)
4
+
5
+ * In `ChunkedIO#gets` respect the limit argument when separator is nil (@edlebert)
6
+
1
7
  ## 4.8.0 (2018-12-19)
2
8
 
3
- * Prefer UTF-8 filenames in `Content-Disposition` header for `Tempfile#original_filename` (@janko-m)
9
+ * Prefer UTF-8 filenames in `Content-Disposition` header for `Tempfile#original_filename` (@janko)
4
10
 
5
- * Make the internal Tempfile of `Down::ChunkedIO` inaccessible to outside programs (@janko-m)
11
+ * Make the internal Tempfile of `Down::ChunkedIO` inaccessible to outside programs (@janko)
6
12
 
7
13
  ## 4.7.0 (2018-11-18)
8
14
 
9
- * Allow request headers to be passed via `:headers` to `Down::NetHttp#download` and `#open` (@janko-m)
15
+ * Allow request headers to be passed via `:headers` to `Down::NetHttp#download` and `#open` (@janko)
10
16
 
11
17
  ## 4.6.1 (2018-10-24)
12
18
 
13
- * Release HTTP.rb version constraint to allow HTTP.rb 4.x (@janko-m)
19
+ * Release HTTP.rb version constraint to allow HTTP.rb 4.x (@janko)
14
20
 
15
21
  ## 4.6.0 (2018-09-29)
16
22
 
17
23
  * Ensure URLs are properly encoded in `NetHttp#download` and `#open` using Addressable (@linyaoli)
18
24
 
19
- * Raise `ResponseError` with clear message when redirect URI was invalid in Down::NetHttp (@janko-m)
25
+ * Raise `ResponseError` with clear message when redirect URI was invalid in Down::NetHttp (@janko)
20
26
 
21
27
  ## 4.5.0 (2018-05-11)
22
28
 
23
- * Deprecate passing an `HTTP::Client` object to `Down::Http#initialize` (@janko-m)
29
+ * Deprecate passing an `HTTP::Client` object to `Down::Http#initialize` (@janko)
24
30
 
25
- * Add ability to pass a block to `Down::Http#initialize` for extending default options (@janko-m)
31
+ * Add ability to pass a block to `Down::Http#initialize` for extending default options (@janko)
26
32
 
27
- * Return empty string when length is zero in `ChunkedIO#read` and `ChunkedIO#readpartial` (@janko-m)
33
+ * Return empty string when length is zero in `ChunkedIO#read` and `ChunkedIO#readpartial` (@janko)
28
34
 
29
- * Make `posix-spawn` optional (@janko-m)
35
+ * Make `posix-spawn` optional (@janko)
30
36
 
31
37
  ## 4.4.0 (2018-04-12)
32
38
 
33
- * Add `:method` option to `Down::Http` for specifying the request method (@janko-m)
39
+ * Add `:method` option to `Down::Http` for specifying the request method (@janko)
34
40
 
35
- * Set default timeout of 30 for each operation to all backends (@janko-m)
41
+ * Set default timeout of 30 for each operation to all backends (@janko)
36
42
 
37
43
  ## 4.3.0 (2018-03-11)
38
44
 
39
- * Accept CLI arguments as a list of symbols in `Down::Wget#download` (@janko-m)
45
+ * Accept CLI arguments as a list of symbols in `Down::Wget#download` (@janko)
40
46
 
41
- * Avoid potential URL parsing errors in `Down::Http::DownloadedFile#filename_from_url` (@janko-m)
47
+ * Avoid potential URL parsing errors in `Down::Http::DownloadedFile#filename_from_url` (@janko)
42
48
 
43
- * Make memory usage of `Down::Wget#download` constant (@janko-m)
49
+ * Make memory usage of `Down::Wget#download` constant (@janko)
44
50
 
45
- * Add `:destination` option to `Down.download` for specifying download destination (@janko-m)
51
+ * Add `:destination` option to `Down.download` for specifying download destination (@janko)
46
52
 
47
53
  ## 4.2.1 (2018-01-29)
48
54
 
49
- * Reduce memory allocation in `Down::ChunkedIO` by 10x when buffer string is used (@janko-m)
55
+ * Reduce memory allocation in `Down::ChunkedIO` by 10x when buffer string is used (@janko)
50
56
 
51
57
  * Reduce memory allocation in `Down::Http.download` by 10x.
52
58
 
53
59
  ## 4.2.0 (2017-12-22)
54
60
 
55
- * Handle `:max_redirects` in `Down::NetHttp#open` and follow up to 2 redirects by default (@janko-m)
61
+ * Handle `:max_redirects` in `Down::NetHttp#open` and follow up to 2 redirects by default (@janko)
56
62
 
57
63
  ## 4.1.1 (2017-10-15)
58
64
 
59
- * Raise all system call exceptions as `Down::ConnectionError` in `Down::NetHttp` (@janko-m)
65
+ * Raise all system call exceptions as `Down::ConnectionError` in `Down::NetHttp` (@janko)
60
66
 
61
- * Raise `Errno::ETIMEDOUT` as `Down::TimeoutError` in `Down::NetHttp` (@janko-m)
67
+ * Raise `Errno::ETIMEDOUT` as `Down::TimeoutError` in `Down::NetHttp` (@janko)
62
68
 
63
- * Raise `Addressable::URI::InvalidURIError` as `Down::InvalidUrl` in `Down::Http` (@janko-m)
69
+ * Raise `Addressable::URI::InvalidURIError` as `Down::InvalidUrl` in `Down::Http` (@janko)
64
70
 
65
71
  ## 4.1.0 (2017-08-29)
66
72
 
67
- * Fix `FiberError` occurring on `Down::NetHttp.open` when response is chunked and gzipped (@janko-m)
73
+ * Fix `FiberError` occurring on `Down::NetHttp.open` when response is chunked and gzipped (@janko)
68
74
 
69
- * Use a default `User-Agent` in `Down::NetHttp.open` (@janko-m)
75
+ * Use a default `User-Agent` in `Down::NetHttp.open` (@janko)
70
76
 
71
- * Fix raw read timeout error sometimes being raised instead of `Down::TimeoutError` in `Down.open` (@janko-m)
77
+ * Fix raw read timeout error sometimes being raised instead of `Down::TimeoutError` in `Down.open` (@janko)
72
78
 
73
- * `Down::ChunkedIO` can now be parsed by the CSV Ruby standard library (@janko-m)
79
+ * `Down::ChunkedIO` can now be parsed by the CSV Ruby standard library (@janko)
74
80
 
75
- * Implement `Down::ChunkedIO#gets` (@janko-m)
81
+ * Implement `Down::ChunkedIO#gets` (@janko)
76
82
 
77
- * Implement `Down::ChunkedIO#pos` (@janko-m)
83
+ * Implement `Down::ChunkedIO#pos` (@janko)
78
84
 
79
85
  ## 4.0.1 (2017-07-08)
80
86
 
81
- * Load and assign the `NetHttp` backend immediately on `require "down"` (@janko-m)
87
+ * Load and assign the `NetHttp` backend immediately on `require "down"` (@janko)
82
88
 
83
- * Remove undocumented `Down::ChunkedIO#backend=` that was added in 4.0.0 to avoid confusion (@janko-m)
89
+ * Remove undocumented `Down::ChunkedIO#backend=` that was added in 4.0.0 to avoid confusion (@janko)
84
90
 
85
91
  ## 4.0.0 (2017-06-24)
86
92
 
87
- * Don't apply `Down.download` and `Down.open` overrides when loading a backend (@janko-m)
93
+ * Don't apply `Down.download` and `Down.open` overrides when loading a backend (@janko)
88
94
 
89
- * Remove `Down::Http.client` attribute accessor (@janko-m)
95
+ * Remove `Down::Http.client` attribute accessor (@janko)
90
96
 
91
- * Make `Down::NetHttp`, `Down::Http`, and `Down::Wget` classes instead of modules (@janko-m)
97
+ * Make `Down::NetHttp`, `Down::Http`, and `Down::Wget` classes instead of modules (@janko)
92
98
 
93
- * Remove `Down.copy_to_tempfile` (@janko-m)
99
+ * Remove `Down.copy_to_tempfile` (@janko)
94
100
 
95
- * Add Wget backend (@janko-m)
101
+ * Add Wget backend (@janko)
96
102
 
97
- * Add `:content_length_proc` and `:progress_proc` to the HTTP.rb backend (@janko-m)
103
+ * Add `:content_length_proc` and `:progress_proc` to the HTTP.rb backend (@janko)
98
104
 
99
- * Halve string allocations in `Down::ChunkedIO#readpartial` when buffer string is not used (@janko-m)
105
+ * Halve string allocations in `Down::ChunkedIO#readpartial` when buffer string is not used (@janko)
100
106
 
101
107
  ## 3.2.0 (2017-06-21)
102
108
 
103
- * Add `Down::ChunkedIO#readpartial` for more memory efficient reading (@janko-m)
109
+ * Add `Down::ChunkedIO#readpartial` for more memory efficient reading (@janko)
104
110
 
105
- * Fix `Down::ChunkedIO` not returning second part of the last chunk if it was previously partially read (@janko-m)
111
+ * Fix `Down::ChunkedIO` not returning second part of the last chunk if it was previously partially read (@janko)
106
112
 
107
- * Strip internal variables from `Down::ChunkedIO#inspect` and show only the important ones (@janko-m)
113
+ * Strip internal variables from `Down::ChunkedIO#inspect` and show only the important ones (@janko)
108
114
 
109
- * Add `Down::ChunkedIO#closed?` (@janko-m)
115
+ * Add `Down::ChunkedIO#closed?` (@janko)
110
116
 
111
- * Add `Down::ChunkedIO#rewindable?` (@janko-m)
117
+ * Add `Down::ChunkedIO#rewindable?` (@janko)
112
118
 
113
- * In `Down::ChunkedIO` only create the Tempfile if it's going to be used (@janko-m)
119
+ * In `Down::ChunkedIO` only create the Tempfile if it's going to be used (@janko)
114
120
 
115
121
  ## 3.1.0 (2017-06-16)
116
122
 
117
- * Split `Down::NotFound` into explanatory exceptions (@janko-m)
123
+ * Split `Down::NotFound` into explanatory exceptions (@janko)
118
124
 
119
- * Add `:read_timeout` and `:open_timeout` options to `Down::NetHttp.open` (@janko-m)
125
+ * Add `:read_timeout` and `:open_timeout` options to `Down::NetHttp.open` (@janko)
120
126
 
121
- * Return an `Integer` in `data[:status]` on a result of `Down.open` when using the HTTP.rb strategy (@janko-m)
127
+ * Return an `Integer` in `data[:status]` on a result of `Down.open` when using the HTTP.rb strategy (@janko)
122
128
 
123
129
  ## 3.0.0 (2017-05-24)
124
130
 
125
- * Make `Down.open` pass encoding from content type charset to `Down::ChunkedIO` (@janko-m)
131
+ * Make `Down.open` pass encoding from content type charset to `Down::ChunkedIO` (@janko)
126
132
 
127
- * Add `:encoding` option to `Down::ChunkedIO.new` for specifying the encoding of returned content (@janko-m)
133
+ * Add `:encoding` option to `Down::ChunkedIO.new` for specifying the encoding of returned content (@janko)
128
134
 
129
- * Add HTTP.rb backend as an alternative to Net::HTTP (@janko-m)
135
+ * Add HTTP.rb backend as an alternative to Net::HTTP (@janko)
130
136
 
131
- * Stop testing on MRI 2.1 (@janko-m)
137
+ * Stop testing on MRI 2.1 (@janko)
132
138
 
133
- * Forward cookies from the `Set-Cookie` response header when redirecting (@janko-m)
139
+ * Forward cookies from the `Set-Cookie` response header when redirecting (@janko)
134
140
 
135
- * Add `frozen-string-literal: true` comments for less string allocations on Ruby 2.3+ (@janko-m)
141
+ * Add `frozen-string-literal: true` comments for less string allocations on Ruby 2.3+ (@janko)
136
142
 
137
- * Modify `#content_type` to return nil instead of `application/octet-stream` when `Content-Type` is blank in `Down.download` (@janko-m)
143
+ * Modify `#content_type` to return nil instead of `application/octet-stream` when `Content-Type` is blank in `Down.download` (@janko)
138
144
 
139
- * `Down::ChunkedIO#read`, `#each_chunk`, `#eof?`, `rewind` now raise an `IOError` when `Down::ChunkedIO` has been closed (@janko-m)
145
+ * `Down::ChunkedIO#read`, `#each_chunk`, `#eof?`, `rewind` now raise an `IOError` when `Down::ChunkedIO` has been closed (@janko)
140
146
 
141
- * `Down::ChunkedIO` now caches only the content that has been read (@janko-m)
147
+ * `Down::ChunkedIO` now caches only the content that has been read (@janko)
142
148
 
143
- * Add `Down::ChunkedIO#size=` to allow assigning size after the `Down::ChunkedIO` has been instantiated (@janko-m)
149
+ * Add `Down::ChunkedIO#size=` to allow assigning size after the `Down::ChunkedIO` has been instantiated (@janko)
144
150
 
145
- * Make `:size` an optional argument in `Down::ChunkedIO` (@janko-m)
151
+ * Make `:size` an optional argument in `Down::ChunkedIO` (@janko)
146
152
 
147
- * Call enumerator's `ensure` block when `Down::ChunkedIO#close` is called (@janko-m)
153
+ * Call enumerator's `ensure` block when `Down::ChunkedIO#close` is called (@janko)
148
154
 
149
- * Add `:rewindable` option to `Down::ChunkedIO` and `Down.open` for disabling caching read content into a file (@janko-m)
155
+ * Add `:rewindable` option to `Down::ChunkedIO` and `Down.open` for disabling caching read content into a file (@janko)
150
156
 
151
- * Drop support for MRI 2.0 (@janko-m)
157
+ * Drop support for MRI 2.0 (@janko)
152
158
 
153
- * Drop support for MRI 1.9.3 (@janko-m)
159
+ * Drop support for MRI 1.9.3 (@janko)
154
160
 
155
- * Remove deprecated `:progress` option (@janko-m)
161
+ * Remove deprecated `:progress` option (@janko)
156
162
 
157
- * Remove deprecated `:timeout` option (@janko-m)
163
+ * Remove deprecated `:timeout` option (@janko)
158
164
 
159
- * Reraise only a subset of exceptions as `Down::NotFound` in `Down.download` (@janko-m)
165
+ * Reraise only a subset of exceptions as `Down::NotFound` in `Down.download` (@janko)
160
166
 
161
- * Support streaming of "Transfer-Encoding: chunked" responses in `Down.open` again (@janko-m)
167
+ * Support streaming of "Transfer-Encoding: chunked" responses in `Down.open` again (@janko)
162
168
 
163
- * Remove deprecated `Down.stream` (@janko-m)
169
+ * Remove deprecated `Down.stream` (@janko)
164
170
 
165
171
  ## 2.5.1 (2017-05-13)
166
172
 
167
- * Remove URL from the error messages (@janko-m)
173
+ * Remove URL from the error messages (@janko)
168
174
 
169
175
  ## 2.5.0 (2017-05-03)
170
176
 
data/README.md CHANGED
@@ -13,7 +13,7 @@ gem "down", "~> 4.4"
13
13
  ## Downloading
14
14
 
15
15
  The primary method is `Down.download`, which downloads the remote file into a
16
- Tempfile:
16
+ `Tempfile`:
17
17
 
18
18
  ```rb
19
19
  require "down"
@@ -24,7 +24,7 @@ tempfile #=> #<Tempfile:/var/folders/k7/6zx6dx6x7ys3rv3srh0nyfj00000gn/T/2015092
24
24
 
25
25
  ### Metadata
26
26
 
27
- The returned Tempfile has some additional attributes extracted from the
27
+ The returned `Tempfile` has some additional attributes extracted from the
28
28
  response data:
29
29
 
30
30
  ```rb
@@ -357,7 +357,7 @@ Some features that give the HTTP.rb backend an advantage over `open-uri` +
357
357
  * Proper SSL support
358
358
  * Support for persistent connections
359
359
  * Global timeouts (limiting how long the whole request can take)
360
- * Chaninable builder API for setting default options
360
+ * Chainable builder API for setting default options
361
361
 
362
362
  #### Additional options
363
363
 
@@ -7,7 +7,7 @@ Gem::Specification.new do |spec|
7
7
  spec.required_ruby_version = ">= 2.1"
8
8
 
9
9
  spec.summary = "Robust streaming downloads using Net::HTTP, HTTP.rb or wget."
10
- spec.homepage = "https://github.com/janko-m/down"
10
+ spec.homepage = "https://github.com/janko/down"
11
11
  spec.authors = ["Janko Marohnić"]
12
12
  spec.email = ["janko.marohnic@gmail.com"]
13
13
  spec.license = "MIT"
@@ -89,7 +89,7 @@ module Down
89
89
  # surrounded with that sequence of bytes
90
90
  # * if `separator` is an empty string returns paragraphs of content
91
91
  # (content delimited by two newlines)
92
- # * if `separator` is nil returns all content
92
+ # * if `separator` is nil and `limit` is nil returns all content
93
93
  #
94
94
  # With `limit` argument returns maximum of that amount of bytes.
95
95
  #
@@ -104,7 +104,7 @@ module Down
104
104
  separator = separator_or_limit
105
105
  end
106
106
 
107
- return read if separator.nil?
107
+ return read(limit) if separator.nil?
108
108
 
109
109
  separator = "\n\n" if separator.empty?
110
110
 
@@ -186,6 +186,7 @@ module Down
186
186
 
187
187
  @position += data.bytesize
188
188
 
189
+ data.force_encoding(Encoding::BINARY) if length
189
190
  data
190
191
  end
191
192
 
@@ -1,5 +1,5 @@
1
1
  # frozen-string-literal: true
2
2
 
3
3
  module Down
4
- VERSION = "4.8.0"
4
+ VERSION = "4.8.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: 4.8.0
4
+ version: 4.8.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: 2018-12-19 00:00:00.000000000 Z
11
+ date: 2019-05-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: addressable
@@ -142,7 +142,7 @@ files:
142
142
  - lib/down/utils.rb
143
143
  - lib/down/version.rb
144
144
  - lib/down/wget.rb
145
- homepage: https://github.com/janko-m/down
145
+ homepage: https://github.com/janko/down
146
146
  licenses:
147
147
  - MIT
148
148
  metadata: {}
@@ -161,8 +161,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
161
161
  - !ruby/object:Gem::Version
162
162
  version: '0'
163
163
  requirements: []
164
- rubyforge_project:
165
- rubygems_version: 2.7.6
164
+ rubygems_version: 3.0.3
166
165
  signing_key:
167
166
  specification_version: 4
168
167
  summary: Robust streaming downloads using Net::HTTP, HTTP.rb or wget.