rack 2.0.9.3 → 2.2.8
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 +740 -0
- data/CONTRIBUTING.md +136 -0
- data/{COPYING → MIT-LICENSE} +4 -2
- data/README.rdoc +151 -147
- data/Rakefile +37 -23
- data/{SPEC → SPEC.rdoc} +44 -15
- data/bin/rackup +1 -0
- data/example/lobster.ru +2 -0
- data/example/protectedlobster.rb +3 -1
- data/example/protectedlobster.ru +2 -0
- data/lib/rack/auth/abstract/handler.rb +3 -1
- data/lib/rack/auth/abstract/request.rb +1 -1
- data/lib/rack/auth/basic.rb +7 -4
- data/lib/rack/auth/digest/md5.rb +13 -11
- data/lib/rack/auth/digest/nonce.rb +6 -3
- data/lib/rack/auth/digest/params.rb +4 -2
- data/lib/rack/auth/digest/request.rb +5 -3
- data/lib/rack/body_proxy.rb +15 -14
- data/lib/rack/builder.rb +116 -23
- data/lib/rack/cascade.rb +28 -12
- data/lib/rack/chunked.rb +68 -20
- data/lib/rack/common_logger.rb +33 -25
- data/lib/rack/conditional_get.rb +20 -16
- data/lib/rack/config.rb +2 -0
- data/lib/rack/content_length.rb +8 -7
- data/lib/rack/content_type.rb +5 -4
- data/lib/rack/core_ext/regexp.rb +14 -0
- data/lib/rack/deflater.rb +59 -34
- data/lib/rack/directory.rb +84 -64
- data/lib/rack/etag.rb +7 -4
- data/lib/rack/events.rb +19 -20
- data/lib/rack/file.rb +4 -173
- data/lib/rack/files.rb +218 -0
- data/lib/rack/handler/cgi.rb +2 -3
- data/lib/rack/handler/fastcgi.rb +4 -4
- data/lib/rack/handler/lsws.rb +3 -3
- data/lib/rack/handler/scgi.rb +9 -8
- data/lib/rack/handler/thin.rb +3 -3
- data/lib/rack/handler/webrick.rb +15 -6
- data/lib/rack/handler.rb +7 -2
- data/lib/rack/head.rb +1 -1
- data/lib/rack/lint.rb +219 -184
- data/lib/rack/lobster.rb +10 -10
- data/lib/rack/lock.rb +2 -1
- data/lib/rack/logger.rb +2 -0
- data/lib/rack/media_type.rb +10 -5
- data/lib/rack/method_override.rb +5 -3
- data/lib/rack/mime.rb +9 -1
- data/lib/rack/mock.rb +97 -20
- data/lib/rack/multipart/generator.rb +17 -13
- data/lib/rack/multipart/parser.rb +55 -56
- data/lib/rack/multipart/uploaded_file.rb +15 -7
- data/lib/rack/multipart.rb +4 -2
- data/lib/rack/null_logger.rb +2 -0
- data/lib/rack/query_parser.rb +59 -30
- data/lib/rack/recursive.rb +7 -5
- data/lib/rack/reloader.rb +8 -4
- data/lib/rack/request.rb +222 -63
- data/lib/rack/response.rb +127 -44
- data/lib/rack/rewindable_input.rb +4 -3
- data/lib/rack/runtime.rb +6 -4
- data/lib/rack/sendfile.rb +13 -9
- data/lib/rack/server.rb +95 -24
- data/lib/rack/session/abstract/id.rb +34 -21
- data/lib/rack/session/cookie.rb +12 -12
- data/lib/rack/session/memcache.rb +4 -93
- data/lib/rack/session/pool.rb +5 -3
- data/lib/rack/show_exceptions.rb +21 -17
- data/lib/rack/show_status.rb +9 -9
- data/lib/rack/static.rb +23 -11
- data/lib/rack/tempfile_reaper.rb +1 -1
- data/lib/rack/urlmap.rb +13 -7
- data/lib/rack/utils.rb +105 -111
- data/lib/rack/version.rb +29 -0
- data/lib/rack.rb +67 -73
- data/rack.gemspec +40 -28
- metadata +36 -179
- data/HISTORY.md +0 -520
- data/test/builder/an_underscore_app.rb +0 -5
- 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 -9
- data/test/cgi/test.gz +0 -0
- data/test/cgi/test.ru +0 -5
- data/test/gemloader.rb +0 -10
- data/test/helper.rb +0 -34
- 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_encoded_words +0 -7
- 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_single_quote +0 -7
- 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/quoted +0 -15
- data/test/multipart/rack-logo.png +0 -0
- data/test/multipart/semicolon +0 -6
- data/test/multipart/text +0 -15
- data/test/multipart/three_files_three_fields +0 -31
- data/test/multipart/unity3d_wwwform +0 -11
- 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 -89
- data/test/spec_auth_digest.rb +0 -260
- data/test/spec_body_proxy.rb +0 -85
- data/test/spec_builder.rb +0 -233
- data/test/spec_cascade.rb +0 -63
- data/test/spec_cgi.rb +0 -84
- data/test/spec_chunked.rb +0 -103
- data/test/spec_common_logger.rb +0 -107
- data/test/spec_conditional_get.rb +0 -103
- data/test/spec_config.rb +0 -23
- data/test/spec_content_length.rb +0 -86
- data/test/spec_content_type.rb +0 -46
- data/test/spec_deflater.rb +0 -375
- data/test/spec_directory.rb +0 -148
- data/test/spec_etag.rb +0 -108
- data/test/spec_events.rb +0 -133
- data/test/spec_fastcgi.rb +0 -85
- data/test/spec_file.rb +0 -264
- data/test/spec_handler.rb +0 -57
- data/test/spec_head.rb +0 -46
- data/test/spec_lint.rb +0 -520
- data/test/spec_lobster.rb +0 -59
- data/test/spec_lock.rb +0 -204
- data/test/spec_logger.rb +0 -24
- data/test/spec_media_type.rb +0 -42
- data/test/spec_method_override.rb +0 -110
- data/test/spec_mime.rb +0 -51
- data/test/spec_mock.rb +0 -359
- data/test/spec_multipart.rb +0 -721
- data/test/spec_null_logger.rb +0 -21
- data/test/spec_recursive.rb +0 -75
- data/test/spec_request.rb +0 -1423
- data/test/spec_response.rb +0 -528
- data/test/spec_rewindable_input.rb +0 -128
- data/test/spec_runtime.rb +0 -50
- data/test/spec_sendfile.rb +0 -125
- data/test/spec_server.rb +0 -193
- data/test/spec_session_abstract_id.rb +0 -31
- data/test/spec_session_abstract_session_hash.rb +0 -45
- data/test/spec_session_cookie.rb +0 -442
- data/test/spec_session_memcache.rb +0 -357
- data/test/spec_session_persisted_secure_secure_session_hash.rb +0 -73
- data/test/spec_session_pool.rb +0 -247
- data/test/spec_show_exceptions.rb +0 -93
- data/test/spec_show_status.rb +0 -104
- data/test/spec_static.rb +0 -184
- data/test/spec_tempfile_reaper.rb +0 -64
- data/test/spec_thin.rb +0 -96
- data/test/spec_urlmap.rb +0 -237
- data/test/spec_utils.rb +0 -742
- data/test/spec_version.rb +0 -11
- data/test/spec_webrick.rb +0 -206
- data/test/static/another/index.html +0 -1
- data/test/static/foo.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
data/CONTRIBUTING.md
ADDED
@@ -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.
|
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,99 +1,139 @@
|
|
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
|
+
{<img src="http://inch-ci.org/github/rack/rack.svg?branch=master" alt="Inline docs" />}[http://inch-ci.org/github/rack/rack]
|
9
|
+
|
10
|
+
\Rack provides a minimal, modular, and adaptable interface for developing
|
11
|
+
web applications in Ruby. By wrapping HTTP requests and responses in
|
5
12
|
the simplest way possible, it unifies and distills the API for web
|
6
13
|
servers, web frameworks, and software in between (the so-called
|
7
14
|
middleware) into a single method call.
|
8
15
|
|
9
|
-
The exact details of this are described in the Rack specification,
|
10
|
-
which all Rack applications should conform to.
|
16
|
+
The exact details of this are described in the \Rack specification,
|
17
|
+
which all \Rack applications should conform to.
|
11
18
|
|
12
19
|
== Supported web servers
|
13
20
|
|
14
|
-
The included *handlers* connect all kinds of web servers to Rack:
|
15
|
-
|
21
|
+
The included *handlers* connect all kinds of web servers to \Rack:
|
22
|
+
|
23
|
+
* WEBrick[https://github.com/ruby/webrick]
|
16
24
|
* FCGI
|
17
25
|
* CGI
|
18
26
|
* SCGI
|
19
|
-
* LiteSpeed
|
20
|
-
* Thin
|
21
|
-
|
22
|
-
These web servers include Rack handlers in their distributions:
|
23
|
-
|
24
|
-
*
|
25
|
-
*
|
26
|
-
*
|
27
|
-
*
|
28
|
-
*
|
29
|
-
*
|
30
|
-
*
|
31
|
-
* uWSGI
|
32
|
-
|
33
|
-
|
34
|
-
Any valid Rack app will run the same on all these handlers, without
|
27
|
+
* LiteSpeed[https://www.litespeedtech.com/]
|
28
|
+
* Thin[https://rubygems.org/gems/thin]
|
29
|
+
|
30
|
+
These web servers include \Rack handlers in their distributions:
|
31
|
+
|
32
|
+
* Agoo[https://github.com/ohler55/agoo]
|
33
|
+
* Falcon[https://github.com/socketry/falcon]
|
34
|
+
* Iodine[https://github.com/boazsegev/iodine]
|
35
|
+
* {NGINX Unit}[https://unit.nginx.org/]
|
36
|
+
* {Phusion Passenger}[https://www.phusionpassenger.com/] (which is mod_rack for Apache and for nginx)
|
37
|
+
* Puma[https://puma.io/]
|
38
|
+
* Unicorn[https://yhbt.net/unicorn/]
|
39
|
+
* uWSGI[https://uwsgi-docs.readthedocs.io/en/latest/]
|
40
|
+
|
41
|
+
Any valid \Rack app will run the same on all these handlers, without
|
35
42
|
changing anything.
|
36
43
|
|
37
44
|
== Supported web frameworks
|
38
45
|
|
39
|
-
These frameworks
|
40
|
-
|
41
|
-
*
|
42
|
-
*
|
43
|
-
*
|
44
|
-
*
|
45
|
-
*
|
46
|
-
*
|
47
|
-
*
|
48
|
-
*
|
49
|
-
*
|
50
|
-
*
|
51
|
-
*
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
Between the server and the framework, Rack can be customized to your
|
61
|
-
applications needs using middleware, for example:
|
62
|
-
* Rack::URLMap, to route to multiple applications inside the same process.
|
46
|
+
These frameworks and many others support the \Rack API:
|
47
|
+
|
48
|
+
* Camping[http://www.ruby-camping.com/]
|
49
|
+
* Coset[http://leahneukirchen.org/repos/coset/]
|
50
|
+
* Hanami[https://hanamirb.org/]
|
51
|
+
* Padrino[http://padrinorb.com/]
|
52
|
+
* Ramaze[http://ramaze.net/]
|
53
|
+
* Roda[https://github.com/jeremyevans/roda]
|
54
|
+
* {Ruby on Rails}[https://rubyonrails.org/]
|
55
|
+
* Rum[https://github.com/leahneukirchen/rum]
|
56
|
+
* Sinatra[http://sinatrarb.com/]
|
57
|
+
* Utopia[https://github.com/socketry/utopia]
|
58
|
+
* WABuR[https://github.com/ohler55/wabur]
|
59
|
+
|
60
|
+
== Available middleware shipped with \Rack
|
61
|
+
|
62
|
+
Between the server and the framework, \Rack can be customized to your
|
63
|
+
applications needs using middleware. \Rack itself ships with the following
|
64
|
+
middleware:
|
65
|
+
|
66
|
+
* Rack::Chunked, for streaming responses using chunked encoding.
|
63
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.
|
64
91
|
* Rack::ShowException, for catching unhandled exceptions and
|
65
92
|
presenting them in a nice and helpful way with clickable backtrace.
|
66
|
-
* Rack::
|
67
|
-
|
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.
|
68
98
|
|
69
99
|
All these components use the same interface, which is described in
|
70
|
-
detail in the Rack specification. These optional components can be
|
100
|
+
detail in the \Rack specification. These optional components can be
|
71
101
|
used in any way you wish.
|
72
102
|
|
73
103
|
== Convenience
|
74
104
|
|
75
105
|
If you want to develop outside of existing frameworks, implement your
|
76
|
-
own ones, or develop middleware, Rack provides many helpers to create
|
77
|
-
Rack applications quickly and without doing the same web stuff all
|
106
|
+
own ones, or develop middleware, \Rack provides many helpers to create
|
107
|
+
\Rack applications quickly and without doing the same web stuff all
|
78
108
|
over:
|
109
|
+
|
79
110
|
* Rack::Request, which also provides query string parsing and
|
80
111
|
multipart handling.
|
81
112
|
* Rack::Response, for convenient generation of HTTP replies and
|
82
113
|
cookie handling.
|
83
114
|
* Rack::MockRequest and Rack::MockResponse for efficient and quick
|
84
|
-
testing of Rack application without real HTTP round-trips.
|
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.
|
85
125
|
|
86
126
|
== rack-contrib
|
87
127
|
|
88
128
|
The plethora of useful middleware created the need for a project that
|
89
|
-
collects fresh Rack middleware. rack-contrib includes a variety of
|
90
|
-
add-on components for Rack and it is easy to contribute new modules.
|
129
|
+
collects fresh \Rack middleware. rack-contrib includes a variety of
|
130
|
+
add-on components for \Rack and it is easy to contribute new modules.
|
91
131
|
|
92
132
|
* https://github.com/rack/rack-contrib
|
93
133
|
|
94
134
|
== rackup
|
95
135
|
|
96
|
-
rackup is a useful tool for running Rack applications, which uses the
|
136
|
+
rackup is a useful tool for running \Rack applications, which uses the
|
97
137
|
Rack::Builder DSL to configure middleware and build up applications
|
98
138
|
easily.
|
99
139
|
|
@@ -117,77 +157,50 @@ By default, the lobster is found at http://localhost:9292.
|
|
117
157
|
|
118
158
|
== Installing with RubyGems
|
119
159
|
|
120
|
-
A Gem of Rack is available at rubygems.org.
|
160
|
+
A Gem of \Rack is available at {rubygems.org}[https://rubygems.org/gems/rack]. You can install it with:
|
121
161
|
|
122
162
|
gem install rack
|
123
163
|
|
124
|
-
|
125
|
-
at my site:
|
126
|
-
|
127
|
-
gem install rack --source http://chneukirchen.org/releases/gems/
|
128
|
-
|
129
|
-
== Running the tests
|
130
|
-
|
131
|
-
Testing Rack requires the bacon testing framework:
|
132
|
-
|
133
|
-
bundle install --without extra # to be able to run the fast tests
|
134
|
-
|
135
|
-
Or:
|
164
|
+
== Usage
|
136
165
|
|
137
|
-
|
166
|
+
You should require the library:
|
138
167
|
|
139
|
-
|
168
|
+
require 'rack'
|
140
169
|
|
141
|
-
|
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.
|
142
173
|
|
143
|
-
|
144
|
-
installation and bacon.
|
145
|
-
|
146
|
-
To run the test suite completely, you need:
|
147
|
-
|
148
|
-
* fcgi
|
149
|
-
* memcache-client
|
150
|
-
* thin
|
151
|
-
|
152
|
-
The full set of tests test FCGI access with lighttpd (on port
|
153
|
-
9203) so you will need lighttpd installed as well as the FCGI
|
154
|
-
libraries and the fcgi gem:
|
155
|
-
|
156
|
-
Download and install lighttpd:
|
174
|
+
== Configuration
|
157
175
|
|
158
|
-
|
176
|
+
Several parameters can be modified on Rack::Utils to configure \Rack behaviour.
|
159
177
|
|
160
|
-
|
178
|
+
e.g:
|
161
179
|
|
162
|
-
|
163
|
-
tar xzvf fcgi-2.4.0.tar.gz
|
164
|
-
cd fcgi-2.4.0
|
165
|
-
./configure --prefix=/usr/local
|
166
|
-
make
|
167
|
-
sudo make install
|
168
|
-
cd ..
|
180
|
+
Rack::Utils.key_space_limit = 128
|
169
181
|
|
170
|
-
|
182
|
+
=== key_space_limit
|
171
183
|
|
172
|
-
|
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.
|
173
187
|
|
174
|
-
|
175
|
-
run on port 11211) and memcache-client installed.
|
188
|
+
Defaults to 65536 characters.
|
176
189
|
|
177
|
-
|
190
|
+
=== param_depth_limit
|
178
191
|
|
179
|
-
|
192
|
+
The maximum amount of nesting allowed in parameters.
|
193
|
+
For example, if set to 3, this query string would be allowed:
|
180
194
|
|
181
|
-
|
195
|
+
?a[b][c]=d
|
182
196
|
|
183
|
-
|
197
|
+
but this query string would not be allowed:
|
184
198
|
|
185
|
-
|
199
|
+
?a[b][c][d]=e
|
186
200
|
|
187
|
-
|
188
|
-
This helps prevent a rogue client from flooding a Request.
|
201
|
+
Limiting the depth prevents a possible stack overflow when parsing parameters.
|
189
202
|
|
190
|
-
|
203
|
+
Defaults to 100.
|
191
204
|
|
192
205
|
=== multipart_file_limit
|
193
206
|
|
@@ -214,48 +227,57 @@ Set to 0 for no limit.
|
|
214
227
|
|
215
228
|
Can also be set via the +RACK_MULTIPART_TOTAL_PART_LIMIT+ environment variable.
|
216
229
|
|
217
|
-
==
|
230
|
+
== Changelog
|
218
231
|
|
219
|
-
See
|
232
|
+
See {CHANGELOG.md}[https://github.com/rack/rack/blob/master/CHANGELOG.md].
|
233
|
+
|
234
|
+
== Contributing
|
235
|
+
|
236
|
+
See {CONTRIBUTING.md}[https://github.com/rack/rack/blob/master/CONTRIBUTING.md].
|
220
237
|
|
221
238
|
== Contact
|
222
239
|
|
223
240
|
Please post bugs, suggestions and patches to
|
224
|
-
the bug tracker at
|
241
|
+
the bug tracker at {issues}[https://github.com/rack/rack/issues].
|
225
242
|
|
226
243
|
Please post security related bugs and suggestions to the core team at
|
227
|
-
<https://groups.google.com/
|
244
|
+
<https://groups.google.com/forum/#!forum/rack-core> or rack-core@googlegroups.com. This
|
228
245
|
list is not public. Due to wide usage of the library, it is strongly preferred
|
229
246
|
that we manage timing in order to provide viable patches at the time of
|
230
247
|
disclosure. Your assistance in this matter is greatly appreciated.
|
231
248
|
|
232
249
|
Mailing list archives are available at
|
233
|
-
<https://groups.google.com/
|
250
|
+
<https://groups.google.com/forum/#!forum/rack-devel>.
|
234
251
|
|
235
252
|
Git repository (send Git patches to the mailing list):
|
253
|
+
|
236
254
|
* https://github.com/rack/rack
|
237
|
-
* http://git.vuxu.org/cgi-bin/gitweb.cgi?p=rack-github.git
|
238
255
|
|
239
256
|
You are also welcome to join the #rack channel on irc.freenode.net.
|
240
257
|
|
241
258
|
== Thanks
|
242
259
|
|
243
|
-
The Rack Core Team, consisting of
|
260
|
+
The \Rack Core Team, consisting of
|
261
|
+
|
262
|
+
* Aaron Patterson (tenderlove[https://github.com/tenderlove])
|
263
|
+
* Samuel Williams (ioquatix[https://github.com/ioquatix])
|
264
|
+
* Jeremy Evans (jeremyevans[https://github.com/jeremyevans])
|
265
|
+
* Eileen Uchitelle (eileencodes[https://github.com/eileencodes])
|
266
|
+
* Matthew Draper (matthewd[https://github.com/matthewd])
|
267
|
+
* Rafael França (rafaelfranca[https://github.com/rafaelfranca])
|
268
|
+
|
269
|
+
and the \Rack Alumni
|
244
270
|
|
245
|
-
*
|
271
|
+
* Ryan Tomayko (rtomayko[https://github.com/rtomayko])
|
272
|
+
* Scytrin dai Kinthra (scytrin[https://github.com/scytrin])
|
273
|
+
* Leah Neukirchen (leahneukirchen[https://github.com/leahneukirchen])
|
246
274
|
* James Tucker (raggi[https://github.com/raggi])
|
247
275
|
* Josh Peek (josh[https://github.com/josh])
|
248
276
|
* José Valim (josevalim[https://github.com/josevalim])
|
249
277
|
* Michael Fellinger (manveru[https://github.com/manveru])
|
250
|
-
* Aaron Patterson (tenderlove[https://github.com/tenderlove])
|
251
278
|
* Santiago Pastorino (spastorino[https://github.com/spastorino])
|
252
279
|
* Konstantin Haase (rkh[https://github.com/rkh])
|
253
280
|
|
254
|
-
and the Rack Alumnis
|
255
|
-
|
256
|
-
* Ryan Tomayko (rtomayko[https://github.com/rtomayko])
|
257
|
-
* Scytrin dai Kinthra (scytrin[https://github.com/scytrin])
|
258
|
-
|
259
281
|
would like to thank:
|
260
282
|
|
261
283
|
* Adrian Madrid, for the LiteSpeed handler.
|
@@ -283,34 +305,16 @@ would like to thank:
|
|
283
305
|
* Alexander Kellett for testing the Gem and reviewing the announcement.
|
284
306
|
* Marcus Rückert, for help with configuring and debugging lighttpd.
|
285
307
|
* The WSGI team for the well-done and documented work they've done and
|
286
|
-
Rack builds up on.
|
308
|
+
\Rack builds up on.
|
287
309
|
* All bug reporters and patch contributors not mentioned above.
|
288
310
|
|
289
|
-
==
|
290
|
-
|
291
|
-
Copyright (C) 2007, 2008, 2009, 2010 Christian Neukirchen <http://purl.org/net/chneukirchen>
|
292
|
-
|
293
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
294
|
-
of this software and associated documentation files (the "Software"), to
|
295
|
-
deal in the Software without restriction, including without limitation the
|
296
|
-
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
297
|
-
sell copies of the Software, and to permit persons to whom the Software is
|
298
|
-
furnished to do so, subject to the following conditions:
|
299
|
-
|
300
|
-
The above copyright notice and this permission notice shall be included in
|
301
|
-
all copies or substantial portions of the Software.
|
311
|
+
== Links
|
302
312
|
|
303
|
-
|
304
|
-
|
305
|
-
|
306
|
-
|
307
|
-
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
308
|
-
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
313
|
+
\Rack:: <https://rack.github.io/>
|
314
|
+
Official \Rack repositories:: <https://github.com/rack>
|
315
|
+
\Rack Bug Tracking:: <https://github.com/rack/rack/issues>
|
316
|
+
rack-devel mailing list:: <https://groups.google.com/forum/#!forum/rack-devel>
|
309
317
|
|
310
|
-
==
|
318
|
+
== License
|
311
319
|
|
312
|
-
Rack
|
313
|
-
Official Rack repositories:: <https://github.com/rack>
|
314
|
-
Rack Bug Tracking:: <https://github.com/rack/rack/issues>
|
315
|
-
rack-devel mailing list:: <https://groups.google.com/group/rack-devel>
|
316
|
-
Rack's Rubyforge project:: <http://rubyforge.org/projects/rack>
|
320
|
+
\Rack is released under the {MIT License}[https://opensource.org/licenses/MIT].
|