rack 2.1.0 → 2.2.2

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 +126 -6
  3. data/CONTRIBUTING.md +136 -0
  4. data/README.rdoc +83 -39
  5. data/Rakefile +14 -7
  6. data/{SPEC → SPEC.rdoc} +26 -1
  7. data/lib/rack.rb +7 -16
  8. data/lib/rack/auth/abstract/request.rb +0 -2
  9. data/lib/rack/auth/basic.rb +3 -3
  10. data/lib/rack/auth/digest/md5.rb +4 -4
  11. data/lib/rack/auth/digest/request.rb +3 -3
  12. data/lib/rack/body_proxy.rb +13 -9
  13. data/lib/rack/builder.rb +78 -8
  14. data/lib/rack/cascade.rb +23 -8
  15. data/lib/rack/chunked.rb +48 -23
  16. data/lib/rack/common_logger.rb +25 -18
  17. data/lib/rack/conditional_get.rb +18 -16
  18. data/lib/rack/content_length.rb +6 -7
  19. data/lib/rack/content_type.rb +3 -4
  20. data/lib/rack/deflater.rb +49 -35
  21. data/lib/rack/directory.rb +77 -60
  22. data/lib/rack/etag.rb +2 -3
  23. data/lib/rack/events.rb +15 -18
  24. data/lib/rack/file.rb +1 -2
  25. data/lib/rack/files.rb +97 -57
  26. data/lib/rack/handler/cgi.rb +1 -4
  27. data/lib/rack/handler/fastcgi.rb +1 -3
  28. data/lib/rack/handler/lsws.rb +1 -3
  29. data/lib/rack/handler/scgi.rb +1 -3
  30. data/lib/rack/handler/thin.rb +1 -3
  31. data/lib/rack/handler/webrick.rb +12 -5
  32. data/lib/rack/head.rb +0 -2
  33. data/lib/rack/lint.rb +57 -14
  34. data/lib/rack/lobster.rb +3 -5
  35. data/lib/rack/lock.rb +0 -1
  36. data/lib/rack/mock.rb +22 -4
  37. data/lib/rack/multipart.rb +1 -1
  38. data/lib/rack/multipart/generator.rb +11 -6
  39. data/lib/rack/multipart/parser.rb +10 -18
  40. data/lib/rack/multipart/uploaded_file.rb +13 -7
  41. data/lib/rack/query_parser.rb +7 -8
  42. data/lib/rack/recursive.rb +1 -1
  43. data/lib/rack/reloader.rb +1 -3
  44. data/lib/rack/request.rb +182 -76
  45. data/lib/rack/response.rb +62 -19
  46. data/lib/rack/rewindable_input.rb +0 -1
  47. data/lib/rack/runtime.rb +3 -3
  48. data/lib/rack/sendfile.rb +0 -3
  49. data/lib/rack/server.rb +9 -10
  50. data/lib/rack/session/abstract/id.rb +23 -28
  51. data/lib/rack/session/cookie.rb +1 -3
  52. data/lib/rack/session/pool.rb +1 -1
  53. data/lib/rack/show_exceptions.rb +6 -8
  54. data/lib/rack/show_status.rb +5 -7
  55. data/lib/rack/static.rb +13 -6
  56. data/lib/rack/tempfile_reaper.rb +0 -2
  57. data/lib/rack/urlmap.rb +1 -4
  58. data/lib/rack/utils.rb +58 -54
  59. data/lib/rack/version.rb +29 -0
  60. data/rack.gemspec +31 -29
  61. metadata +11 -12
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e12f073e1e04051923534a08cf31f175959a4217f1a793f43283e1bb902a7225
4
- data.tar.gz: e96008a1e0f77466d55c3834da7df2a4c640ec213306bab87e19bad5a9042c2c
3
+ metadata.gz: 67bdec7711476ad2de84fac3e118909b94332330645a6d347e09e350c5bf3dd6
4
+ data.tar.gz: 301f4cd141d1601d82f3e68cb967566be6422f8020f9a3ec7da1b665c9f2f61c
5
5
  SHA512:
6
- metadata.gz: f73e64b61cd21153bb90d23811b28026caa652f8eb4c682ebc02d8d5967b537f07c08d3d1b6d70cc14482d687637a2e539b384b119eb5b9be0d40c994577a2e7
7
- data.tar.gz: 512be9498bf6b40a18a7c4d3bcce2e2bc1818185e30e522def5c9461cfaa8ad68282b09f6457f40a38779e7711b732cc9dc0b126f96b35f3b451b8709cc45f9b
6
+ metadata.gz: 3c3cca256c84546a8af5faa34d99249d34273f25b7d6b0fc04e9b9212b637872af7c782625674ca07cf33aadee4421c2e82579072613d06349324b7a89733e69
7
+ data.tar.gz: 1dd24e07c20fd0b8aca78f93b083549c6c04bcec8e73a8e8aadea1037b359d0ec39b247027ef08bcc7150ee61b22c92cfadf2c3698be30e5101d750bb353ddfa
@@ -2,9 +2,120 @@
2
2
 
3
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
- ## Unreleased
5
+ ## [2.2.2] - 2020-02-11
6
6
 
7
- _Note: There are many unreleased changes in Rack (`master` is around 300 commits ahead of `2-0-stable`), and below is not an exhaustive list. If you would like to help out and document some of the unreleased changes, PRs are welcome._
7
+ ### Fixed
8
+
9
+ - Fix incorrect `Rack::Request#host` value. ([#1591](https://github.com/rack/rack/pull/1591), [@ioquatix](https://github.com/ioquatix))
10
+ - Revert `Rack::Handler::Thin` implementation. ([#1583](https://github.com/rack/rack/pull/1583), [@jeremyevans](https://github.com/jeremyevans))
11
+ - Double assignment is still needed to prevent an "unused variable" warning. ([#1589](https://github.com/rack/rack/pull/1589), [@kamipo](https://github.com/kamipo))
12
+ - Fix to handle same_site option for session pool. ([#1587](https://github.com/rack/rack/pull/1587), [@kamipo](https://github.com/kamipo))
13
+
14
+ ## [2.2.1] - 2020-02-09
15
+
16
+ ### Fixed
17
+
18
+ - Rework `Rack::Request#ip` to handle empty `forwarded_for`. ([#1577](https://github.com/rack/rack/pull/1577), [@ioquatix](https://github.com/ioquatix))
19
+
20
+ ## [2.2.0] - 2020-02-08
21
+
22
+ ### SPEC Changes
23
+
24
+ - `rack.session` request environment entry must respond to `to_hash` and return unfrozen Hash. ([@jeremyevans](https://github.com/jeremyevans))
25
+ - Request environment cannot be frozen. ([@jeremyevans](https://github.com/jeremyevans))
26
+ - CGI values in the request environment with non-ASCII characters must use ASCII-8BIT encoding. ([@jeremyevans](https://github.com/jeremyevans))
27
+ - 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))
28
+
29
+ ### Added
30
+
31
+ - `rackup` supports multiple `-r` options and will require all arguments. ([@jeremyevans](https://github.com/jeremyevans))
32
+ - `Server` supports an array of paths to require for the `:require` option. ([@khotta](https://github.com/khotta))
33
+ - `Files` supports multipart range requests. ([@fatkodima](https://github.com/fatkodima))
34
+ - `Multipart::UploadedFile` supports an IO-like object instead of using the filesystem, using `:filename` and `:io` options. ([@jeremyevans](https://github.com/jeremyevans))
35
+ - `Multipart::UploadedFile` supports keyword arguments `:path`, `:content_type`, and `:binary` in addition to positional arguments. ([@jeremyevans](https://github.com/jeremyevans))
36
+ - `Static` supports a `:cascade` option for calling the app if there is no matching file. ([@jeremyevans](https://github.com/jeremyevans))
37
+ - `Session::Abstract::SessionHash#dig`. ([@jeremyevans](https://github.com/jeremyevans))
38
+ - `Response.[]` and `MockResponse.[]` for creating instances using status, headers, and body. ([@ioquatix](https://github.com/ioquatix))
39
+ - Convenient cache and content type methods for `Rack::Response`. ([#1555](https://github.com/rack/rack/pull/1555), [@ioquatix](https://github.com/ioquatix))
40
+
41
+ ### Changed
42
+
43
+ - `Request#params` no longer rescues EOFError. ([@jeremyevans](https://github.com/jeremyevans))
44
+ - `Directory` uses a streaming approach, significantly improving time to first byte for large directories. ([@jeremyevans](https://github.com/jeremyevans))
45
+ - `Directory` no longer includes a Parent directory link in the root directory index. ([@jeremyevans](https://github.com/jeremyevans))
46
+ - `QueryParser#parse_nested_query` uses original backtrace when reraising exception with new class. ([@jeremyevans](https://github.com/jeremyevans))
47
+ - `ConditionalGet` follows RFC 7232 precedence if both If-None-Match and If-Modified-Since headers are provided. ([@jeremyevans](https://github.com/jeremyevans))
48
+ - `.ru` files supports the `frozen-string-literal` magic comment. ([@eregon](https://github.com/eregon))
49
+ - 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))
50
+ - `Etag` will continue sending ETag even if the response should not be cached. ([@henm](https://github.com/henm))
51
+ - `Request#host_with_port` no longer includes a colon for a missing or empty port. ([@AlexWayfer](https://github.com/AlexWayfer))
52
+ - All handlers uses keywords arguments instead of an options hash argument. ([@ioquatix](https://github.com/ioquatix))
53
+ - `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))
54
+ - `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))
55
+ - `Request#ssl?` is true for the `wss` scheme (secure websockets). ([@jeremyevans](https://github.com/jeremyevans))
56
+ - `Rack::HeaderHash` is memoized by default. ([#1549](https://github.com/rack/rack/pull/1549), [@ioquatix](https://github.com/ioquatix))
57
+ - `Rack::Directory` allow directory traversal inside root directory. ([#1417](https://github.com/rack/rack/pull/1417), [@ThomasSevestre](https://github.com/ThomasSevestre))
58
+ - Sort encodings by server preference. ([#1184](https://github.com/rack/rack/pull/1184), [@ioquatix](https://github.com/ioquatix), [@wjordan](https://github.com/wjordan))
59
+ - 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))
60
+ - `Rack::Builder` parsing options on first `#\` line is deprecated. ([#1574](https://github.com/rack/rack/pull/1574), [@ioquatix](https://github.com/ioquatix))
61
+
62
+ ### Removed
63
+
64
+ - `Directory#path` as it was not used and always returned nil. ([@jeremyevans](https://github.com/jeremyevans))
65
+ - `BodyProxy#each` as it was only needed to work around a bug in Ruby <1.9.3. ([@jeremyevans](https://github.com/jeremyevans))
66
+ - `URLMap::INFINITY` and `URLMap::NEGATIVE_INFINITY`, in favor of `Float::INFINITY`. ([@ch1c0t](https://github.com/ch1c0t))
67
+ - Deprecation of `Rack::File`. It will be deprecated again in rack 2.2 or 3.0. ([@rafaelfranca](https://github.com/rafaelfranca))
68
+ - Support for Ruby 2.2 as it is well past EOL. ([@ioquatix](https://github.com/ioquatix))
69
+ - Remove `Rack::Files#response_body` as the implementation was broken. ([#1153](https://github.com/rack/rack/pull/1153), [@ioquatix](https://github.com/ioquatix))
70
+ - Remove `SERVER_ADDR` which was never part of the original SPEC. ([#1573](https://github.com/rack/rack/pull/1573), [@ioquatix](https://github.com/ioquatix))
71
+
72
+ ### Fixed
73
+
74
+ - `Directory` correctly handles root paths containing glob metacharacters. ([@jeremyevans](https://github.com/jeremyevans))
75
+ - `Cascade` uses a new response object for each call if initialized with no apps. ([@jeremyevans](https://github.com/jeremyevans))
76
+ - `BodyProxy` correctly delegates keyword arguments to the body object on Ruby 2.7+. ([@jeremyevans](https://github.com/jeremyevans))
77
+ - `BodyProxy#method` correctly handles methods delegated to the body object. ([@jeremyevans](https://github.com/jeremyevans))
78
+ - `Request#host` and `Request#host_with_port` handle IPv6 addresses correctly. ([@AlexWayfer](https://github.com/AlexWayfer))
79
+ - `Lint` checks when response hijacking that `rack.hijack` is called with a valid object. ([@jeremyevans](https://github.com/jeremyevans))
80
+ - `Response#write` correctly updates `Content-Length` if initialized with a body. ([@jeremyevans](https://github.com/jeremyevans))
81
+ - `CommonLogger` includes `SCRIPT_NAME` when logging. ([@Erol](https://github.com/Erol))
82
+ - `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))
83
+ - `Directory` correctly escapes paths in links. ([@yous](https://github.com/yous))
84
+ - `Request#delete_cookie` and related `Utils` methods handle `:domain` and `:path` options in same call. ([@jeremyevans](https://github.com/jeremyevans))
85
+ - `Request#delete_cookie` and related `Utils` methods do an exact match on `:domain` and `:path` options. ([@jeremyevans](https://github.com/jeremyevans))
86
+ - `Static` no longer adds headers when a gzipped file request has a 304 response. ([@chooh](https://github.com/chooh))
87
+ - `ContentLength` sets `Content-Length` response header even for bodies not responding to `to_ary`. ([@jeremyevans](https://github.com/jeremyevans))
88
+ - Thin handler supports options passed directly to `Thin::Controllers::Controller`. ([@jeremyevans](https://github.com/jeremyevans))
89
+ - WEBrick handler no longer ignores `:BindAddress` option. ([@jeremyevans](https://github.com/jeremyevans))
90
+ - `ShowExceptions` handles invalid POST data. ([@jeremyevans](https://github.com/jeremyevans))
91
+ - Basic authentication requires a password, even if the password is empty. ([@jeremyevans](https://github.com/jeremyevans))
92
+ - `Lint` checks response is array with 3 elements, per SPEC. ([@jeremyevans](https://github.com/jeremyevans))
93
+ - Support for using `:SSLEnable` option when using WEBrick handler. (Gregor Melhorn)
94
+ - Close response body after buffering it when buffering. ([@ioquatix](https://github.com/ioquatix))
95
+ - Only accept `;` as delimiter when parsing cookies. ([@mrageh](https://github.com/mrageh))
96
+ - `Utils::HeaderHash#clear` clears the name mapping as well. ([@raxoft](https://github.com/raxoft))
97
+ - Support for passing `nil` `Rack::Files.new`, which notably fixes Rails' current `ActiveStorage::FileServer` implementation. ([@ioquatix](https://github.com/ioquatix))
98
+
99
+ ### Documentation
100
+
101
+ - CHANGELOG updates. ([@aupajo](https://github.com/aupajo))
102
+ - Added [CONTRIBUTING](CONTRIBUTING.md). ([@dblock](https://github.com/dblock))
103
+
104
+ ## [2.1.2] - 2020-01-27
105
+
106
+ - Fix multipart parser for some files to prevent denial of service ([@aiomaster](https://github.com/aiomaster))
107
+ - Fix `Rack::Builder#use` with keyword arguments ([@kamipo](https://github.com/kamipo))
108
+ - Skip deflating in Rack::Deflater if Content-Length is 0 ([@jeremyevans](https://github.com/jeremyevans))
109
+ - Remove `SessionHash#transform_keys`, no longer needed ([@pavel](https://github.com/pavel))
110
+ - Add to_hash to wrap Hash and Session classes ([@oleh-demyanyuk](https://github.com/oleh-demyanyuk))
111
+ - Handle case where session id key is requested but missing ([@jeremyevans](https://github.com/jeremyevans))
112
+
113
+ ## [2.1.1] - 2020-01-12
114
+
115
+ - Remove `Rack::Chunked` from `Rack::Server` default middleware. ([#1475](https://github.com/rack/rack/pull/1475), [@ioquatix](https://github.com/ioquatix))
116
+ - Restore support for code relying on `SessionId#to_s`. ([@jeremyevans](https://github.com/jeremyevans))
117
+
118
+ ## [2.1.0] - 2020-01-10
8
119
 
9
120
  ### Added
10
121
 
@@ -42,26 +153,35 @@ _Note: There are many unreleased changes in Rack (`master` is around 300 commits
42
153
  - Update codebase to avoid string mutations in preparation for `frozen_string_literals`. ([@pat](https://github.com/pat))
43
154
  - Change `MockRequest#env_for` to rely on the input optionally responding to `#size` instead of `#length`. ([@janko](https://github.com/janko))
44
155
  - Rename `Rack::File` -> `Rack::Files` and add deprecation notice. ([@postmodern](https://github.com/postmodern)).
156
+ - Prefer Base64 “strict encoding” for Base64 cookies. ([@ioquatix](https://github.com/ioquatix))
45
157
 
46
158
  ### Removed
47
159
 
48
160
  - Remove `to_ary` from Response ([@tenderlove](https://github.com/tenderlove))
49
161
  - Deprecate `Rack::Session::Memcache` in favor of `Rack::Session::Dalli` from dalli gem ([@fatkodima](https://github.com/fatkodima))
50
162
 
163
+ ### Fixed
164
+
165
+ - Eliminate warnings for Ruby 2.7. ([@osamtimizer](https://github.com/osamtimizer]))
166
+
51
167
  ### Documentation
52
168
 
53
169
  - Update broken example in `Session::Abstract::ID` documentation. ([tonytonyjan](https://github.com/tonytonyjan))
54
- - Add Padrino to the list of frameworks implmenting Rack. ([@wikimatze](https://github.com/wikimatze))
170
+ - Add Padrino to the list of frameworks implementing Rack. ([@wikimatze](https://github.com/wikimatze))
55
171
  - Remove Mongrel from the suggested server options in the help output. ([@tricknotes](https://github.com/tricknotes))
56
172
  - Replace `HISTORY.md` and `NEWS.md` with `CHANGELOG.md`. ([@twitnithegirl](https://github.com/twitnithegirl))
57
- - Backfill `CHANGELOG.md` from 2.0.1 to 2.0.7 releases. ([@drenmi](https://github.com/Drenmi))
173
+ - CHANGELOG updates. ([@drenmi](https://github.com/Drenmi), [@p8](https://github.com/p8))
58
174
 
59
175
  ## [2.0.8] - 2019-12-08
60
176
 
177
+ ### Security
178
+
61
179
  - [[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))
62
180
 
63
181
  ## [1.6.12] - 2019-12-08
64
182
 
183
+ ### Security
184
+
65
185
  - [[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))
66
186
 
67
187
  ## [2.0.7] - 2019-04-02
@@ -227,7 +347,7 @@ Items below this line are from the previously maintained HISTORY.md and NEWS.md
227
347
  - Fix CVE-2013-0263, timing attack against Rack::Session::Cookie
228
348
  - Fix CVE-2013-0262, symlink path traversal in Rack::File
229
349
  - Add various methods to Session for enhanced Rails compatibility
230
- - Request#trusted_proxy? now only matches whole stirngs
350
+ - Request#trusted_proxy? now only matches whole strings
231
351
  - Add JSON cookie coder, to be default in Rack 1.6+ due to security concerns
232
352
  - URLMap host matching in environments that don't set the Host header fixed
233
353
  - Fix a race condition that could result in overwritten pidfiles
@@ -465,7 +585,7 @@ Items below this line are from the previously maintained HISTORY.md and NEWS.md
465
585
  - Add status code lookup utility
466
586
  - Response should call #to_i on the status
467
587
  - Add Request#user_agent
468
- - Request#host knows about forwared host
588
+ - Request#host knows about forwarded host
469
589
  - Return an empty string for Request#host if HTTP_HOST and
470
590
  SERVER_NAME are both missing
471
591
  - Allow MockRequest to accept hash params
@@ -0,0 +1,136 @@
1
+ Contributing to Rack
2
+ =====================
3
+
4
+ Rack is work of [hundreds of contributors](https://github.com/rack/rack/graphs/contributors). You're encouraged to submit [pull requests](https://github.com/rack/rack/pulls), [propose features and discuss issues](https://github.com/rack/rack/issues). When in doubt, post to the [rack-devel](http://groups.google.com/group/rack-devel) mailing list.
5
+
6
+ #### Fork the Project
7
+
8
+ Fork the [project on Github](https://github.com/rack/rack) and check out your copy.
9
+
10
+ ```
11
+ git clone https://github.com/contributor/rack.git
12
+ cd rack
13
+ git remote add upstream https://github.com/rack/rack.git
14
+ ```
15
+
16
+ #### Create a Topic Branch
17
+
18
+ Make sure your fork is up-to-date and create a topic branch for your feature or bug fix.
19
+
20
+ ```
21
+ git checkout master
22
+ git pull upstream master
23
+ git checkout -b my-feature-branch
24
+ ```
25
+
26
+ #### Bundle Install and Quick Test
27
+
28
+ Ensure that you can build the project and run quick tests.
29
+
30
+ ```
31
+ bundle install --without extra
32
+ bundle exec rake test
33
+ ```
34
+
35
+ #### Running All Tests
36
+
37
+ Install all dependencies.
38
+
39
+ ```
40
+ bundle install
41
+ ```
42
+
43
+ Run all tests.
44
+
45
+ ```
46
+ rake test
47
+ ```
48
+
49
+ The test suite has no dependencies outside of the core Ruby installation and bacon.
50
+
51
+ Some tests will be skipped if a dependency is not found.
52
+
53
+ To run the test suite completely, you need:
54
+
55
+ * fcgi
56
+ * dalli
57
+ * thin
58
+
59
+ To test Memcache sessions, you need memcached (will be run on port 11211) and dalli installed.
60
+
61
+ #### Write Tests
62
+
63
+ Try to write a test that reproduces the problem you're trying to fix or describes a feature that you want to build.
64
+
65
+ We definitely appreciate pull requests that highlight or reproduce a problem, even without a fix.
66
+
67
+ #### Write Code
68
+
69
+ Implement your feature or bug fix.
70
+
71
+ Make sure that `bundle exec rake fulltest` completes without errors.
72
+
73
+ #### Write Documentation
74
+
75
+ Document any external behavior in the [README](README.rdoc).
76
+
77
+ #### Update Changelog
78
+
79
+ Add a line to [CHANGELOG](CHANGELOG.md).
80
+
81
+ #### Commit Changes
82
+
83
+ Make sure git knows your name and email address:
84
+
85
+ ```
86
+ git config --global user.name "Your Name"
87
+ git config --global user.email "contributor@example.com"
88
+ ```
89
+
90
+ Writing good commit logs is important. A commit log should describe what changed and why.
91
+
92
+ ```
93
+ git add ...
94
+ git commit
95
+ ```
96
+
97
+ #### Push
98
+
99
+ ```
100
+ git push origin my-feature-branch
101
+ ```
102
+
103
+ #### Make a Pull Request
104
+
105
+ Go to https://github.com/contributor/rack and select your feature branch. Click the 'Pull Request' button and fill out the form. Pull requests are usually reviewed within a few days.
106
+
107
+ #### Rebase
108
+
109
+ If you've been working on a change for a while, rebase with upstream/master.
110
+
111
+ ```
112
+ git fetch upstream
113
+ git rebase upstream/master
114
+ git push origin my-feature-branch -f
115
+ ```
116
+
117
+ #### Make Required Changes
118
+
119
+ Amend your previous commit and force push the changes.
120
+
121
+ ```
122
+ git commit --amend
123
+ git push origin my-feature-branch -f
124
+ ```
125
+
126
+ #### Check on Your Pull Request
127
+
128
+ Go back to your pull request after a few minutes and see whether it passed muster with Travis-CI. Everything should look green, otherwise fix issues and amend your commit as described above.
129
+
130
+ #### Be Patient
131
+
132
+ It's likely that your change will not be merged and that the nitpicky maintainers will ask you to do more, or fix seemingly benign problems. Hang on there!
133
+
134
+ #### Thank You
135
+
136
+ Please do know that we really appreciate and value your time and work. We love you, really.
@@ -5,6 +5,7 @@
5
5
  {<img src="https://circleci.com/gh/rack/rack.svg?style=svg" alt="CircleCI" />}[https://circleci.com/gh/rack/rack]
6
6
  {<img src="https://badge.fury.io/rb/rack.svg" alt="Gem Version" />}[http://badge.fury.io/rb/rack]
7
7
  {<img src="https://api.dependabot.com/badges/compatibility_score?dependency-name=rack&package-manager=bundler&version-scheme=semver" alt="SemVer Stability" />}[https://dependabot.com/compatibility-score.html?dependency-name=rack&package-manager=bundler&version-scheme=semver]
8
+ {<img src="http://inch-ci.org/github/rack/rack.svg?branch=master" alt="Inline docs" />}[http://inch-ci.org/github/rack/rack]
8
9
 
9
10
  \Rack provides a minimal, modular, and adaptable interface for developing
10
11
  web applications in Ruby. By wrapping HTTP requests and responses in
@@ -30,10 +31,11 @@ These web servers include \Rack handlers in their distributions:
30
31
 
31
32
  * Agoo[https://github.com/ohler55/agoo]
32
33
  * Falcon[https://github.com/socketry/falcon]
34
+ * Iodine[https://github.com/boazsegev/iodine]
33
35
  * {NGINX Unit}[https://unit.nginx.org/]
34
36
  * {Phusion Passenger}[https://www.phusionpassenger.com/] (which is mod_rack for Apache and for nginx)
35
37
  * Puma[https://puma.io/]
36
- * Unicorn[https://bogomips.org/unicorn/]
38
+ * Unicorn[https://yhbt.net/unicorn/]
37
39
  * uWSGI[https://uwsgi-docs.readthedocs.io/en/latest/]
38
40
 
39
41
  Any valid \Rack app will run the same on all these handlers, without
@@ -41,13 +43,12 @@ changing anything.
41
43
 
42
44
  == Supported web frameworks
43
45
 
44
- These frameworks include \Rack adapters in their distributions:
46
+ These frameworks and many others support the \Rack API:
45
47
 
46
48
  * Camping[http://www.ruby-camping.com/]
47
49
  * Coset[http://leahneukirchen.org/repos/coset/]
48
50
  * Hanami[https://hanamirb.org/]
49
51
  * Padrino[http://padrinorb.com/]
50
- * Racktools::SimpleApplication
51
52
  * Ramaze[http://ramaze.net/]
52
53
  * Roda[https://github.com/jeremyevans/roda]
53
54
  * {Ruby on Rails}[https://rubyonrails.org/]
@@ -55,19 +56,45 @@ These frameworks include \Rack adapters in their distributions:
55
56
  * Sinatra[http://sinatrarb.com/]
56
57
  * Utopia[https://github.com/socketry/utopia]
57
58
  * WABuR[https://github.com/ohler55/wabur]
58
- * ... and many others.
59
59
 
60
- == Available middleware
60
+ == Available middleware shipped with \Rack
61
61
 
62
62
  Between the server and the framework, \Rack can be customized to your
63
- applications needs using middleware, for example:
63
+ applications needs using middleware. \Rack itself ships with the following
64
+ middleware:
64
65
 
65
- * Rack::URLMap, to route to multiple applications inside the same process.
66
+ * Rack::Chunked, for streaming responses using chunked encoding.
66
67
  * Rack::CommonLogger, for creating Apache-style logfiles.
68
+ * Rack::ConditionalGet, for returning not modified responses when the response
69
+ has not changed.
70
+ * Rack::Config, for modifying the environment before processing the request.
71
+ * Rack::ContentLength, for setting Content-Length header based on body size.
72
+ * Rack::ContentType, for setting default Content-Type header for responses.
73
+ * Rack::Deflater, for compressing responses with gzip.
74
+ * Rack::ETag, for setting ETag header on string bodies.
75
+ * Rack::Events, for providing easy hooks when a request is received
76
+ and when the response is sent.
77
+ * Rack::Files, for serving static files.
78
+ * Rack::Head, for returning an empty body for HEAD requests.
79
+ * Rack::Lint, for checking conformance to the \Rack API.
80
+ * Rack::Lock, for serializing requests using a mutex.
81
+ * Rack::Logger, for setting a logger to handle logging errors.
82
+ * Rack::MethodOverride, for modifying the request method based on a submitted
83
+ parameter.
84
+ * Rack::Recursive, for including data from other paths in the application,
85
+ and for performing internal redirects.
86
+ * Rack::Reloader, for reloading files if they have been modified.
87
+ * Rack::Runtime, for including a response header with the time taken to
88
+ process the request.
89
+ * Rack::Sendfile, for working with web servers that can use optimized
90
+ file serving for file system paths.
67
91
  * Rack::ShowException, for catching unhandled exceptions and
68
92
  presenting them in a nice and helpful way with clickable backtrace.
69
- * Rack::Files, for serving static files.
70
- * ...many others!
93
+ * Rack::ShowStatus, for using nice error pages for empty client error
94
+ responses.
95
+ * Rack::Static, for more configurable serving of static files.
96
+ * Rack::TempfileReaper, for removing temporary files creating during a
97
+ request.
71
98
 
72
99
  All these components use the same interface, which is described in
73
100
  detail in the \Rack specification. These optional components can be
@@ -86,6 +113,15 @@ over:
86
113
  cookie handling.
87
114
  * Rack::MockRequest and Rack::MockResponse for efficient and quick
88
115
  testing of \Rack application without real HTTP round-trips.
116
+ * Rack::Cascade, for trying additional \Rack applications if an
117
+ application returns a not found or method not supported response.
118
+ * Rack::Directory, for serving files under a given directory, with
119
+ directory indexes.
120
+ * Rack::MediaType, for parsing Content-Type headers.
121
+ * Rack::Mime, for determining Content-Type based on file extension.
122
+ * Rack::RewindableInput, for making any IO object rewindable, using
123
+ a temporary file buffer.
124
+ * Rack::URLMap, to route to multiple applications inside the same process.
89
125
 
90
126
  == rack-contrib
91
127
 
@@ -125,46 +161,46 @@ A Gem of \Rack is available at {rubygems.org}[https://rubygems.org/gems/rack]. Y
125
161
 
126
162
  gem install rack
127
163
 
128
- == Running the tests
164
+ == Usage
129
165
 
130
- Testing \Rack requires the bacon testing framework:
166
+ You should require the library:
131
167
 
132
- bundle install --without extra # to be able to run the fast tests
168
+ require 'rack'
133
169
 
134
- Or:
170
+ \Rack uses autoload to automatically load other files \Rack ships with on demand,
171
+ so you should not need require paths under +rack+. If you require paths under
172
+ +rack+ without requiring +rack+ itself, things may not work correctly.
135
173
 
136
- bundle install # this assumes that you have installed native extensions!
174
+ == Configuration
137
175
 
138
- There is a rake-based test task:
176
+ Several parameters can be modified on Rack::Utils to configure \Rack behaviour.
139
177
 
140
- rake test # tests all the tests
178
+ e.g:
141
179
 
142
- The testsuite has no dependencies outside of the core Ruby
143
- installation and bacon.
180
+ Rack::Utils.key_space_limit = 128
144
181
 
145
- To run the test suite completely, you need:
182
+ === key_space_limit
146
183
 
147
- * fcgi
148
- * dalli
149
- * thin
184
+ The default number of bytes to allow all parameters keys in a given parameter hash to take up.
185
+ Does not affect nested parameter hashes, so doesn't actually prevent an attacker from using
186
+ more than this many bytes for parameter keys.
150
187
 
151
- To test Memcache sessions, you need memcached (will be
152
- run on port 11211) and dalli installed.
188
+ Defaults to 65536 characters.
153
189
 
154
- == Configuration
190
+ === param_depth_limit
155
191
 
156
- Several parameters can be modified on Rack::Utils to configure \Rack behaviour.
192
+ The maximum amount of nesting allowed in parameters.
193
+ For example, if set to 3, this query string would be allowed:
157
194
 
158
- e.g:
195
+ ?a[b][c]=d
159
196
 
160
- Rack::Utils.key_space_limit = 128
197
+ but this query string would not be allowed:
161
198
 
162
- === key_space_limit
199
+ ?a[b][c][d]=e
163
200
 
164
- The default number of bytes to allow a single parameter key to take up.
165
- This helps prevent a rogue client from flooding a Request.
201
+ Limiting the depth prevents a possible stack overflow when parsing parameters.
166
202
 
167
- Default to 65536 characters (4 kiB in worst case).
203
+ Defaults to 100.
168
204
 
169
205
  === multipart_part_limit
170
206
 
@@ -181,6 +217,10 @@ Can also be set via the +RACK_MULTIPART_PART_LIMIT+ environment variable.
181
217
 
182
218
  See {CHANGELOG.md}[https://github.com/rack/rack/blob/master/CHANGELOG.md].
183
219
 
220
+ == Contributing
221
+
222
+ See {CONTRIBUTING.md}[https://github.com/rack/rack/blob/master/CONTRIBUTING.md].
223
+
184
224
  == Contact
185
225
 
186
226
  Please post bugs, suggestions and patches to
@@ -198,7 +238,6 @@ Mailing list archives are available at
198
238
  Git repository (send Git patches to the mailing list):
199
239
 
200
240
  * https://github.com/rack/rack
201
- * http://git.vuxu.org/cgi-bin/gitweb.cgi?p=rack-github.git
202
241
 
203
242
  You are also welcome to join the #rack channel on irc.freenode.net.
204
243
 
@@ -206,20 +245,25 @@ You are also welcome to join the #rack channel on irc.freenode.net.
206
245
 
207
246
  The \Rack Core Team, consisting of
208
247
 
248
+ * Aaron Patterson (tenderlove[https://github.com/tenderlove])
249
+ * Samuel Williams (ioquatix[https://github.com/ioquatix])
250
+ * Jeremy Evans (jeremyevans[https://github.com/jeremyevans])
251
+ * Eileen Uchitelle (eileencodes[https://github.com/eileencodes])
252
+ * Matthew Draper (matthewd[https://github.com/matthewd])
253
+ * Rafael França (rafaelfranca[https://github.com/rafaelfranca])
254
+
255
+ and the \Rack Alumni
256
+
257
+ * Ryan Tomayko (rtomayko[https://github.com/rtomayko])
258
+ * Scytrin dai Kinthra (scytrin[https://github.com/scytrin])
209
259
  * Leah Neukirchen (leahneukirchen[https://github.com/leahneukirchen])
210
260
  * James Tucker (raggi[https://github.com/raggi])
211
261
  * Josh Peek (josh[https://github.com/josh])
212
262
  * José Valim (josevalim[https://github.com/josevalim])
213
263
  * Michael Fellinger (manveru[https://github.com/manveru])
214
- * Aaron Patterson (tenderlove[https://github.com/tenderlove])
215
264
  * Santiago Pastorino (spastorino[https://github.com/spastorino])
216
265
  * Konstantin Haase (rkh[https://github.com/rkh])
217
266
 
218
- and the \Rack Alumnis
219
-
220
- * Ryan Tomayko (rtomayko[https://github.com/rtomayko])
221
- * Scytrin dai Kinthra (scytrin[https://github.com/scytrin])
222
-
223
267
  would like to thank:
224
268
 
225
269
  * Adrian Madrid, for the LiteSpeed handler.