rack 1.6.11 → 2.1.4
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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +77 -0
- data/{COPYING → MIT-LICENSE} +4 -2
- data/README.rdoc +89 -139
- data/Rakefile +27 -28
- data/SPEC +6 -7
- data/bin/rackup +1 -0
- data/contrib/rack_logo.svg +164 -111
- data/example/lobster.ru +2 -0
- data/example/protectedlobster.rb +4 -2
- data/example/protectedlobster.ru +3 -1
- data/lib/rack/auth/abstract/handler.rb +3 -1
- data/lib/rack/auth/abstract/request.rb +7 -1
- data/lib/rack/auth/basic.rb +4 -1
- data/lib/rack/auth/digest/md5.rb +9 -7
- data/lib/rack/auth/digest/nonce.rb +6 -3
- data/lib/rack/auth/digest/params.rb +5 -4
- data/lib/rack/auth/digest/request.rb +3 -1
- data/lib/rack/body_proxy.rb +11 -9
- data/lib/rack/builder.rb +42 -18
- data/lib/rack/cascade.rb +6 -5
- data/lib/rack/chunked.rb +33 -10
- data/lib/rack/{commonlogger.rb → common_logger.rb} +11 -10
- data/lib/rack/{conditionalget.rb → conditional_get.rb} +3 -1
- data/lib/rack/config.rb +2 -0
- data/lib/rack/content_length.rb +5 -3
- data/lib/rack/content_type.rb +3 -1
- data/lib/rack/core_ext/regexp.rb +14 -0
- data/lib/rack/deflater.rb +33 -53
- data/lib/rack/directory.rb +75 -60
- data/lib/rack/etag.rb +8 -5
- data/lib/rack/events.rb +156 -0
- data/lib/rack/file.rb +4 -149
- data/lib/rack/files.rb +178 -0
- data/lib/rack/handler/cgi.rb +18 -17
- data/lib/rack/handler/fastcgi.rb +17 -16
- data/lib/rack/handler/lsws.rb +14 -12
- data/lib/rack/handler/scgi.rb +22 -19
- data/lib/rack/handler/thin.rb +6 -1
- data/lib/rack/handler/webrick.rb +28 -28
- data/lib/rack/handler.rb +9 -26
- data/lib/rack/head.rb +17 -17
- data/lib/rack/lint.rb +54 -51
- data/lib/rack/lobster.rb +8 -6
- data/lib/rack/lock.rb +17 -10
- data/lib/rack/logger.rb +4 -2
- data/lib/rack/media_type.rb +43 -0
- data/lib/rack/{methodoverride.rb → method_override.rb} +10 -8
- data/lib/rack/mime.rb +27 -6
- data/lib/rack/mock.rb +101 -60
- data/lib/rack/multipart/generator.rb +11 -12
- data/lib/rack/multipart/parser.rb +280 -161
- data/lib/rack/multipart/uploaded_file.rb +3 -2
- data/lib/rack/multipart.rb +39 -8
- data/lib/rack/{nulllogger.rb → null_logger.rb} +3 -1
- data/lib/rack/query_parser.rb +218 -0
- data/lib/rack/recursive.rb +11 -9
- data/lib/rack/reloader.rb +10 -4
- data/lib/rack/request.rb +447 -305
- data/lib/rack/response.rb +196 -83
- data/lib/rack/rewindable_input.rb +5 -14
- data/lib/rack/runtime.rb +12 -18
- data/lib/rack/sendfile.rb +19 -14
- data/lib/rack/server.rb +118 -41
- data/lib/rack/session/abstract/id.rb +215 -94
- data/lib/rack/session/cookie.rb +45 -28
- data/lib/rack/session/memcache.rb +4 -87
- data/lib/rack/session/pool.rb +25 -16
- data/lib/rack/show_exceptions.rb +392 -0
- data/lib/rack/{showstatus.rb → show_status.rb} +7 -5
- data/lib/rack/static.rb +41 -11
- data/lib/rack/tempfile_reaper.rb +4 -2
- data/lib/rack/urlmap.rb +25 -15
- data/lib/rack/utils.rb +186 -272
- data/lib/rack.rb +76 -24
- data/rack.gemspec +25 -14
- metadata +62 -182
- data/HISTORY.md +0 -375
- data/KNOWN-ISSUES +0 -44
- data/lib/rack/backports/uri/common_18.rb +0 -56
- data/lib/rack/backports/uri/common_192.rb +0 -52
- data/lib/rack/backports/uri/common_193.rb +0 -29
- data/lib/rack/handler/evented_mongrel.rb +0 -8
- data/lib/rack/handler/mongrel.rb +0 -106
- data/lib/rack/handler/swiftiplied_mongrel.rb +0 -8
- data/lib/rack/showexceptions.rb +0 -387
- data/lib/rack/utils/okjson.rb +0 -600
- data/test/builder/anything.rb +0 -5
- data/test/builder/comment.ru +0 -4
- data/test/builder/end.ru +0 -5
- data/test/builder/line.ru +0 -1
- data/test/builder/options.ru +0 -2
- data/test/cgi/assets/folder/test.js +0 -1
- data/test/cgi/assets/fonts/font.eot +0 -1
- data/test/cgi/assets/images/image.png +0 -1
- data/test/cgi/assets/index.html +0 -1
- data/test/cgi/assets/javascripts/app.js +0 -1
- data/test/cgi/assets/stylesheets/app.css +0 -1
- data/test/cgi/lighttpd.conf +0 -26
- data/test/cgi/rackup_stub.rb +0 -6
- data/test/cgi/sample_rackup.ru +0 -5
- data/test/cgi/test +0 -9
- data/test/cgi/test+directory/test+file +0 -1
- data/test/cgi/test.fcgi +0 -8
- data/test/cgi/test.ru +0 -5
- data/test/gemloader.rb +0 -10
- data/test/multipart/bad_robots +0 -259
- data/test/multipart/binary +0 -0
- data/test/multipart/content_type_and_no_filename +0 -6
- data/test/multipart/empty +0 -10
- data/test/multipart/fail_16384_nofile +0 -814
- data/test/multipart/file1.txt +0 -1
- data/test/multipart/filename_and_modification_param +0 -7
- data/test/multipart/filename_and_no_name +0 -6
- data/test/multipart/filename_with_escaped_quotes +0 -6
- data/test/multipart/filename_with_escaped_quotes_and_modification_param +0 -7
- data/test/multipart/filename_with_null_byte +0 -7
- data/test/multipart/filename_with_percent_escaped_quotes +0 -6
- data/test/multipart/filename_with_unescaped_percentages +0 -6
- data/test/multipart/filename_with_unescaped_percentages2 +0 -6
- data/test/multipart/filename_with_unescaped_percentages3 +0 -6
- data/test/multipart/filename_with_unescaped_quotes +0 -6
- data/test/multipart/ie +0 -6
- data/test/multipart/invalid_character +0 -6
- data/test/multipart/mixed_files +0 -21
- data/test/multipart/nested +0 -10
- data/test/multipart/none +0 -9
- data/test/multipart/semicolon +0 -6
- data/test/multipart/text +0 -15
- data/test/multipart/three_files_three_fields +0 -31
- data/test/multipart/webkit +0 -32
- data/test/rackup/config.ru +0 -31
- data/test/registering_handler/rack/handler/registering_myself.rb +0 -8
- data/test/spec_auth_basic.rb +0 -81
- data/test/spec_auth_digest.rb +0 -259
- data/test/spec_body_proxy.rb +0 -85
- data/test/spec_builder.rb +0 -223
- data/test/spec_cascade.rb +0 -61
- data/test/spec_cgi.rb +0 -102
- data/test/spec_chunked.rb +0 -101
- data/test/spec_commonlogger.rb +0 -93
- data/test/spec_conditionalget.rb +0 -102
- data/test/spec_config.rb +0 -22
- data/test/spec_content_length.rb +0 -85
- data/test/spec_content_type.rb +0 -45
- data/test/spec_deflater.rb +0 -339
- data/test/spec_directory.rb +0 -88
- data/test/spec_etag.rb +0 -107
- data/test/spec_fastcgi.rb +0 -107
- data/test/spec_file.rb +0 -221
- data/test/spec_handler.rb +0 -72
- data/test/spec_head.rb +0 -45
- data/test/spec_lint.rb +0 -550
- data/test/spec_lobster.rb +0 -58
- data/test/spec_lock.rb +0 -164
- data/test/spec_logger.rb +0 -23
- data/test/spec_methodoverride.rb +0 -111
- data/test/spec_mime.rb +0 -51
- data/test/spec_mock.rb +0 -297
- data/test/spec_mongrel.rb +0 -182
- data/test/spec_multipart.rb +0 -600
- data/test/spec_nulllogger.rb +0 -20
- data/test/spec_recursive.rb +0 -72
- data/test/spec_request.rb +0 -1232
- data/test/spec_response.rb +0 -407
- data/test/spec_rewindable_input.rb +0 -118
- data/test/spec_runtime.rb +0 -49
- data/test/spec_sendfile.rb +0 -130
- data/test/spec_server.rb +0 -167
- data/test/spec_session_abstract_id.rb +0 -53
- data/test/spec_session_cookie.rb +0 -410
- data/test/spec_session_memcache.rb +0 -321
- data/test/spec_session_pool.rb +0 -209
- data/test/spec_showexceptions.rb +0 -98
- data/test/spec_showstatus.rb +0 -103
- data/test/spec_static.rb +0 -145
- data/test/spec_tempfile_reaper.rb +0 -63
- data/test/spec_thin.rb +0 -91
- data/test/spec_urlmap.rb +0 -236
- data/test/spec_utils.rb +0 -647
- data/test/spec_version.rb +0 -17
- data/test/spec_webrick.rb +0 -184
- data/test/static/another/index.html +0 -1
- data/test/static/index.html +0 -1
- data/test/testrequest.rb +0 -78
- data/test/unregistered_handler/rack/handler/unregistered.rb +0 -7
- data/test/unregistered_handler/rack/handler/unregistered_long_one.rb +0 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3851dcf1bb18356cc36d8d390c8b2f7e9abde5a7068dac862246e8280a9d7c41
|
4
|
+
data.tar.gz: 5a5b9b318ba267f8ac3bd726048e6e826ff3feed3bb150252df91c7d038951cc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7d071738226e954ce7bf0507422e41857bba7a10ceed70c22263b279cbbd19d362066a6ac62999a47212878f7e26e659e396c6c6ee51eb5dc4d5617a41859597
|
7
|
+
data.tar.gz: 2d0ff8ec9f7fe54a4c0d88fd4ae51424b506df4c9a15324830ea36961dda8e5327250637f8b0a4168d4f66e95c815d0f2cc773c56f5a70dcadf5d50491723614
|
data/CHANGELOG.md
ADDED
@@ -0,0 +1,77 @@
|
|
1
|
+
## [2.1.4] - 2020-06-15
|
2
|
+
|
3
|
+
- [CVE-2020-8184] When parsing cookies, only decode the value
|
4
|
+
|
5
|
+
## [2.1.3] - 2020-05-12
|
6
|
+
|
7
|
+
- [CVE-2020-8161] Use Dir.entries instead of Dir[glob] to prevent user-specified glob metacharacters
|
8
|
+
-
|
9
|
+
## [2.1.2] - 2020-01-27
|
10
|
+
|
11
|
+
- Fix multipart parser for some files to prevent denial of service ([@aiomaster](https://github.com/aiomaster))
|
12
|
+
- Fix `Rack::Builder#use` with keyword arguments ([@kamipo](https://github.com/kamipo))
|
13
|
+
- Skip deflating in Rack::Deflater if Content-Length is 0 ([@jeremyevans](https://github.com/jeremyevans))
|
14
|
+
- Remove `SessionHash#transform_keys`, no longer needed ([@pavel](https://github.com/pavel))
|
15
|
+
- Add to_hash to wrap Hash and Session classes ([@oleh-demyanyuk](https://github.com/oleh-demyanyuk))
|
16
|
+
- Handle case where session id key is requested but missing ([@jeremyevans](https://github.com/jeremyevans))
|
17
|
+
|
18
|
+
## [2.1.1] - 2020-01-12
|
19
|
+
|
20
|
+
- Remove `Rack::Chunked` from `Rack::Server` default middleware. ([#1475](https://github.com/rack/rack/pull/1475), [@ioquatix](https://github.com/ioquatix))
|
21
|
+
|
22
|
+
## [2.1.0] - 2020-01-10
|
23
|
+
|
24
|
+
### Added
|
25
|
+
|
26
|
+
- Add support for `SameSite=None` cookie value. ([@hennikul](https://github.com/hennikul))
|
27
|
+
- Add trailer headers. ([@eileencodes](https://github.com/eileencodes))
|
28
|
+
- Add MIME Types for video streaming. ([@styd](https://github.com/styd))
|
29
|
+
- Add MIME Type for WASM. ([@buildrtech](https://github.com/buildrtech))
|
30
|
+
- Add `Early Hints(103)` to status codes. ([@egtra](https://github.com/egtra))
|
31
|
+
- Add `Too Early(425)` to status codes. ([@y-yagi]((https://github.com/y-yagi)))
|
32
|
+
- Add `Bandwidth Limit Exceeded(509)` to status codes. ([@CJKinni](https://github.com/CJKinni))
|
33
|
+
- Add method for custom `ip_filter`. ([@svcastaneda](https://github.com/svcastaneda))
|
34
|
+
- Add boot-time profiling capabilities to `rackup`. ([@tenderlove](https://github.com/tenderlove))
|
35
|
+
- Add multi mapping support for `X-Accel-Mappings` header. ([@yoshuki](https://github.com/yoshuki))
|
36
|
+
- Add `sync: false` option to `Rack::Deflater`. (Eric Wong)
|
37
|
+
- Add `Builder#freeze_app` to freeze application and all middleware instances. ([@jeremyevans](https://github.com/jeremyevans))
|
38
|
+
- Add API to extract cookies from `Rack::MockResponse`. ([@petercline](https://github.com/petercline))
|
39
|
+
|
40
|
+
### Changed
|
41
|
+
|
42
|
+
- Don't propagate nil values from middleware. ([@ioquatix](https://github.com/ioquatix))
|
43
|
+
- Lazily initialize the response body and only buffer it if required. ([@ioquatix](https://github.com/ioquatix))
|
44
|
+
- Fix deflater zlib buffer errors on empty body part. ([@felixbuenemann](https://github.com/felixbuenemann))
|
45
|
+
- Set `X-Accel-Redirect` to percent-encoded path. ([@diskkid](https://github.com/diskkid))
|
46
|
+
- Remove unnecessary buffer growing when parsing multipart. ([@tainoe](https://github.com/tainoe))
|
47
|
+
- Expand the root path in `Rack::Static` upon initialization. ([@rosenfeld](https://github.com/rosenfeld))
|
48
|
+
- Make `ShowExceptions` work with binary data. ([@axyjo](https://github.com/axyjo))
|
49
|
+
- Use buffer string when parsing multipart requests. ([@janko-m](https://github.com/janko-m))
|
50
|
+
- Support optional UTF-8 Byte Order Mark (BOM) in config.ru. ([@mikegee](https://github.com/mikegee))
|
51
|
+
- Handle `X-Forwarded-For` with optional port. ([@dpritchett](https://github.com/dpritchett))
|
52
|
+
- Use `Time#httpdate` format for Expires, as proposed by RFC 7231. ([@nanaya](https://github.com/nanaya))
|
53
|
+
- Make `Utils.status_code` raise an error when the status symbol is invalid instead of `500`. ([@adambutler](https://github.com/adambutler))
|
54
|
+
- Rename `Request::SCHEME_WHITELIST` to `Request::ALLOWED_SCHEMES`.
|
55
|
+
- Make `Multipart::Parser.get_filename` accept files with `+` in their name. ([@lucaskanashiro](https://github.com/lucaskanashiro))
|
56
|
+
- Add Falcon to the default handler fallbacks. ([@ioquatix](https://github.com/ioquatix))
|
57
|
+
- Update codebase to avoid string mutations in preparation for `frozen_string_literals`. ([@pat](https://github.com/pat))
|
58
|
+
- Change `MockRequest#env_for` to rely on the input optionally responding to `#size` instead of `#length`. ([@janko](https://github.com/janko))
|
59
|
+
- Rename `Rack::File` -> `Rack::Files` and add deprecation notice. ([@postmodern](https://github.com/postmodern)).
|
60
|
+
- Prefer Base64 “strict encoding” for Base64 cookies. ([@ioquatix](https://github.com/ioquatix))
|
61
|
+
|
62
|
+
### Removed
|
63
|
+
|
64
|
+
- Remove `to_ary` from Response ([@tenderlove](https://github.com/tenderlove))
|
65
|
+
- Deprecate `Rack::Session::Memcache` in favor of `Rack::Session::Dalli` from dalli gem ([@fatkodima](https://github.com/fatkodima))
|
66
|
+
|
67
|
+
### Fixed
|
68
|
+
|
69
|
+
- Eliminate warnings for Ruby 2.7. ([@osamtimizer](https://github.com/osamtimizer]))
|
70
|
+
|
71
|
+
### Documentation
|
72
|
+
|
73
|
+
- Update broken example in `Session::Abstract::ID` documentation. ([tonytonyjan](https://github.com/tonytonyjan))
|
74
|
+
- Add Padrino to the list of frameworks implmenting Rack. ([@wikimatze](https://github.com/wikimatze))
|
75
|
+
- Remove Mongrel from the suggested server options in the help output. ([@tricknotes](https://github.com/tricknotes))
|
76
|
+
- Replace `HISTORY.md` and `NEWS.md` with `CHANGELOG.md`. ([@twitnithegirl](https://github.com/twitnithegirl))
|
77
|
+
- CHANGELOG updates. ([@drenmi](https://github.com/Drenmi), [@p8](https://github.com/p8))
|
data/{COPYING → MIT-LICENSE}
RENAMED
@@ -1,4 +1,6 @@
|
|
1
|
-
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (C) 2007-2019 Leah Neukirchen <http://leahneukirchen.org/infopage.html>
|
2
4
|
|
3
5
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
4
6
|
of this software and associated documentation files (the "Software"), to
|
@@ -13,6 +15,6 @@ all copies or substantial portions of the Software.
|
|
13
15
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
14
16
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
15
17
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
16
|
-
THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
18
|
+
THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
17
19
|
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
18
20
|
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.rdoc
CHANGED
@@ -1,110 +1,109 @@
|
|
1
|
-
= Rack, a modular Ruby webserver interface
|
1
|
+
= \Rack, a modular Ruby webserver interface
|
2
2
|
|
3
|
-
|
4
|
-
|
3
|
+
{<img src="https://rack.github.io/logo.png" width="400" alt="rack powers web applications" />}[https://rack.github.io/]
|
4
|
+
|
5
|
+
{<img src="https://circleci.com/gh/rack/rack.svg?style=svg" alt="CircleCI" />}[https://circleci.com/gh/rack/rack]
|
6
|
+
{<img src="https://badge.fury.io/rb/rack.svg" alt="Gem Version" />}[http://badge.fury.io/rb/rack]
|
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
|
+
|
9
|
+
\Rack provides a minimal, modular, and adaptable interface for developing
|
10
|
+
web applications in Ruby. By wrapping HTTP requests and responses in
|
5
11
|
the simplest way possible, it unifies and distills the API for web
|
6
12
|
servers, web frameworks, and software in between (the so-called
|
7
13
|
middleware) into a single method call.
|
8
14
|
|
9
|
-
The exact details of this are described in the Rack specification,
|
10
|
-
which all Rack applications should conform to.
|
15
|
+
The exact details of this are described in the \Rack specification,
|
16
|
+
which all \Rack applications should conform to.
|
11
17
|
|
12
18
|
== Supported web servers
|
13
19
|
|
14
|
-
The included *handlers* connect all kinds of web servers to Rack:
|
15
|
-
|
16
|
-
*
|
17
|
-
* SwiftipliedMongrel
|
18
|
-
* WEBrick
|
20
|
+
The included *handlers* connect all kinds of web servers to \Rack:
|
21
|
+
|
22
|
+
* WEBrick[https://github.com/ruby/webrick]
|
19
23
|
* FCGI
|
20
24
|
* CGI
|
21
25
|
* SCGI
|
22
|
-
* LiteSpeed
|
23
|
-
* Thin
|
24
|
-
|
25
|
-
These web servers include Rack handlers in their distributions:
|
26
|
-
|
27
|
-
*
|
28
|
-
*
|
29
|
-
*
|
30
|
-
*
|
31
|
-
*
|
32
|
-
*
|
33
|
-
*
|
34
|
-
|
35
|
-
|
36
|
-
* yahns
|
37
|
-
* Zbatery
|
38
|
-
|
39
|
-
Any valid Rack app will run the same on all these handlers, without
|
26
|
+
* LiteSpeed[https://www.litespeedtech.com/]
|
27
|
+
* Thin[https://rubygems.org/gems/thin]
|
28
|
+
|
29
|
+
These web servers include \Rack handlers in their distributions:
|
30
|
+
|
31
|
+
* Agoo[https://github.com/ohler55/agoo]
|
32
|
+
* Falcon[https://github.com/socketry/falcon]
|
33
|
+
* {NGINX Unit}[https://unit.nginx.org/]
|
34
|
+
* {Phusion Passenger}[https://www.phusionpassenger.com/] (which is mod_rack for Apache and for nginx)
|
35
|
+
* Puma[https://puma.io/]
|
36
|
+
* Unicorn[https://bogomips.org/unicorn/]
|
37
|
+
* uWSGI[https://uwsgi-docs.readthedocs.io/en/latest/]
|
38
|
+
|
39
|
+
Any valid \Rack app will run the same on all these handlers, without
|
40
40
|
changing anything.
|
41
41
|
|
42
42
|
== Supported web frameworks
|
43
43
|
|
44
|
-
These frameworks include Rack adapters in their distributions:
|
45
|
-
|
46
|
-
*
|
47
|
-
*
|
48
|
-
*
|
49
|
-
*
|
50
|
-
* Maveric
|
51
|
-
* Merb
|
44
|
+
These frameworks include \Rack adapters in their distributions:
|
45
|
+
|
46
|
+
* Camping[http://www.ruby-camping.com/]
|
47
|
+
* Coset[http://leahneukirchen.org/repos/coset/]
|
48
|
+
* Hanami[https://hanamirb.org/]
|
49
|
+
* Padrino[http://padrinorb.com/]
|
52
50
|
* Racktools::SimpleApplication
|
53
|
-
* Ramaze
|
54
|
-
*
|
55
|
-
*
|
56
|
-
*
|
57
|
-
*
|
58
|
-
*
|
59
|
-
*
|
60
|
-
* Wee
|
51
|
+
* Ramaze[http://ramaze.net/]
|
52
|
+
* Roda[https://github.com/jeremyevans/roda]
|
53
|
+
* {Ruby on Rails}[https://rubyonrails.org/]
|
54
|
+
* Rum[https://github.com/leahneukirchen/rum]
|
55
|
+
* Sinatra[http://sinatrarb.com/]
|
56
|
+
* Utopia[https://github.com/socketry/utopia]
|
57
|
+
* WABuR[https://github.com/ohler55/wabur]
|
61
58
|
* ... and many others.
|
62
59
|
|
63
60
|
== Available middleware
|
64
61
|
|
65
|
-
Between the server and the framework, Rack can be customized to your
|
62
|
+
Between the server and the framework, \Rack can be customized to your
|
66
63
|
applications needs using middleware, for example:
|
64
|
+
|
67
65
|
* Rack::URLMap, to route to multiple applications inside the same process.
|
68
66
|
* Rack::CommonLogger, for creating Apache-style logfiles.
|
69
67
|
* Rack::ShowException, for catching unhandled exceptions and
|
70
68
|
presenting them in a nice and helpful way with clickable backtrace.
|
71
|
-
* Rack::
|
69
|
+
* Rack::Files, for serving static files.
|
72
70
|
* ...many others!
|
73
71
|
|
74
72
|
All these components use the same interface, which is described in
|
75
|
-
detail in the Rack specification. These optional components can be
|
73
|
+
detail in the \Rack specification. These optional components can be
|
76
74
|
used in any way you wish.
|
77
75
|
|
78
76
|
== Convenience
|
79
77
|
|
80
78
|
If you want to develop outside of existing frameworks, implement your
|
81
|
-
own ones, or develop middleware, Rack provides many helpers to create
|
82
|
-
Rack applications quickly and without doing the same web stuff all
|
79
|
+
own ones, or develop middleware, \Rack provides many helpers to create
|
80
|
+
\Rack applications quickly and without doing the same web stuff all
|
83
81
|
over:
|
82
|
+
|
84
83
|
* Rack::Request, which also provides query string parsing and
|
85
84
|
multipart handling.
|
86
85
|
* Rack::Response, for convenient generation of HTTP replies and
|
87
86
|
cookie handling.
|
88
87
|
* Rack::MockRequest and Rack::MockResponse for efficient and quick
|
89
|
-
testing of Rack application without real HTTP round-trips.
|
88
|
+
testing of \Rack application without real HTTP round-trips.
|
90
89
|
|
91
90
|
== rack-contrib
|
92
91
|
|
93
92
|
The plethora of useful middleware created the need for a project that
|
94
|
-
collects fresh Rack middleware. rack-contrib includes a variety of
|
95
|
-
add-on components for Rack and it is easy to contribute new modules.
|
93
|
+
collects fresh \Rack middleware. rack-contrib includes a variety of
|
94
|
+
add-on components for \Rack and it is easy to contribute new modules.
|
96
95
|
|
97
96
|
* https://github.com/rack/rack-contrib
|
98
97
|
|
99
98
|
== rackup
|
100
99
|
|
101
|
-
rackup is a useful tool for running Rack applications, which uses the
|
100
|
+
rackup is a useful tool for running \Rack applications, which uses the
|
102
101
|
Rack::Builder DSL to configure middleware and build up applications
|
103
102
|
easily.
|
104
103
|
|
105
104
|
rackup automatically figures out the environment it is run in, and
|
106
|
-
runs your application as FastCGI, CGI, or
|
107
|
-
|
105
|
+
runs your application as FastCGI, CGI, or WEBrick---all from the
|
106
|
+
same configuration.
|
108
107
|
|
109
108
|
== Quick start
|
110
109
|
|
@@ -122,18 +121,13 @@ By default, the lobster is found at http://localhost:9292.
|
|
122
121
|
|
123
122
|
== Installing with RubyGems
|
124
123
|
|
125
|
-
A Gem of Rack is available at rubygems.org.
|
124
|
+
A Gem of \Rack is available at {rubygems.org}[https://rubygems.org/gems/rack]. You can install it with:
|
126
125
|
|
127
126
|
gem install rack
|
128
127
|
|
129
|
-
I also provide a local mirror of the gems (and development snapshots)
|
130
|
-
at my site:
|
131
|
-
|
132
|
-
gem install rack --source http://chneukirchen.org/releases/gems/
|
133
|
-
|
134
128
|
== Running the tests
|
135
129
|
|
136
|
-
Testing Rack requires the bacon testing framework:
|
130
|
+
Testing \Rack requires the bacon testing framework:
|
137
131
|
|
138
132
|
bundle install --without extra # to be able to run the fast tests
|
139
133
|
|
@@ -141,49 +135,25 @@ Or:
|
|
141
135
|
|
142
136
|
bundle install # this assumes that you have installed native extensions!
|
143
137
|
|
144
|
-
There
|
138
|
+
There is a rake-based test task:
|
145
139
|
|
146
|
-
rake test
|
147
|
-
rake fulltest runs all the tests
|
140
|
+
rake test # tests all the tests
|
148
141
|
|
149
|
-
The
|
142
|
+
The testsuite has no dependencies outside of the core Ruby
|
150
143
|
installation and bacon.
|
151
144
|
|
152
145
|
To run the test suite completely, you need:
|
153
146
|
|
154
147
|
* fcgi
|
155
|
-
*
|
156
|
-
* mongrel
|
148
|
+
* dalli
|
157
149
|
* thin
|
158
150
|
|
159
|
-
|
160
|
-
|
161
|
-
libraries and the fcgi gem:
|
162
|
-
|
163
|
-
Download and install lighttpd:
|
164
|
-
|
165
|
-
http://www.lighttpd.net/download
|
166
|
-
|
167
|
-
Installing the FCGI libraries:
|
168
|
-
|
169
|
-
curl -O http://www.fastcgi.com/dist/fcgi-2.4.0.tar.gz
|
170
|
-
tar xzvf fcgi-2.4.0.tar.gz
|
171
|
-
cd fcgi-2.4.0
|
172
|
-
./configure --prefix=/usr/local
|
173
|
-
make
|
174
|
-
sudo make install
|
175
|
-
cd ..
|
176
|
-
|
177
|
-
Installing the Ruby fcgi gem:
|
178
|
-
|
179
|
-
gem install fcgi
|
180
|
-
|
181
|
-
Furthermore, to test Memcache sessions, you need memcached (will be
|
182
|
-
run on port 11211) and memcache-client installed.
|
151
|
+
To test Memcache sessions, you need memcached (will be
|
152
|
+
run on port 11211) and dalli installed.
|
183
153
|
|
184
154
|
== Configuration
|
185
155
|
|
186
|
-
Several parameters can be modified on Rack::Utils to configure Rack behaviour.
|
156
|
+
Several parameters can be modified on Rack::Utils to configure \Rack behaviour.
|
187
157
|
|
188
158
|
e.g:
|
189
159
|
|
@@ -205,27 +175,28 @@ The default is 128, which means that a single request can't upload more than 128
|
|
205
175
|
|
206
176
|
Set to 0 for no limit.
|
207
177
|
|
208
|
-
Can also be set via the RACK_MULTIPART_PART_LIMIT environment variable.
|
178
|
+
Can also be set via the +RACK_MULTIPART_PART_LIMIT+ environment variable.
|
209
179
|
|
210
|
-
==
|
180
|
+
== Changelog
|
211
181
|
|
212
|
-
See
|
182
|
+
See {CHANGELOG.md}[https://github.com/rack/rack/blob/master/CHANGELOG.md].
|
213
183
|
|
214
184
|
== Contact
|
215
185
|
|
216
186
|
Please post bugs, suggestions and patches to
|
217
|
-
the bug tracker at
|
187
|
+
the bug tracker at {issues}[https://github.com/rack/rack/issues].
|
218
188
|
|
219
189
|
Please post security related bugs and suggestions to the core team at
|
220
|
-
<https://groups.google.com/
|
190
|
+
<https://groups.google.com/forum/#!forum/rack-core> or rack-core@googlegroups.com. This
|
221
191
|
list is not public. Due to wide usage of the library, it is strongly preferred
|
222
192
|
that we manage timing in order to provide viable patches at the time of
|
223
193
|
disclosure. Your assistance in this matter is greatly appreciated.
|
224
194
|
|
225
195
|
Mailing list archives are available at
|
226
|
-
<https://groups.google.com/
|
196
|
+
<https://groups.google.com/forum/#!forum/rack-devel>.
|
227
197
|
|
228
198
|
Git repository (send Git patches to the mailing list):
|
199
|
+
|
229
200
|
* https://github.com/rack/rack
|
230
201
|
* http://git.vuxu.org/cgi-bin/gitweb.cgi?p=rack-github.git
|
231
202
|
|
@@ -233,21 +204,21 @@ You are also welcome to join the #rack channel on irc.freenode.net.
|
|
233
204
|
|
234
205
|
== Thanks
|
235
206
|
|
236
|
-
The Rack Core Team, consisting of
|
207
|
+
The \Rack Core Team, consisting of
|
237
208
|
|
238
|
-
*
|
239
|
-
* James Tucker (raggi)
|
240
|
-
* Josh Peek (josh)
|
241
|
-
* José Valim (josevalim)
|
242
|
-
* Michael Fellinger (manveru)
|
243
|
-
* Aaron Patterson (tenderlove)
|
244
|
-
* Santiago Pastorino (spastorino)
|
245
|
-
* Konstantin Haase (rkh)
|
209
|
+
* Leah Neukirchen (leahneukirchen[https://github.com/leahneukirchen])
|
210
|
+
* James Tucker (raggi[https://github.com/raggi])
|
211
|
+
* Josh Peek (josh[https://github.com/josh])
|
212
|
+
* José Valim (josevalim[https://github.com/josevalim])
|
213
|
+
* Michael Fellinger (manveru[https://github.com/manveru])
|
214
|
+
* Aaron Patterson (tenderlove[https://github.com/tenderlove])
|
215
|
+
* Santiago Pastorino (spastorino[https://github.com/spastorino])
|
216
|
+
* Konstantin Haase (rkh[https://github.com/rkh])
|
246
217
|
|
247
|
-
and the Rack Alumnis
|
218
|
+
and the \Rack Alumnis
|
248
219
|
|
249
|
-
* Ryan Tomayko (rtomayko)
|
250
|
-
* Scytrin dai Kinthra (scytrin)
|
220
|
+
* Ryan Tomayko (rtomayko[https://github.com/rtomayko])
|
221
|
+
* Scytrin dai Kinthra (scytrin[https://github.com/scytrin])
|
251
222
|
|
252
223
|
would like to thank:
|
253
224
|
|
@@ -276,37 +247,16 @@ would like to thank:
|
|
276
247
|
* Alexander Kellett for testing the Gem and reviewing the announcement.
|
277
248
|
* Marcus Rückert, for help with configuring and debugging lighttpd.
|
278
249
|
* The WSGI team for the well-done and documented work they've done and
|
279
|
-
Rack builds up on.
|
250
|
+
\Rack builds up on.
|
280
251
|
* All bug reporters and patch contributors not mentioned above.
|
281
252
|
|
282
|
-
== Copyright
|
283
|
-
|
284
|
-
Copyright (C) 2007, 2008, 2009, 2010 Christian Neukirchen <http://purl.org/net/chneukirchen>
|
285
|
-
|
286
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
287
|
-
of this software and associated documentation files (the "Software"), to
|
288
|
-
deal in the Software without restriction, including without limitation the
|
289
|
-
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
290
|
-
sell copies of the Software, and to permit persons to whom the Software is
|
291
|
-
furnished to do so, subject to the following conditions:
|
292
|
-
|
293
|
-
The above copyright notice and this permission notice shall be included in
|
294
|
-
all copies or substantial portions of the Software.
|
295
|
-
|
296
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
297
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
298
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
299
|
-
THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
300
|
-
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
301
|
-
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
302
|
-
|
303
253
|
== Links
|
304
254
|
|
305
|
-
Rack:: <
|
306
|
-
Official Rack repositories:: <https://github.com/rack>
|
307
|
-
Rack Bug Tracking:: <https://github.com/rack/rack/issues>
|
308
|
-
rack-devel mailing list:: <https://groups.google.com/
|
309
|
-
Rack's Rubyforge project:: <http://rubyforge.org/projects/rack>
|
255
|
+
\Rack:: <https://rack.github.io/>
|
256
|
+
Official \Rack repositories:: <https://github.com/rack>
|
257
|
+
\Rack Bug Tracking:: <https://github.com/rack/rack/issues>
|
258
|
+
rack-devel mailing list:: <https://groups.google.com/forum/#!forum/rack-devel>
|
310
259
|
|
311
|
-
|
260
|
+
== License
|
312
261
|
|
262
|
+
\Rack is released under the {MIT License}[https://opensource.org/licenses/MIT].
|
data/Rakefile
CHANGED
@@ -1,7 +1,9 @@
|
|
1
|
-
#
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "rake/testtask"
|
2
4
|
|
3
5
|
desc "Run all the tests"
|
4
|
-
task :
|
6
|
+
task default: :test
|
5
7
|
|
6
8
|
desc "Install gem dependencies"
|
7
9
|
task :deps do
|
@@ -16,7 +18,7 @@ task :deps do
|
|
16
18
|
end
|
17
19
|
|
18
20
|
desc "Make an archive as .tar.gz"
|
19
|
-
task :
|
21
|
+
task dist: %w[chmod changelog spec rdoc] do
|
20
22
|
sh "git archive --format=tar --prefix=#{release}/ HEAD^{tree} >#{release}.tar"
|
21
23
|
sh "pax -waf #{release}.tar -s ':^:#{release}/:' SPEC ChangeLog doc rack.gemspec"
|
22
24
|
sh "gzip -f -9 #{release}.tar"
|
@@ -31,12 +33,12 @@ task :officialrelease do
|
|
31
33
|
sh "mv stage/#{release}.tar.gz stage/#{release}.gem ."
|
32
34
|
end
|
33
35
|
|
34
|
-
task :
|
36
|
+
task officialrelease_really: %w[spec dist gem] do
|
35
37
|
sh "shasum #{release}.tar.gz #{release}.gem"
|
36
38
|
end
|
37
39
|
|
38
40
|
def release
|
39
|
-
"rack
|
41
|
+
"rack-" + File.read('lib/rack.rb')[/RELEASE += +([\"\'])([\d][\w\.]+)\1/, 2]
|
40
42
|
end
|
41
43
|
|
42
44
|
desc "Make binaries executable"
|
@@ -46,13 +48,13 @@ task :chmod do
|
|
46
48
|
end
|
47
49
|
|
48
50
|
desc "Generate a ChangeLog"
|
49
|
-
task :
|
51
|
+
task changelog: "ChangeLog"
|
50
52
|
|
51
53
|
file '.git/index'
|
52
54
|
file "ChangeLog" => '.git/index' do
|
53
55
|
File.open("ChangeLog", "w") { |out|
|
54
56
|
log = `git log -z`
|
55
|
-
log.force_encoding(Encoding::BINARY)
|
57
|
+
log.force_encoding(Encoding::BINARY)
|
56
58
|
log.split("\0").map { |chunk|
|
57
59
|
author = chunk[/Author: (.*)/, 1].strip
|
58
60
|
date = chunk[/Date: (.*)/, 1].strip
|
@@ -68,8 +70,10 @@ file "ChangeLog" => '.git/index' do
|
|
68
70
|
}
|
69
71
|
end
|
70
72
|
|
71
|
-
file 'lib/rack/lint.rb'
|
72
73
|
desc "Generate Rack Specification"
|
74
|
+
task spec: "SPEC"
|
75
|
+
|
76
|
+
file 'lib/rack/lint.rb'
|
73
77
|
file "SPEC" => 'lib/rack/lint.rb' do
|
74
78
|
File.open("SPEC", "wb") { |file|
|
75
79
|
IO.foreach("lib/rack/lint.rb") { |line|
|
@@ -80,32 +84,27 @@ file "SPEC" => 'lib/rack/lint.rb' do
|
|
80
84
|
}
|
81
85
|
end
|
82
86
|
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
sh "bacon -w -I./lib:./test #{opts} #{specopts}"
|
87
|
+
Rake::TestTask.new("test:regular") do |t|
|
88
|
+
t.libs << "test"
|
89
|
+
t.test_files = FileList["test/**/*_test.rb", "test/**/spec_*.rb", "test/gemloader.rb"]
|
90
|
+
t.warning = false
|
91
|
+
t.verbose = true
|
90
92
|
end
|
91
93
|
|
92
|
-
desc "Run all the
|
93
|
-
task :
|
94
|
+
desc "Run all the fast + platform agnostic tests"
|
95
|
+
task test: %w[spec test:regular]
|
94
96
|
|
95
|
-
desc "Run all the tests"
|
96
|
-
task :
|
97
|
-
opts = ENV['TEST'] || '-a'
|
98
|
-
specopts = ENV['TESTOPTS'] || '-q'
|
99
|
-
sh "bacon -r./test/gemloader -I./lib:./test -w #{opts} #{specopts}"
|
100
|
-
end
|
97
|
+
desc "Run all the tests we run on CI"
|
98
|
+
task ci: :test
|
101
99
|
|
102
|
-
task :
|
100
|
+
task gem: :spec do
|
103
101
|
sh "gem build rack.gemspec"
|
104
102
|
end
|
105
103
|
|
106
|
-
task :
|
104
|
+
task doc: :rdoc
|
105
|
+
|
107
106
|
desc "Generate RDoc documentation"
|
108
|
-
task :
|
107
|
+
task rdoc: %w[changelog spec] do
|
109
108
|
sh(*%w{rdoc --line-numbers --main README.rdoc
|
110
109
|
--title 'Rack\ Documentation' --charset utf-8 -U -o doc} +
|
111
110
|
%w{README.rdoc KNOWN-ISSUES SPEC ChangeLog} +
|
@@ -113,11 +112,11 @@ task :rdoc => %w[ChangeLog SPEC] do
|
|
113
112
|
cp "contrib/rdoc.css", "doc/rdoc.css"
|
114
113
|
end
|
115
114
|
|
116
|
-
task :
|
115
|
+
task pushdoc: :rdoc do
|
117
116
|
sh "rsync -avz doc/ rack.rubyforge.org:/var/www/gforge-projects/rack/doc/"
|
118
117
|
end
|
119
118
|
|
120
|
-
task :
|
119
|
+
task pushsite: :pushdoc do
|
121
120
|
sh "cd site && git gc"
|
122
121
|
sh "rsync -avz site/ rack.rubyforge.org:/var/www/gforge-projects/rack/"
|
123
122
|
sh "cd site && git push"
|
data/SPEC
CHANGED
@@ -35,7 +35,7 @@ below.
|
|
35
35
|
empty string, if the request URL targets
|
36
36
|
the application root and does not have a
|
37
37
|
trailing slash. This value may be
|
38
|
-
percent-encoded when
|
38
|
+
percent-encoded when originating from
|
39
39
|
a URL.
|
40
40
|
<tt>QUERY_STRING</tt>:: The portion of the request URL that
|
41
41
|
follows the <tt>?</tt>, if any. May be
|
@@ -60,9 +60,8 @@ below.
|
|
60
60
|
the presence or absence of the
|
61
61
|
appropriate HTTP header in the
|
62
62
|
request. See
|
63
|
-
|
64
|
-
|
65
|
-
specific behavior.
|
63
|
+
{RFC3875 section 4.1.18}[https://tools.ietf.org/html/rfc3875#section-4.1.18]
|
64
|
+
for specific behavior.
|
66
65
|
In addition to this, the Rack environment must include these
|
67
66
|
Rack-specific variables:
|
68
67
|
<tt>rack.version</tt>:: The Array representing this version of Rack
|
@@ -226,9 +225,9 @@ This is an HTTP status. When parsed as integer (+to_i+), it must be
|
|
226
225
|
greater than or equal to 100.
|
227
226
|
=== The Headers
|
228
227
|
The header must respond to +each+, and yield values of key and value.
|
228
|
+
The header keys must be Strings.
|
229
229
|
Special headers starting "rack." are for communicating with the
|
230
230
|
server, and must not be sent back to the client.
|
231
|
-
The header keys must be Strings.
|
232
231
|
The header must not contain a +Status+ key.
|
233
232
|
The header must conform to RFC7230 token specification, i.e. cannot
|
234
233
|
contain non-printable ASCII, DQUOTE or "(),/:;<=>?@[\]{}".
|
@@ -238,10 +237,10 @@ consisting of lines (for multiple header values, e.g. multiple
|
|
238
237
|
The lines must not contain characters below 037.
|
239
238
|
=== The Content-Type
|
240
239
|
There must not be a <tt>Content-Type</tt>, when the +Status+ is 1xx,
|
241
|
-
204
|
240
|
+
204 or 304.
|
242
241
|
=== The Content-Length
|
243
242
|
There must not be a <tt>Content-Length</tt> header when the
|
244
|
-
+Status+ is 1xx, 204
|
243
|
+
+Status+ is 1xx, 204 or 304.
|
245
244
|
=== The Body
|
246
245
|
The Body must respond to +each+
|
247
246
|
and must only yield String values.
|