rack 2.1.4.4 → 2.2.0

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of rack might be problematic. Click here for more details.

Files changed (61) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +598 -15
  3. data/CONTRIBUTING.md +136 -0
  4. data/README.rdoc +84 -54
  5. data/Rakefile +14 -7
  6. data/{SPEC → SPEC.rdoc} +35 -6
  7. data/lib/rack/auth/abstract/request.rb +0 -2
  8. data/lib/rack/auth/basic.rb +3 -3
  9. data/lib/rack/auth/digest/md5.rb +4 -4
  10. data/lib/rack/auth/digest/request.rb +3 -3
  11. data/lib/rack/body_proxy.rb +13 -9
  12. data/lib/rack/builder.rb +77 -8
  13. data/lib/rack/cascade.rb +23 -8
  14. data/lib/rack/chunked.rb +48 -23
  15. data/lib/rack/common_logger.rb +25 -21
  16. data/lib/rack/conditional_get.rb +18 -16
  17. data/lib/rack/content_length.rb +6 -7
  18. data/lib/rack/content_type.rb +3 -4
  19. data/lib/rack/deflater.rb +45 -35
  20. data/lib/rack/directory.rb +77 -60
  21. data/lib/rack/etag.rb +2 -3
  22. data/lib/rack/events.rb +15 -18
  23. data/lib/rack/file.rb +1 -1
  24. data/lib/rack/files.rb +96 -56
  25. data/lib/rack/handler/cgi.rb +1 -4
  26. data/lib/rack/handler/fastcgi.rb +1 -3
  27. data/lib/rack/handler/lsws.rb +1 -3
  28. data/lib/rack/handler/scgi.rb +1 -3
  29. data/lib/rack/handler/thin.rb +15 -11
  30. data/lib/rack/handler/webrick.rb +12 -5
  31. data/lib/rack/head.rb +0 -2
  32. data/lib/rack/lint.rb +58 -15
  33. data/lib/rack/lobster.rb +3 -5
  34. data/lib/rack/lock.rb +0 -1
  35. data/lib/rack/mock.rb +22 -4
  36. data/lib/rack/multipart/generator.rb +11 -6
  37. data/lib/rack/multipart/parser.rb +12 -32
  38. data/lib/rack/multipart/uploaded_file.rb +13 -7
  39. data/lib/rack/multipart.rb +5 -4
  40. data/lib/rack/query_parser.rb +7 -8
  41. data/lib/rack/recursive.rb +1 -1
  42. data/lib/rack/reloader.rb +1 -3
  43. data/lib/rack/request.rb +172 -76
  44. data/lib/rack/response.rb +62 -19
  45. data/lib/rack/rewindable_input.rb +0 -1
  46. data/lib/rack/runtime.rb +3 -3
  47. data/lib/rack/sendfile.rb +0 -3
  48. data/lib/rack/server.rb +9 -8
  49. data/lib/rack/session/abstract/id.rb +20 -18
  50. data/lib/rack/session/cookie.rb +2 -3
  51. data/lib/rack/session/pool.rb +1 -1
  52. data/lib/rack/show_exceptions.rb +2 -4
  53. data/lib/rack/show_status.rb +1 -3
  54. data/lib/rack/static.rb +13 -6
  55. data/lib/rack/tempfile_reaper.rb +0 -2
  56. data/lib/rack/urlmap.rb +1 -4
  57. data/lib/rack/utils.rb +70 -82
  58. data/lib/rack/version.rb +29 -0
  59. data/lib/rack.rb +7 -16
  60. data/rack.gemspec +31 -29
  61. metadata +14 -15
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 67d6719dffaa22a871452610e93f69046aff97a0977c5a5533f2cbfd6f366f78
4
- data.tar.gz: 4a66af6c5afa8700f9718c64bb524c618daa2f6948e5a884dd06ff2e6cbe023f
3
+ metadata.gz: 254670a03e7cc510d771ec829f76fa1cb5bce59d49d03c421205df082241b194
4
+ data.tar.gz: d294990c60dddf408c10ac2b9428c874bdd7afc2d8b42f0f5925d4795b1a9301
5
5
  SHA512:
6
- metadata.gz: bd068a7c94991582e581b94fceff44789e008ba86234a3d749e04138f1d057c9ae265b8cb990d76f4f6c59f672501cfa952e2d728f48e2f5cc43c863afbc5dfc
7
- data.tar.gz: 19bea2c733f870aac2a23dcec2c939683448625e101ee6388e08ec742d9f6765faad5860129504ebdcb9c1ac698ac1e0e88c91faf03078609815c581ca92875f
6
+ metadata.gz: 922bc679eebc40d637ea88a590aad735b52a9649cedc3ee1d62e613fc5d75b31aba3530bdc9460480d053351fceecf5e5eefd4cf7cbae1936169cd6dbbdb76a9
7
+ data.tar.gz: 057c262c478f831b927103dab5939f9872c47abca1d8296923326b4584942d8d432d92ecd10c4bc8d1213afcf7fab9c1a13a23fc9143a3751df88678f375d180
data/CHANGELOG.md CHANGED
@@ -1,26 +1,91 @@
1
- ## [2.1.4.3] - 2023-03-02
1
+ # Changelog
2
2
 
3
- - [CVE-2023-27530] Introduce multipart_total_part_limit to limit total parts
3
+ All notable changes to this project will be documented in this file. For info on how to format all future additions to this file please reference [Keep A Changelog](https://keepachangelog.com/en/1.0.0/).
4
4
 
5
- ## [2.1.4.2] - 2022-01-17
5
+ ## Unreleased
6
6
 
7
- - [CVE-2022-44571] Fix ReDoS vulnerability in multipart parser
8
- - [CVE-2022-44570] Fix ReDoS in Rack::Utils.get_byte_ranges
9
- - [CVE-2022-44572] Forbid control characters in attributes (also ReDoS)
7
+ ### SPEC Changes
10
8
 
11
- ## [2.1.4.1] - 2022-05-27
9
+ - `rack.session` request environment entry must respond to `to_hash` and return unfrozen Hash. ([@jeremyevans](https://github.com/jeremyevans))
10
+ - Request environment cannot be frozen. ([@jeremyevans](https://github.com/jeremyevans))
11
+ - CGI values in the request environment with non-ASCII characters must use ASCII-8BIT encoding. ([@jeremyevans](https://github.com/jeremyevans))
12
+ - Improve SPEC/lint relating to SERVER_NAME, SERVER_PORT and HTTP_HOST. ([#1561](https://github.com/rack/rack/pull/1561), [@ioquatix](https://github.com/ioquatix))
12
13
 
13
- - [CVE-2022-30123] Fix shell escaping issue in Common Logger
14
- - [CVE-2022-30122] Restrict parsing of broken MIME attachments
14
+ ### Added
15
+
16
+ - `rackup` supports multiple `-r` options and will require all arguments. ([@jeremyevans](https://github.com/jeremyevans))
17
+ - `Server` supports an array of paths to require for the `:require` option. ([@khotta](https://github.com/khotta))
18
+ - `Files` supports multipart range requests. ([@fatkodima](https://github.com/fatkodima))
19
+ - `Multipart::UploadedFile` supports an IO-like object instead of using the filesystem, using `:filename` and `:io` options. ([@jeremyevans](https://github.com/jeremyevans))
20
+ - `Multipart::UploadedFile` supports keyword arguments `:path`, `:content_type`, and `:binary` in addition to positional arguments. ([@jeremyevans](https://github.com/jeremyevans))
21
+ - `Static` supports a `:cascade` option for calling the app if there is no matching file. ([@jeremyevans](https://github.com/jeremyevans))
22
+ - `Session::Abstract::SessionHash#dig`. ([@jeremyevans](https://github.com/jeremyevans))
23
+ - `Response.[]` and `MockResponse.[]` for creating instances using status, headers, and body. ([@ioquatix](https://github.com/ioquatix))
24
+ - Convenient cache and content type methods for `Rack::Response`. ([#1555](https://github.com/rack/rack/pull/1555), [@ioquatix](https://github.com/ioquatix))
25
+
26
+ ### Changed
27
+
28
+ - `Request#params` no longer rescues EOFError. ([@jeremyevans](https://github.com/jeremyevans))
29
+ - `Directory` uses a streaming approach, significantly improving time to first byte for large directories. ([@jeremyevans](https://github.com/jeremyevans))
30
+ - `Directory` no longer includes a Parent directory link in the root directory index. ([@jeremyevans](https://github.com/jeremyevans))
31
+ - `QueryParser#parse_nested_query` uses original backtrace when reraising exception with new class. ([@jeremyevans](https://github.com/jeremyevans))
32
+ - `ConditionalGet` follows RFC 7232 precedence if both If-None-Match and If-Modified-Since headers are provided. ([@jeremyevans](https://github.com/jeremyevans))
33
+ - `.ru` files supports the `frozen-string-literal` magic comment. ([@eregon](https://github.com/eregon))
34
+ - Rely on autoload to load constants instead of requiring internal files, make sure to require 'rack' and not just 'rack/...'. ([@jeremyevans](https://github.com/jeremyevans))
35
+ - `Etag` will continue sending ETag even if the response should not be cached. ([@henm](https://github.com/henm))
36
+ - `Request#host_with_port` no longer includes a colon for a missing or empty port. ([@AlexWayfer](https://github.com/AlexWayfer))
37
+ - All handlers uses keywords arguments instead of an options hash argument. ([@ioquatix](https://github.com/ioquatix))
38
+ - `Files` handling of range requests no longer return a body that supports `to_path`, to ensure range requests are handled correctly. ([@jeremyevans](https://github.com/jeremyevans))
39
+ - `Multipart::Generator` only includes `Content-Length` for files with paths, and `Content-Disposition` `filename` if the `UploadedFile` instance has one. ([@jeremyevans](https://github.com/jeremyevans))
40
+ - `Request#ssl?` is true for the `wss` scheme (secure websockets). ([@jeremyevans](https://github.com/jeremyevans))
41
+ - `Rack::HeaderHash` is memoized by default. ([#1549](https://github.com/rack/rack/pull/1549), [@ioquatix](https://github.com/ioquatix))
42
+ - `Rack::Directory` allow directory traversal inside root directory. ([#1417](https://github.com/rack/rack/pull/1417), [@ThomasSevestre](https://github.com/ThomasSevestre))
43
+ - Sort encodings by server preference. ([#1184](https://github.com/rack/rack/pull/1184), [@ioquatix](https://github.com/ioquatix), [@wjordan](https://github.com/wjordan))
44
+ - Rework host/hostname/authority implementation in `Rack::Request`. `#host` and `#host_with_port` have been changed to correctly return IPv6 addresses formatted with square brackets, as defined by [RFC3986](https://tools.ietf.org/html/rfc3986#section-3.2.2). ([#1561](https://github.com/rack/rack/pull/1561), [@ioquatix](https://github.com/ioquatix))
45
+ - `Rack::Builder` parsing options on first `#\` line is deprecated. ([#1574](https://github.com/rack/rack/pull/1574), [@ioquatix](https://github.com/ioquatix))
46
+
47
+ ### Removed
15
48
 
16
- ## [2.1.4] - 2020-06-15
49
+ - `Directory#path` as it was not used and always returned nil. ([@jeremyevans](https://github.com/jeremyevans))
50
+ - `BodyProxy#each` as it was only needed to work around a bug in Ruby <1.9.3. ([@jeremyevans](https://github.com/jeremyevans))
51
+ - `URLMap::INFINITY` and `URLMap::NEGATIVE_INFINITY`, in favor of `Float::INFINITY`. ([@ch1c0t](https://github.com/ch1c0t))
52
+ - Deprecation of `Rack::File`. It will be deprecated again in rack 2.2 or 3.0. ([@rafaelfranca](https://github.com/rafaelfranca))
53
+ - Support for Ruby 2.2 as it is well past EOL. ([@ioquatix](https://github.com/ioquatix))
54
+ - Remove `Rack::Files#response_body` as the implementation was broken. ([#1153](https://github.com/rack/rack/pull/1153), [@ioquatix](https://github.com/ioquatix))
55
+ - Remove `SERVER_ADDR` which was never part of the original SPEC. ([#1573](https://github.com/rack/rack/pull/1573), [@ioquatix](https://github.com/ioquatix))
17
56
 
18
- - [CVE-2020-8184] When parsing cookies, only decode the value
57
+ ### Fixed
58
+
59
+ - `Directory` correctly handles root paths containing glob metacharacters. ([@jeremyevans](https://github.com/jeremyevans))
60
+ - `Cascade` uses a new response object for each call if initialized with no apps. ([@jeremyevans](https://github.com/jeremyevans))
61
+ - `BodyProxy` correctly delegates keyword arguments to the body object on Ruby 2.7+. ([@jeremyevans](https://github.com/jeremyevans))
62
+ - `BodyProxy#method` correctly handles methods delegated to the body object. ([@jeremyevans](https://github.com/jeremyevans))
63
+ - `Request#host` and `Request#host_with_port` handle IPv6 addresses correctly. ([@AlexWayfer](https://github.com/AlexWayfer))
64
+ - `Lint` checks when response hijacking that `rack.hijack` is called with a valid object. ([@jeremyevans](https://github.com/jeremyevans))
65
+ - `Response#write` correctly updates `Content-Length` if initialized with a body. ([@jeremyevans](https://github.com/jeremyevans))
66
+ - `CommonLogger` includes `SCRIPT_NAME` when logging. ([@Erol](https://github.com/Erol))
67
+ - `Utils.parse_nested_query` correctly handles empty queries, using an empty instance of the params class instead of a hash. ([@jeremyevans](https://github.com/jeremyevans))
68
+ - `Directory` correctly escapes paths in links. ([@yous](https://github.com/yous))
69
+ - `Request#delete_cookie` and related `Utils` methods handle `:domain` and `:path` options in same call. ([@jeremyevans](https://github.com/jeremyevans))
70
+ - `Request#delete_cookie` and related `Utils` methods do an exact match on `:domain` and `:path` options. ([@jeremyevans](https://github.com/jeremyevans))
71
+ - `Static` no longer adds headers when a gzipped file request has a 304 response. ([@chooh](https://github.com/chooh))
72
+ - `ContentLength` sets `Content-Length` response header even for bodies not responding to `to_ary`. ([@jeremyevans](https://github.com/jeremyevans))
73
+ - Thin handler supports options passed directly to `Thin::Controllers::Controller`. ([@jeremyevans](https://github.com/jeremyevans))
74
+ - WEBrick handler no longer ignores `:BindAddress` option. ([@jeremyevans](https://github.com/jeremyevans))
75
+ - `ShowExceptions` handles invalid POST data. ([@jeremyevans](https://github.com/jeremyevans))
76
+ - Basic authentication requires a password, even if the password is empty. ([@jeremyevans](https://github.com/jeremyevans))
77
+ - `Lint` checks response is array with 3 elements, per SPEC. ([@jeremyevans](https://github.com/jeremyevans))
78
+ - Support for using `:SSLEnable` option when using WEBrick handler. (Gregor Melhorn)
79
+ - Close response body after buffering it when buffering. ([@ioquatix](https://github.com/ioquatix))
80
+ - Only accept `;` as delimiter when parsing cookies. ([@mrageh](https://github.com/mrageh))
81
+ - `Utils::HeaderHash#clear` clears the name mapping as well. ([@raxoft](https://github.com/raxoft))
82
+ - Support for passing `nil` `Rack::Files.new`, which notably fixes Rails' current `ActiveStorage::FileServer` implementation. ([@ioquatix](https://github.com/ioquatix))
83
+
84
+ ### Documentation
19
85
 
20
- ## [2.1.3] - 2020-05-12
86
+ - CHANGELOG updates. ([@aupajo](https://github.com/aupajo))
87
+ - Added [CONTRIBUTING](CONTRIBUTING.md). ([@dblock](https://github.com/dblock))
21
88
 
22
- - [CVE-2020-8161] Use Dir.entries instead of Dir[glob] to prevent user-specified glob metacharacters
23
- -
24
89
  ## [2.1.2] - 2020-01-27
25
90
 
26
91
  - Fix multipart parser for some files to prevent denial of service ([@aiomaster](https://github.com/aiomaster))
@@ -33,6 +98,7 @@
33
98
  ## [2.1.1] - 2020-01-12
34
99
 
35
100
  - Remove `Rack::Chunked` from `Rack::Server` default middleware. ([#1475](https://github.com/rack/rack/pull/1475), [@ioquatix](https://github.com/ioquatix))
101
+ - Restore support for code relying on `SessionId#to_s`. ([@jeremyevans](https://github.com/jeremyevans))
36
102
 
37
103
  ## [2.1.0] - 2020-01-10
38
104
 
@@ -86,7 +152,524 @@
86
152
  ### Documentation
87
153
 
88
154
  - Update broken example in `Session::Abstract::ID` documentation. ([tonytonyjan](https://github.com/tonytonyjan))
89
- - Add Padrino to the list of frameworks implmenting Rack. ([@wikimatze](https://github.com/wikimatze))
155
+ - Add Padrino to the list of frameworks implementing Rack. ([@wikimatze](https://github.com/wikimatze))
90
156
  - Remove Mongrel from the suggested server options in the help output. ([@tricknotes](https://github.com/tricknotes))
91
157
  - Replace `HISTORY.md` and `NEWS.md` with `CHANGELOG.md`. ([@twitnithegirl](https://github.com/twitnithegirl))
92
158
  - CHANGELOG updates. ([@drenmi](https://github.com/Drenmi), [@p8](https://github.com/p8))
159
+
160
+ ## [2.0.8] - 2019-12-08
161
+
162
+ ### Security
163
+
164
+ - [[CVE-2019-16782](https://nvd.nist.gov/vuln/detail/CVE-2019-16782)] Prevent timing attacks targeted at session ID lookup. BREAKING CHANGE: Session ID is now a SessionId instance instead of a String. ([@tenderlove](https://github.com/tenderlove), [@rafaelfranca](https://github.com/rafaelfranca))
165
+
166
+ ## [1.6.12] - 2019-12-08
167
+
168
+ ### Security
169
+
170
+ - [[CVE-2019-16782](https://nvd.nist.gov/vuln/detail/CVE-2019-16782)] Prevent timing attacks targeted at session ID lookup. BREAKING CHANGE: Session ID is now a SessionId instance instead of a String. ([@tenderlove](https://github.com/tenderlove), [@rafaelfranca](https://github.com/rafaelfranca))
171
+
172
+ ## [2.0.7] - 2019-04-02
173
+
174
+ ### Fixed
175
+
176
+ - Remove calls to `#eof?` on Rack input in `Multipart::Parser`, as this breaks the specification. ([@matthewd](https://github.com/matthewd))
177
+ - Preserve forwarded IP addresses for trusted proxy chains. ([@SamSaffron](https://github.com/SamSaffron))
178
+
179
+ ## [2.0.6] - 2018-11-05
180
+
181
+ ### Fixed
182
+
183
+ - [[CVE-2018-16470](https://nvd.nist.gov/vuln/detail/CVE-2018-16470)] Reduce buffer size of `Multipart::Parser` to avoid pathological parsing. ([@tenderlove](https://github.com/tenderlove))
184
+ - Fix a call to a non-existing method `#accepts_html` in the `ShowExceptions` middleware. ([@tomelm](https://github.com/tomelm))
185
+ - [[CVE-2018-16471](https://nvd.nist.gov/vuln/detail/CVE-2018-16471)] Whitelist HTTP and HTTPS schemes in `Request#scheme` to prevent a possible XSS attack. ([@PatrickTulskie](https://github.com/PatrickTulskie))
186
+
187
+ ## [2.0.5] - 2018-04-23
188
+
189
+ ### Fixed
190
+
191
+ - Record errors originating from invalid UTF8 in `MethodOverride` middleware instead of breaking. ([@mclark](https://github.com/mclark))
192
+
193
+ ## [2.0.4] - 2018-01-31
194
+
195
+ ### Changed
196
+
197
+ - Ensure the `Lock` middleware passes the original `env` object. ([@lugray](https://github.com/lugray))
198
+ - Improve performance of `Multipart::Parser` when uploading large files. ([@tompng](https://github.com/tompng))
199
+ - Increase buffer size in `Multipart::Parser` for better performance. ([@jkowens](https://github.com/jkowens))
200
+ - Reduce memory usage of `Multipart::Parser` when uploading large files. ([@tompng](https://github.com/tompng))
201
+ - Replace ConcurrentRuby dependency with native `Queue`. ([@devmchakan](https://github.com/devmchakan))
202
+
203
+ ### Fixed
204
+
205
+ - Require the correct digest algorithm in the `ETag` middleware. ([@matthewd](https://github.com/matthewd))
206
+
207
+ ### Documentation
208
+
209
+ - Update homepage links to use SSL. ([@hugoabonizio](https://github.com/hugoabonizio))
210
+
211
+ ## [2.0.3] - 2017-05-15
212
+
213
+ ### Changed
214
+
215
+ - Ensure `env` values are ASCII 8-bit encoded. ([@eileencodes](https://github.com/eileencodes))
216
+
217
+ ### Fixed
218
+
219
+ - Prevent exceptions when a class with mixins inherits from `Session::Abstract::ID`. ([@jnraine](https://github.com/jnraine))
220
+
221
+ ## [2.0.2] - 2017-05-08
222
+
223
+ ### Added
224
+
225
+ - Allow `Session::Abstract::SessionHash#fetch` to accept a block with a default value. ([@yannvanhalewyn](https://github.com/yannvanhalewyn))
226
+ - Add `Builder#freeze_app` to freeze application and all middleware. ([@jeremyevans](https://github.com/jeremyevans))
227
+
228
+ ### Changed
229
+
230
+ - Freeze default session options to avoid accidental mutation. ([@kirs](https://github.com/kirs))
231
+ - Detect partial hijack without hash headers. ([@devmchakan](https://github.com/devmchakan))
232
+ - Update tests to use MiniTest 6 matchers. ([@tonytonyjan](https://github.com/tonytonyjan))
233
+ - Allow 205 Reset Content responses to set a Content-Length, as RFC 7231 proposes setting this to 0. ([@devmchakan](https://github.com/devmchakan))
234
+
235
+ ### Fixed
236
+
237
+ - Handle `NULL` bytes in multipart filenames. ([@casperisfine](https://github.com/casperisfine))
238
+ - Remove warnings due to miscapitalized global. ([@ioquatix](https://github.com/ioquatix))
239
+ - Prevent exceptions caused by a race condition on multi-threaded servers. ([@sophiedeziel](https://github.com/sophiedeziel))
240
+ - Add RDoc as an explicit depencency for `doc` group. ([@tonytonyjan](https://github.com/tonytonyjan))
241
+ - Record errors originating from `Multipart::Parser` in the `MethodOverride` middleware instead of letting them bubble up. ([@carlzulauf](https://github.com/carlzulauf))
242
+ - Remove remaining use of removed `Utils#bytesize` method from the `File` middleware. ([@brauliomartinezlm](https://github.com/brauliomartinezlm))
243
+
244
+ ### Removed
245
+
246
+ - Remove `deflate` encoding support to reduce caching overhead. ([@devmchakan](https://github.com/devmchakan))
247
+
248
+ ### Documentation
249
+
250
+ - Update broken example in `Deflater` documentation. ([@mwpastore](https://github.com/mwpastore))
251
+
252
+ ## [2.0.1] - 2016-06-30
253
+
254
+ ### Changed
255
+
256
+ - Remove JSON as an explicit dependency. ([@mperham](https://github.com/mperham))
257
+
258
+
259
+ # History/News Archive
260
+ Items below this line are from the previously maintained HISTORY.md and NEWS.md files.
261
+
262
+ ## [2.0.0.rc1] 2016-05-06
263
+ - Rack::Session::Abstract::ID is deprecated. Please change to use Rack::Session::Abstract::Persisted
264
+
265
+ ## [2.0.0.alpha] 2015-12-04
266
+ - First-party "SameSite" cookies. Browsers omit SameSite cookies from third-party requests, closing the door on many CSRF attacks.
267
+ - Pass `same_site: true` (or `:strict`) to enable: response.set_cookie 'foo', value: 'bar', same_site: true or `same_site: :lax` to use Lax enforcement: response.set_cookie 'foo', value: 'bar', same_site: :lax
268
+ - Based on version 7 of the Same-site Cookies internet draft:
269
+ https://tools.ietf.org/html/draft-west-first-party-cookies-07
270
+ - Thanks to Ben Toews (@mastahyeti) and Bob Long (@bobjflong) for updating to drafts 5 and 7.
271
+ - Add `Rack::Events` middleware for adding event based middleware: middleware that does not care about the response body, but only cares about doing work at particular points in the request / response lifecycle.
272
+ - Add `Rack::Request#authority` to calculate the authority under which the response is being made (this will be handy for h2 pushes).
273
+ - Add `Rack::Response::Helpers#cache_control` and `cache_control=`. Use this for setting cache control headers on your response objects.
274
+ - Add `Rack::Response::Helpers#etag` and `etag=`. Use this for setting etag values on the response.
275
+ - Introduce `Rack::Response::Helpers#add_header` to add a value to a multi-valued response header. Implemented in terms of other `Response#*_header` methods, so it's available to any response-like class that includes the `Helpers` module.
276
+ - Add `Rack::Request#add_header` to match.
277
+ - `Rack::Session::Abstract::ID` IS DEPRECATED. Please switch to `Rack::Session::Abstract::Persisted`. `Rack::Session::Abstract::Persisted` uses a request object rather than the `env` hash.
278
+ - Pull `ENV` access inside the request object in to a module. This will help with legacy Request objects that are ENV based but don't want to inherit from Rack::Request
279
+ - Move most methods on the `Rack::Request` to a module `Rack::Request::Helpers` and use public API to get values from the request object. This enables users to mix `Rack::Request::Helpers` in to their own objects so they can implement `(get|set|fetch|each)_header` as they see fit (for example a proxy object).
280
+ - Files and directories with + in the name are served correctly. Rather than unescaping paths like a form, we unescape with a URI parser using `Rack::Utils.unescape_path`. Fixes #265
281
+ - Tempfiles are automatically closed in the case that there were too
282
+ many posted.
283
+ - Added methods for manipulating response headers that don't assume
284
+ they're stored as a Hash. Response-like classes may include the
285
+ Rack::Response::Helpers module if they define these methods:
286
+ - Rack::Response#has_header?
287
+ - Rack::Response#get_header
288
+ - Rack::Response#set_header
289
+ - Rack::Response#delete_header
290
+ - Introduce Util.get_byte_ranges that will parse the value of the HTTP_RANGE string passed to it without depending on the `env` hash. `byte_ranges` is deprecated in favor of this method.
291
+ - Change Session internals to use Request objects for looking up session information. This allows us to only allocate one request object when dealing with session objects (rather than doing it every time we need to manipulate cookies, etc).
292
+ - Add `Rack::Request#initialize_copy` so that the env is duped when the request gets duped.
293
+ - Added methods for manipulating request specific data. This includes
294
+ data set as CGI parameters, and just any arbitrary data the user wants
295
+ to associate with a particular request. New methods:
296
+ - Rack::Request#has_header?
297
+ - Rack::Request#get_header
298
+ - Rack::Request#fetch_header
299
+ - Rack::Request#each_header
300
+ - Rack::Request#set_header
301
+ - Rack::Request#delete_header
302
+ - lib/rack/utils.rb: add a method for constructing "delete" cookie
303
+ headers. This allows us to construct cookie headers without depending
304
+ on the side effects of mutating a hash.
305
+ - Prevent extremely deep parameters from being parsed. CVE-2015-3225
306
+
307
+ ## [1.6.1] 2015-05-06
308
+ - Fix CVE-2014-9490, denial of service attack in OkJson
309
+ - Use a monotonic time for Rack::Runtime, if available
310
+ - RACK_MULTIPART_LIMIT changed to RACK_MULTIPART_PART_LIMIT (RACK_MULTIPART_LIMIT is deprecated and will be removed in 1.7.0)
311
+
312
+ ## [1.5.3] 2015-05-06
313
+ - Fix CVE-2014-9490, denial of service attack in OkJson
314
+ - Backport bug fixes to 1.5 series
315
+
316
+ ## [1.6.0] 2014-01-18
317
+ - Response#unauthorized? helper
318
+ - Deflater now accepts an options hash to control compression on a per-request level
319
+ - Builder#warmup method for app preloading
320
+ - Request#accept_language method to extract HTTP_ACCEPT_LANGUAGE
321
+ - Add quiet mode of rack server, rackup --quiet
322
+ - Update HTTP Status Codes to RFC 7231
323
+ - Less strict header name validation according to RFC 2616
324
+ - SPEC updated to specify headers conform to RFC7230 specification
325
+ - Etag correctly marks etags as weak
326
+ - Request#port supports multiple x-http-forwarded-proto values
327
+ - Utils#multipart_part_limit configures the maximum number of parts a request can contain
328
+ - Default host to localhost when in development mode
329
+ - Various bugfixes and performance improvements
330
+
331
+ ## [1.5.2] 2013-02-07
332
+ - Fix CVE-2013-0263, timing attack against Rack::Session::Cookie
333
+ - Fix CVE-2013-0262, symlink path traversal in Rack::File
334
+ - Add various methods to Session for enhanced Rails compatibility
335
+ - Request#trusted_proxy? now only matches whole strings
336
+ - Add JSON cookie coder, to be default in Rack 1.6+ due to security concerns
337
+ - URLMap host matching in environments that don't set the Host header fixed
338
+ - Fix a race condition that could result in overwritten pidfiles
339
+ - Various documentation additions
340
+
341
+ ## [1.4.5] 2013-02-07
342
+ - Fix CVE-2013-0263, timing attack against Rack::Session::Cookie
343
+ - Fix CVE-2013-0262, symlink path traversal in Rack::File
344
+
345
+ ## [1.1.6, 1.2.8, 1.3.10] 2013-02-07
346
+ - Fix CVE-2013-0263, timing attack against Rack::Session::Cookie
347
+
348
+ ## [1.5.1] 2013-01-28
349
+ - Rack::Lint check_hijack now conforms to other parts of SPEC
350
+ - Added hash-like methods to Abstract::ID::SessionHash for compatibility
351
+ - Various documentation corrections
352
+
353
+ ## [1.5.0] 2013-01-21
354
+ - Introduced hijack SPEC, for before-response and after-response hijacking
355
+ - SessionHash is no longer a Hash subclass
356
+ - Rack::File cache_control parameter is removed, in place of headers options
357
+ - Rack::Auth::AbstractRequest#scheme now yields strings, not symbols
358
+ - Rack::Utils cookie functions now format expires in RFC 2822 format
359
+ - Rack::File now has a default mime type
360
+ - rackup -b 'run Rack::Files.new(".")', option provides command line configs
361
+ - Rack::Deflater will no longer double encode bodies
362
+ - Rack::Mime#match? provides convenience for Accept header matching
363
+ - Rack::Utils#q_values provides splitting for Accept headers
364
+ - Rack::Utils#best_q_match provides a helper for Accept headers
365
+ - Rack::Handler.pick provides convenience for finding available servers
366
+ - Puma added to the list of default servers (preferred over Webrick)
367
+ - Various middleware now correctly close body when replacing it
368
+ - Rack::Request#params is no longer persistent with only GET params
369
+ - Rack::Request#update_param and #delete_param provide persistent operations
370
+ - Rack::Request#trusted_proxy? now returns true for local unix sockets
371
+ - Rack::Response no longer forces Content-Types
372
+ - Rack::Sendfile provides local mapping configuration options
373
+ - Rack::Utils#rfc2109 provides old netscape style time output
374
+ - Updated HTTP status codes
375
+ - Ruby 1.8.6 likely no longer passes tests, and is no longer fully supported
376
+
377
+ ## [1.4.4, 1.3.9, 1.2.7, 1.1.5] 2013-01-13
378
+ - [SEC] Rack::Auth::AbstractRequest no longer symbolizes arbitrary strings
379
+ - Fixed erroneous test case in the 1.3.x series
380
+
381
+ ## [1.4.3] 2013-01-07
382
+ - Security: Prevent unbounded reads in large multipart boundaries
383
+
384
+ ## [1.3.8] 2013-01-07
385
+ - Security: Prevent unbounded reads in large multipart boundaries
386
+
387
+ ## [1.4.2] 2013-01-06
388
+ - Add warnings when users do not provide a session secret
389
+ - Fix parsing performance for unquoted filenames
390
+ - Updated URI backports
391
+ - Fix URI backport version matching, and silence constant warnings
392
+ - Correct parameter parsing with empty values
393
+ - Correct rackup '-I' flag, to allow multiple uses
394
+ - Correct rackup pidfile handling
395
+ - Report rackup line numbers correctly
396
+ - Fix request loops caused by non-stale nonces with time limits
397
+ - Fix reloader on Windows
398
+ - Prevent infinite recursions from Response#to_ary
399
+ - Various middleware better conforms to the body close specification
400
+ - Updated language for the body close specification
401
+ - Additional notes regarding ECMA escape compatibility issues
402
+ - Fix the parsing of multiple ranges in range headers
403
+ - Prevent errors from empty parameter keys
404
+ - Added PATCH verb to Rack::Request
405
+ - Various documentation updates
406
+ - Fix session merge semantics (fixes rack-test)
407
+ - Rack::Static :index can now handle multiple directories
408
+ - All tests now utilize Rack::Lint (special thanks to Lars Gierth)
409
+ - Rack::File cache_control parameter is now deprecated, and removed by 1.5
410
+ - Correct Rack::Directory script name escaping
411
+ - Rack::Static supports header rules for sophisticated configurations
412
+ - Multipart parsing now works without a Content-Length header
413
+ - New logos courtesy of Zachary Scott!
414
+ - Rack::BodyProxy now explicitly defines #each, useful for C extensions
415
+ - Cookies that are not URI escaped no longer cause exceptions
416
+
417
+ ## [1.3.7] 2013-01-06
418
+ - Add warnings when users do not provide a session secret
419
+ - Fix parsing performance for unquoted filenames
420
+ - Updated URI backports
421
+ - Fix URI backport version matching, and silence constant warnings
422
+ - Correct parameter parsing with empty values
423
+ - Correct rackup '-I' flag, to allow multiple uses
424
+ - Correct rackup pidfile handling
425
+ - Report rackup line numbers correctly
426
+ - Fix request loops caused by non-stale nonces with time limits
427
+ - Fix reloader on Windows
428
+ - Prevent infinite recursions from Response#to_ary
429
+ - Various middleware better conforms to the body close specification
430
+ - Updated language for the body close specification
431
+ - Additional notes regarding ECMA escape compatibility issues
432
+ - Fix the parsing of multiple ranges in range headers
433
+
434
+ ## [1.2.6] 2013-01-06
435
+ - Add warnings when users do not provide a session secret
436
+ - Fix parsing performance for unquoted filenames
437
+
438
+ ## [1.1.4] 2013-01-06
439
+ - Add warnings when users do not provide a session secret
440
+
441
+ ## [1.4.1] 2012-01-22
442
+ - Alter the keyspace limit calculations to reduce issues with nested params
443
+ - Add a workaround for multipart parsing where files contain unescaped "%"
444
+ - Added Rack::Response::Helpers#method_not_allowed? (code 405)
445
+ - Rack::File now returns 404 for illegal directory traversals
446
+ - Rack::File now returns 405 for illegal methods (non HEAD/GET)
447
+ - Rack::Cascade now catches 405 by default, as well as 404
448
+ - Cookies missing '--' no longer cause an exception to be raised
449
+ - Various style changes and documentation spelling errors
450
+ - Rack::BodyProxy always ensures to execute its block
451
+ - Additional test coverage around cookies and secrets
452
+ - Rack::Session::Cookie can now be supplied either secret or old_secret
453
+ - Tests are no longer dependent on set order
454
+ - Rack::Static no longer defaults to serving index files
455
+ - Rack.release was fixed
456
+
457
+ ## [1.4.0] 2011-12-28
458
+ - Ruby 1.8.6 support has officially been dropped. Not all tests pass.
459
+ - Raise sane error messages for broken config.ru
460
+ - Allow combining run and map in a config.ru
461
+ - Rack::ContentType will not set Content-Type for responses without a body
462
+ - Status code 205 does not send a response body
463
+ - Rack::Response::Helpers will not rely on instance variables
464
+ - Rack::Utils.build_query no longer outputs '=' for nil query values
465
+ - Various mime types added
466
+ - Rack::MockRequest now supports HEAD
467
+ - Rack::Directory now supports files that contain RFC3986 reserved chars
468
+ - Rack::File now only supports GET and HEAD requests
469
+ - Rack::Server#start now passes the block to Rack::Handler::<h>#run
470
+ - Rack::Static now supports an index option
471
+ - Added the Teapot status code
472
+ - rackup now defaults to Thin instead of Mongrel (if installed)
473
+ - Support added for HTTP_X_FORWARDED_SCHEME
474
+ - Numerous bug fixes, including many fixes for new and alternate rubies
475
+
476
+ ## [1.1.3] 2011-12-28
477
+ - Security fix. http://www.ocert.org/advisories/ocert-2011-003.html
478
+ Further information here: http://jruby.org/2011/12/27/jruby-1-6-5-1
479
+
480
+ ## [1.3.5] 2011-10-17
481
+ - Fix annoying warnings caused by the backport in 1.3.4
482
+
483
+ ## [1.3.4] 2011-10-01
484
+ - Backport security fix from 1.9.3, also fixes some roundtrip issues in URI
485
+ - Small documentation update
486
+ - Fix an issue where BodyProxy could cause an infinite recursion
487
+ - Add some supporting files for travis-ci
488
+
489
+ ## [1.2.4] 2011-09-16
490
+ - Fix a bug with MRI regex engine to prevent XSS by malformed unicode
491
+
492
+ ## [1.3.3] 2011-09-16
493
+ - Fix bug with broken query parameters in Rack::ShowExceptions
494
+ - Rack::Request#cookies no longer swallows exceptions on broken input
495
+ - Prevents XSS attacks enabled by bug in Ruby 1.8's regexp engine
496
+ - Rack::ConditionalGet handles broken If-Modified-Since helpers
497
+
498
+ ## [1.3.2] 2011-07-16
499
+ - Fix for Rails and rack-test, Rack::Utils#escape calls to_s
500
+
501
+ ## [1.3.1] 2011-07-13
502
+ - Fix 1.9.1 support
503
+ - Fix JRuby support
504
+ - Properly handle $KCODE in Rack::Utils.escape
505
+ - Make method_missing/respond_to behavior consistent for Rack::Lock,
506
+ Rack::Auth::Digest::Request and Rack::Multipart::UploadedFile
507
+ - Reenable passing rack.session to session middleware
508
+ - Rack::CommonLogger handles streaming responses correctly
509
+ - Rack::MockResponse calls close on the body object
510
+ - Fix a DOS vector from MRI stdlib backport
511
+
512
+ ## [1.2.3] 2011-05-22
513
+ - Pulled in relevant bug fixes from 1.3
514
+ - Fixed 1.8.6 support
515
+
516
+ ## [1.3.0] 2011-05-22
517
+ - Various performance optimizations
518
+ - Various multipart fixes
519
+ - Various multipart refactors
520
+ - Infinite loop fix for multipart
521
+ - Test coverage for Rack::Server returns
522
+ - Allow files with '..', but not path components that are '..'
523
+ - rackup accepts handler-specific options on the command line
524
+ - Request#params no longer merges POST into GET (but returns the same)
525
+ - Use URI.encode_www_form_component instead. Use core methods for escaping.
526
+ - Allow multi-line comments in the config file
527
+ - Bug L#94 reported by Nikolai Lugovoi, query parameter unescaping.
528
+ - Rack::Response now deletes Content-Length when appropriate
529
+ - Rack::Deflater now supports streaming
530
+ - Improved Rack::Handler loading and searching
531
+ - Support for the PATCH verb
532
+ - env['rack.session.options'] now contains session options
533
+ - Cookies respect renew
534
+ - Session middleware uses SecureRandom.hex
535
+
536
+ ## [1.2.2, 1.1.2] 2011-03-13
537
+ - Security fix in Rack::Auth::Digest::MD5: when authenticator
538
+ returned nil, permission was granted on empty password.
539
+
540
+ ## [1.2.1] 2010-06-15
541
+ - Make CGI handler rewindable
542
+ - Rename spec/ to test/ to not conflict with SPEC on lesser
543
+ operating systems
544
+
545
+ ## [1.2.0] 2010-06-13
546
+ - Removed Camping adapter: Camping 2.0 supports Rack as-is
547
+ - Removed parsing of quoted values
548
+ - Add Request.trace? and Request.options?
549
+ - Add mime-type for .webm and .htc
550
+ - Fix HTTP_X_FORWARDED_FOR
551
+ - Various multipart fixes
552
+ - Switch test suite to bacon
553
+
554
+ ## [1.1.0] 2010-01-03
555
+ - Moved Auth::OpenID to rack-contrib.
556
+ - SPEC change that relaxes Lint slightly to allow subclasses of the
557
+ required types
558
+ - SPEC change to document rack.input binary mode in greator detail
559
+ - SPEC define optional rack.logger specification
560
+ - File servers support X-Cascade header
561
+ - Imported Config middleware
562
+ - Imported ETag middleware
563
+ - Imported Runtime middleware
564
+ - Imported Sendfile middleware
565
+ - New Logger and NullLogger middlewares
566
+ - Added mime type for .ogv and .manifest.
567
+ - Don't squeeze PATH_INFO slashes
568
+ - Use Content-Type to determine POST params parsing
569
+ - Update Rack::Utils::HTTP_STATUS_CODES hash
570
+ - Add status code lookup utility
571
+ - Response should call #to_i on the status
572
+ - Add Request#user_agent
573
+ - Request#host knows about forwarded host
574
+ - Return an empty string for Request#host if HTTP_HOST and
575
+ SERVER_NAME are both missing
576
+ - Allow MockRequest to accept hash params
577
+ - Optimizations to HeaderHash
578
+ - Refactored rackup into Rack::Server
579
+ - Added Utils.build_nested_query to complement Utils.parse_nested_query
580
+ - Added Utils::Multipart.build_multipart to complement
581
+ Utils::Multipart.parse_multipart
582
+ - Extracted set and delete cookie helpers into Utils so they can be
583
+ used outside Response
584
+ - Extract parse_query and parse_multipart in Request so subclasses
585
+ can change their behavior
586
+ - Enforce binary encoding in RewindableInput
587
+ - Set correct external_encoding for handlers that don't use RewindableInput
588
+
589
+ ## [1.0.1] 2009-10-18
590
+ - Bump remainder of rack.versions.
591
+ - Support the pure Ruby FCGI implementation.
592
+ - Fix for form names containing "=": split first then unescape components
593
+ - Fixes the handling of the filename parameter with semicolons in names.
594
+ - Add anchor to nested params parsing regexp to prevent stack overflows
595
+ - Use more compatible gzip write api instead of "<<".
596
+ - Make sure that Reloader doesn't break when executed via ruby -e
597
+ - Make sure WEBrick respects the :Host option
598
+ - Many Ruby 1.9 fixes.
599
+
600
+ ## [1.0.0] 2009-04-25
601
+ - SPEC change: Rack::VERSION has been pushed to [1,0].
602
+ - SPEC change: header values must be Strings now, split on "\n".
603
+ - SPEC change: Content-Length can be missing, in this case chunked transfer
604
+ encoding is used.
605
+ - SPEC change: rack.input must be rewindable and support reading into
606
+ a buffer, wrap with Rack::RewindableInput if it isn't.
607
+ - SPEC change: rack.session is now specified.
608
+ - SPEC change: Bodies can now additionally respond to #to_path with
609
+ a filename to be served.
610
+ - NOTE: String bodies break in 1.9, use an Array consisting of a
611
+ single String instead.
612
+ - New middleware Rack::Lock.
613
+ - New middleware Rack::ContentType.
614
+ - Rack::Reloader has been rewritten.
615
+ - Major update to Rack::Auth::OpenID.
616
+ - Support for nested parameter parsing in Rack::Response.
617
+ - Support for redirects in Rack::Response.
618
+ - HttpOnly cookie support in Rack::Response.
619
+ - The Rakefile has been rewritten.
620
+ - Many bugfixes and small improvements.
621
+
622
+ ## [0.9.1] 2009-01-09
623
+ - Fix directory traversal exploits in Rack::File and Rack::Directory.
624
+
625
+ ## [0.9] 2009-01-06
626
+ - Rack is now managed by the Rack Core Team.
627
+ - Rack::Lint is stricter and follows the HTTP RFCs more closely.
628
+ - Added ConditionalGet middleware.
629
+ - Added ContentLength middleware.
630
+ - Added Deflater middleware.
631
+ - Added Head middleware.
632
+ - Added MethodOverride middleware.
633
+ - Rack::Mime now provides popular MIME-types and their extension.
634
+ - Mongrel Header now streams.
635
+ - Added Thin handler.
636
+ - Official support for swiftiplied Mongrel.
637
+ - Secure cookies.
638
+ - Made HeaderHash case-preserving.
639
+ - Many bugfixes and small improvements.
640
+
641
+ ## [0.4] 2008-08-21
642
+ - New middleware, Rack::Deflater, by Christoffer Sawicki.
643
+ - OpenID authentication now needs ruby-openid 2.
644
+ - New Memcache sessions, by blink.
645
+ - Explicit EventedMongrel handler, by Joshua Peek <josh@joshpeek.com>
646
+ - Rack::Reloader is not loaded in rackup development mode.
647
+ - rackup can daemonize with -D.
648
+ - Many bugfixes, especially for pool sessions, URLMap, thread safety
649
+ and tempfile handling.
650
+ - Improved tests.
651
+ - Rack moved to Git.
652
+
653
+ ## [0.3] 2008-02-26
654
+ - LiteSpeed handler, by Adrian Madrid.
655
+ - SCGI handler, by Jeremy Evans.
656
+ - Pool sessions, by blink.
657
+ - OpenID authentication, by blink.
658
+ - :Port and :File options for opening FastCGI sockets, by blink.
659
+ - Last-Modified HTTP header for Rack::File, by blink.
660
+ - Rack::Builder#use now accepts blocks, by Corey Jewett.
661
+ (See example/protectedlobster.ru)
662
+ - HTTP status 201 can contain a Content-Type and a body now.
663
+ - Many bugfixes, especially related to Cookie handling.
664
+
665
+ ## [0.2] 2007-05-16
666
+ - HTTP Basic authentication.
667
+ - Cookie Sessions.
668
+ - Static file handler.
669
+ - Improved Rack::Request.
670
+ - Improved Rack::Response.
671
+ - Added Rack::ShowStatus, for better default error messages.
672
+ - Bug fixes in the Camping adapter.
673
+ - Removed Rails adapter, was too alpha.
674
+
675
+ ## [0.1] 2007-03-03