rack 2.2.6.4 → 3.0.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 +205 -80
- data/CONTRIBUTING.md +53 -47
- data/MIT-LICENSE +1 -1
- data/README.md +309 -0
- data/SPEC.rdoc +183 -131
- data/lib/rack/auth/abstract/handler.rb +3 -1
- data/lib/rack/auth/abstract/request.rb +3 -1
- data/lib/rack/auth/basic.rb +0 -2
- data/lib/rack/auth/digest/md5.rb +1 -131
- data/lib/rack/auth/digest/nonce.rb +1 -54
- data/lib/rack/auth/digest/params.rb +1 -54
- data/lib/rack/auth/digest/request.rb +1 -43
- data/lib/rack/auth/digest.rb +256 -0
- data/lib/rack/body_proxy.rb +3 -1
- data/lib/rack/builder.rb +83 -63
- data/lib/rack/cascade.rb +2 -0
- data/lib/rack/chunked.rb +16 -13
- data/lib/rack/common_logger.rb +23 -18
- data/lib/rack/conditional_get.rb +18 -15
- data/lib/rack/constants.rb +64 -0
- data/lib/rack/content_length.rb +12 -16
- data/lib/rack/content_type.rb +8 -5
- data/lib/rack/deflater.rb +40 -26
- data/lib/rack/directory.rb +9 -3
- data/lib/rack/etag.rb +14 -23
- data/lib/rack/events.rb +4 -0
- data/lib/rack/file.rb +2 -0
- data/lib/rack/files.rb +15 -17
- data/lib/rack/head.rb +9 -8
- data/lib/rack/headers.rb +154 -0
- data/lib/rack/lint.rb +783 -682
- data/lib/rack/lock.rb +2 -5
- data/lib/rack/logger.rb +2 -0
- data/lib/rack/media_type.rb +1 -1
- data/lib/rack/method_override.rb +5 -1
- data/lib/rack/mime.rb +8 -0
- data/lib/rack/mock.rb +1 -271
- data/lib/rack/mock_request.rb +166 -0
- data/lib/rack/mock_response.rb +126 -0
- data/lib/rack/multipart/generator.rb +7 -5
- data/lib/rack/multipart/parser.rb +119 -61
- data/lib/rack/multipart/uploaded_file.rb +4 -0
- data/lib/rack/multipart.rb +20 -40
- data/lib/rack/null_logger.rb +9 -0
- data/lib/rack/query_parser.rb +78 -46
- data/lib/rack/recursive.rb +2 -0
- data/lib/rack/reloader.rb +0 -2
- data/lib/rack/request.rb +224 -106
- data/lib/rack/response.rb +136 -61
- data/lib/rack/rewindable_input.rb +24 -5
- data/lib/rack/runtime.rb +7 -6
- data/lib/rack/sendfile.rb +30 -25
- data/lib/rack/show_exceptions.rb +15 -2
- data/lib/rack/show_status.rb +17 -7
- data/lib/rack/static.rb +8 -8
- data/lib/rack/tempfile_reaper.rb +15 -4
- data/lib/rack/urlmap.rb +3 -1
- data/lib/rack/utils.rb +202 -176
- data/lib/rack/version.rb +9 -4
- data/lib/rack.rb +6 -76
- metadata +18 -38
- data/README.rdoc +0 -320
- data/Rakefile +0 -130
- data/bin/rackup +0 -5
- data/contrib/rack.png +0 -0
- data/contrib/rack.svg +0 -150
- data/contrib/rack_logo.svg +0 -164
- data/contrib/rdoc.css +0 -412
- data/example/lobster.ru +0 -6
- data/example/protectedlobster.rb +0 -16
- data/example/protectedlobster.ru +0 -10
- data/lib/rack/core_ext/regexp.rb +0 -14
- data/lib/rack/handler/cgi.rb +0 -59
- data/lib/rack/handler/fastcgi.rb +0 -100
- data/lib/rack/handler/lsws.rb +0 -61
- data/lib/rack/handler/scgi.rb +0 -71
- data/lib/rack/handler/thin.rb +0 -36
- data/lib/rack/handler/webrick.rb +0 -129
- data/lib/rack/handler.rb +0 -104
- data/lib/rack/lobster.rb +0 -70
- data/lib/rack/server.rb +0 -466
- data/lib/rack/session/abstract/id.rb +0 -523
- data/lib/rack/session/cookie.rb +0 -203
- data/lib/rack/session/memcache.rb +0 -10
- data/lib/rack/session/pool.rb +0 -85
- data/rack.gemspec +0 -46
data/lib/rack.rb
CHANGED
@@ -12,70 +12,9 @@
|
|
12
12
|
# so it should be enough just to <tt>require 'rack'</tt> in your code.
|
13
13
|
|
14
14
|
require_relative 'rack/version'
|
15
|
+
require_relative 'rack/constants'
|
15
16
|
|
16
17
|
module Rack
|
17
|
-
HTTP_HOST = 'HTTP_HOST'
|
18
|
-
HTTP_PORT = 'HTTP_PORT'
|
19
|
-
HTTP_VERSION = 'HTTP_VERSION'
|
20
|
-
HTTPS = 'HTTPS'
|
21
|
-
PATH_INFO = 'PATH_INFO'
|
22
|
-
REQUEST_METHOD = 'REQUEST_METHOD'
|
23
|
-
REQUEST_PATH = 'REQUEST_PATH'
|
24
|
-
SCRIPT_NAME = 'SCRIPT_NAME'
|
25
|
-
QUERY_STRING = 'QUERY_STRING'
|
26
|
-
SERVER_PROTOCOL = 'SERVER_PROTOCOL'
|
27
|
-
SERVER_NAME = 'SERVER_NAME'
|
28
|
-
SERVER_PORT = 'SERVER_PORT'
|
29
|
-
CACHE_CONTROL = 'Cache-Control'
|
30
|
-
EXPIRES = 'Expires'
|
31
|
-
CONTENT_LENGTH = 'Content-Length'
|
32
|
-
CONTENT_TYPE = 'Content-Type'
|
33
|
-
SET_COOKIE = 'Set-Cookie'
|
34
|
-
TRANSFER_ENCODING = 'Transfer-Encoding'
|
35
|
-
HTTP_COOKIE = 'HTTP_COOKIE'
|
36
|
-
ETAG = 'ETag'
|
37
|
-
|
38
|
-
# HTTP method verbs
|
39
|
-
GET = 'GET'
|
40
|
-
POST = 'POST'
|
41
|
-
PUT = 'PUT'
|
42
|
-
PATCH = 'PATCH'
|
43
|
-
DELETE = 'DELETE'
|
44
|
-
HEAD = 'HEAD'
|
45
|
-
OPTIONS = 'OPTIONS'
|
46
|
-
LINK = 'LINK'
|
47
|
-
UNLINK = 'UNLINK'
|
48
|
-
TRACE = 'TRACE'
|
49
|
-
|
50
|
-
# Rack environment variables
|
51
|
-
RACK_VERSION = 'rack.version'
|
52
|
-
RACK_TEMPFILES = 'rack.tempfiles'
|
53
|
-
RACK_ERRORS = 'rack.errors'
|
54
|
-
RACK_LOGGER = 'rack.logger'
|
55
|
-
RACK_INPUT = 'rack.input'
|
56
|
-
RACK_SESSION = 'rack.session'
|
57
|
-
RACK_SESSION_OPTIONS = 'rack.session.options'
|
58
|
-
RACK_SHOWSTATUS_DETAIL = 'rack.showstatus.detail'
|
59
|
-
RACK_MULTITHREAD = 'rack.multithread'
|
60
|
-
RACK_MULTIPROCESS = 'rack.multiprocess'
|
61
|
-
RACK_RUNONCE = 'rack.run_once'
|
62
|
-
RACK_URL_SCHEME = 'rack.url_scheme'
|
63
|
-
RACK_HIJACK = 'rack.hijack'
|
64
|
-
RACK_IS_HIJACK = 'rack.hijack?'
|
65
|
-
RACK_HIJACK_IO = 'rack.hijack_io'
|
66
|
-
RACK_RECURSIVE_INCLUDE = 'rack.recursive.include'
|
67
|
-
RACK_MULTIPART_BUFFER_SIZE = 'rack.multipart.buffer_size'
|
68
|
-
RACK_MULTIPART_TEMPFILE_FACTORY = 'rack.multipart.tempfile_factory'
|
69
|
-
RACK_REQUEST_FORM_INPUT = 'rack.request.form_input'
|
70
|
-
RACK_REQUEST_FORM_HASH = 'rack.request.form_hash'
|
71
|
-
RACK_REQUEST_FORM_VARS = 'rack.request.form_vars'
|
72
|
-
RACK_REQUEST_COOKIE_HASH = 'rack.request.cookie_hash'
|
73
|
-
RACK_REQUEST_COOKIE_STRING = 'rack.request.cookie_string'
|
74
|
-
RACK_REQUEST_QUERY_HASH = 'rack.request.query_hash'
|
75
|
-
RACK_REQUEST_QUERY_STRING = 'rack.request.query_string'
|
76
|
-
RACK_METHODOVERRIDE_ORIGINAL_METHOD = 'rack.methodoverride.original_method'
|
77
|
-
RACK_SESSION_UNPACKED_COOKIE_DATA = 'rack.session.unpacked_cookie_data'
|
78
|
-
|
79
18
|
autoload :Builder, "rack/builder"
|
80
19
|
autoload :BodyProxy, "rack/body_proxy"
|
81
20
|
autoload :Cascade, "rack/cascade"
|
@@ -94,6 +33,7 @@ module Rack
|
|
94
33
|
autoload :ForwardRequest, "rack/recursive"
|
95
34
|
autoload :Handler, "rack/handler"
|
96
35
|
autoload :Head, "rack/head"
|
36
|
+
autoload :Headers, "rack/headers"
|
97
37
|
autoload :Lint, "rack/lint"
|
98
38
|
autoload :Lock, "rack/lock"
|
99
39
|
autoload :Logger, "rack/logger"
|
@@ -101,6 +41,7 @@ module Rack
|
|
101
41
|
autoload :MethodOverride, "rack/method_override"
|
102
42
|
autoload :Mime, "rack/mime"
|
103
43
|
autoload :NullLogger, "rack/null_logger"
|
44
|
+
autoload :QueryParser, "rack/query_parser"
|
104
45
|
autoload :Recursive, "rack/recursive"
|
105
46
|
autoload :Reloader, "rack/reloader"
|
106
47
|
autoload :RewindableInput, "rack/rewindable_input"
|
@@ -115,8 +56,8 @@ module Rack
|
|
115
56
|
autoload :Utils, "rack/utils"
|
116
57
|
autoload :Multipart, "rack/multipart"
|
117
58
|
|
118
|
-
autoload :MockRequest, "rack/
|
119
|
-
autoload :MockResponse, "rack/
|
59
|
+
autoload :MockRequest, "rack/mock_request"
|
60
|
+
autoload :MockResponse, "rack/mock_response"
|
120
61
|
|
121
62
|
autoload :Request, "rack/request"
|
122
63
|
autoload :Response, "rack/response"
|
@@ -125,17 +66,6 @@ module Rack
|
|
125
66
|
autoload :Basic, "rack/auth/basic"
|
126
67
|
autoload :AbstractRequest, "rack/auth/abstract/request"
|
127
68
|
autoload :AbstractHandler, "rack/auth/abstract/handler"
|
128
|
-
|
129
|
-
autoload :MD5, "rack/auth/digest/md5"
|
130
|
-
autoload :Nonce, "rack/auth/digest/nonce"
|
131
|
-
autoload :Params, "rack/auth/digest/params"
|
132
|
-
autoload :Request, "rack/auth/digest/request"
|
133
|
-
end
|
134
|
-
end
|
135
|
-
|
136
|
-
module Session
|
137
|
-
autoload :Cookie, "rack/session/cookie"
|
138
|
-
autoload :Pool, "rack/session/pool"
|
139
|
-
autoload :Memcache, "rack/session/memcache"
|
69
|
+
autoload :Digest, "rack/auth/digest"
|
140
70
|
end
|
141
71
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rack
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 3.0.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Leah Neukirchen
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-06-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: minitest
|
@@ -25,7 +25,7 @@ dependencies:
|
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '5.0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
|
-
name: minitest-
|
28
|
+
name: minitest-global_expectations
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - ">="
|
@@ -39,7 +39,7 @@ dependencies:
|
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
|
-
name:
|
42
|
+
name: bundler
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
45
|
- - ">="
|
@@ -73,32 +73,23 @@ description: |
|
|
73
73
|
servers, web frameworks, and software in between (the so-called
|
74
74
|
middleware) into a single method call.
|
75
75
|
email: leah@vuxu.org
|
76
|
-
executables:
|
77
|
-
- rackup
|
76
|
+
executables: []
|
78
77
|
extensions: []
|
79
78
|
extra_rdoc_files:
|
80
|
-
- README.
|
79
|
+
- README.md
|
81
80
|
- CHANGELOG.md
|
82
81
|
- CONTRIBUTING.md
|
83
82
|
files:
|
84
83
|
- CHANGELOG.md
|
85
84
|
- CONTRIBUTING.md
|
86
85
|
- MIT-LICENSE
|
87
|
-
- README.
|
88
|
-
- Rakefile
|
86
|
+
- README.md
|
89
87
|
- SPEC.rdoc
|
90
|
-
- bin/rackup
|
91
|
-
- contrib/rack.png
|
92
|
-
- contrib/rack.svg
|
93
|
-
- contrib/rack_logo.svg
|
94
|
-
- contrib/rdoc.css
|
95
|
-
- example/lobster.ru
|
96
|
-
- example/protectedlobster.rb
|
97
|
-
- example/protectedlobster.ru
|
98
88
|
- lib/rack.rb
|
99
89
|
- lib/rack/auth/abstract/handler.rb
|
100
90
|
- lib/rack/auth/abstract/request.rb
|
101
91
|
- lib/rack/auth/basic.rb
|
92
|
+
- lib/rack/auth/digest.rb
|
102
93
|
- lib/rack/auth/digest/md5.rb
|
103
94
|
- lib/rack/auth/digest/nonce.rb
|
104
95
|
- lib/rack/auth/digest/params.rb
|
@@ -110,31 +101,26 @@ files:
|
|
110
101
|
- lib/rack/common_logger.rb
|
111
102
|
- lib/rack/conditional_get.rb
|
112
103
|
- lib/rack/config.rb
|
104
|
+
- lib/rack/constants.rb
|
113
105
|
- lib/rack/content_length.rb
|
114
106
|
- lib/rack/content_type.rb
|
115
|
-
- lib/rack/core_ext/regexp.rb
|
116
107
|
- lib/rack/deflater.rb
|
117
108
|
- lib/rack/directory.rb
|
118
109
|
- lib/rack/etag.rb
|
119
110
|
- lib/rack/events.rb
|
120
111
|
- lib/rack/file.rb
|
121
112
|
- lib/rack/files.rb
|
122
|
-
- lib/rack/handler.rb
|
123
|
-
- lib/rack/handler/cgi.rb
|
124
|
-
- lib/rack/handler/fastcgi.rb
|
125
|
-
- lib/rack/handler/lsws.rb
|
126
|
-
- lib/rack/handler/scgi.rb
|
127
|
-
- lib/rack/handler/thin.rb
|
128
|
-
- lib/rack/handler/webrick.rb
|
129
113
|
- lib/rack/head.rb
|
114
|
+
- lib/rack/headers.rb
|
130
115
|
- lib/rack/lint.rb
|
131
|
-
- lib/rack/lobster.rb
|
132
116
|
- lib/rack/lock.rb
|
133
117
|
- lib/rack/logger.rb
|
134
118
|
- lib/rack/media_type.rb
|
135
119
|
- lib/rack/method_override.rb
|
136
120
|
- lib/rack/mime.rb
|
137
121
|
- lib/rack/mock.rb
|
122
|
+
- lib/rack/mock_request.rb
|
123
|
+
- lib/rack/mock_response.rb
|
138
124
|
- lib/rack/multipart.rb
|
139
125
|
- lib/rack/multipart/generator.rb
|
140
126
|
- lib/rack/multipart/parser.rb
|
@@ -148,11 +134,6 @@ files:
|
|
148
134
|
- lib/rack/rewindable_input.rb
|
149
135
|
- lib/rack/runtime.rb
|
150
136
|
- lib/rack/sendfile.rb
|
151
|
-
- lib/rack/server.rb
|
152
|
-
- lib/rack/session/abstract/id.rb
|
153
|
-
- lib/rack/session/cookie.rb
|
154
|
-
- lib/rack/session/memcache.rb
|
155
|
-
- lib/rack/session/pool.rb
|
156
137
|
- lib/rack/show_exceptions.rb
|
157
138
|
- lib/rack/show_status.rb
|
158
139
|
- lib/rack/static.rb
|
@@ -160,16 +141,15 @@ files:
|
|
160
141
|
- lib/rack/urlmap.rb
|
161
142
|
- lib/rack/utils.rb
|
162
143
|
- lib/rack/version.rb
|
163
|
-
- rack.gemspec
|
164
144
|
homepage: https://github.com/rack/rack
|
165
145
|
licenses:
|
166
146
|
- MIT
|
167
147
|
metadata:
|
168
148
|
bug_tracker_uri: https://github.com/rack/rack/issues
|
169
|
-
changelog_uri: https://github.com/rack/rack/blob/
|
149
|
+
changelog_uri: https://github.com/rack/rack/blob/main/CHANGELOG.md
|
170
150
|
documentation_uri: https://rubydoc.info/github/rack/rack
|
171
151
|
source_code_uri: https://github.com/rack/rack
|
172
|
-
post_install_message:
|
152
|
+
post_install_message:
|
173
153
|
rdoc_options: []
|
174
154
|
require_paths:
|
175
155
|
- lib
|
@@ -177,15 +157,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
177
157
|
requirements:
|
178
158
|
- - ">="
|
179
159
|
- !ruby/object:Gem::Version
|
180
|
-
version: 2.
|
160
|
+
version: 2.4.0
|
181
161
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
182
162
|
requirements:
|
183
163
|
- - ">="
|
184
164
|
- !ruby/object:Gem::Version
|
185
165
|
version: '0'
|
186
166
|
requirements: []
|
187
|
-
rubygems_version: 3.
|
188
|
-
signing_key:
|
167
|
+
rubygems_version: 3.4.7
|
168
|
+
signing_key:
|
189
169
|
specification_version: 4
|
190
170
|
summary: A modular Ruby webserver interface.
|
191
171
|
test_files: []
|
data/README.rdoc
DELETED
@@ -1,320 +0,0 @@
|
|
1
|
-
= \Rack, a modular Ruby webserver interface
|
2
|
-
|
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
|
12
|
-
the simplest way possible, it unifies and distills the API for web
|
13
|
-
servers, web frameworks, and software in between (the so-called
|
14
|
-
middleware) into a single method call.
|
15
|
-
|
16
|
-
The exact details of this are described in the \Rack specification,
|
17
|
-
which all \Rack applications should conform to.
|
18
|
-
|
19
|
-
== Supported web servers
|
20
|
-
|
21
|
-
The included *handlers* connect all kinds of web servers to \Rack:
|
22
|
-
|
23
|
-
* WEBrick[https://github.com/ruby/webrick]
|
24
|
-
* FCGI
|
25
|
-
* CGI
|
26
|
-
* SCGI
|
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
|
42
|
-
changing anything.
|
43
|
-
|
44
|
-
== Supported web frameworks
|
45
|
-
|
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.
|
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.
|
91
|
-
* Rack::ShowException, for catching unhandled exceptions and
|
92
|
-
presenting them in a nice and helpful way with clickable backtrace.
|
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.
|
98
|
-
|
99
|
-
All these components use the same interface, which is described in
|
100
|
-
detail in the \Rack specification. These optional components can be
|
101
|
-
used in any way you wish.
|
102
|
-
|
103
|
-
== Convenience
|
104
|
-
|
105
|
-
If you want to develop outside of existing frameworks, implement your
|
106
|
-
own ones, or develop middleware, \Rack provides many helpers to create
|
107
|
-
\Rack applications quickly and without doing the same web stuff all
|
108
|
-
over:
|
109
|
-
|
110
|
-
* Rack::Request, which also provides query string parsing and
|
111
|
-
multipart handling.
|
112
|
-
* Rack::Response, for convenient generation of HTTP replies and
|
113
|
-
cookie handling.
|
114
|
-
* Rack::MockRequest and Rack::MockResponse for efficient and quick
|
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.
|
125
|
-
|
126
|
-
== rack-contrib
|
127
|
-
|
128
|
-
The plethora of useful middleware created the need for a project that
|
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.
|
131
|
-
|
132
|
-
* https://github.com/rack/rack-contrib
|
133
|
-
|
134
|
-
== rackup
|
135
|
-
|
136
|
-
rackup is a useful tool for running \Rack applications, which uses the
|
137
|
-
Rack::Builder DSL to configure middleware and build up applications
|
138
|
-
easily.
|
139
|
-
|
140
|
-
rackup automatically figures out the environment it is run in, and
|
141
|
-
runs your application as FastCGI, CGI, or WEBrick---all from the
|
142
|
-
same configuration.
|
143
|
-
|
144
|
-
== Quick start
|
145
|
-
|
146
|
-
Try the lobster!
|
147
|
-
|
148
|
-
Either with the embedded WEBrick starter:
|
149
|
-
|
150
|
-
ruby -Ilib lib/rack/lobster.rb
|
151
|
-
|
152
|
-
Or with rackup:
|
153
|
-
|
154
|
-
bin/rackup -Ilib example/lobster.ru
|
155
|
-
|
156
|
-
By default, the lobster is found at http://localhost:9292.
|
157
|
-
|
158
|
-
== Installing with RubyGems
|
159
|
-
|
160
|
-
A Gem of \Rack is available at {rubygems.org}[https://rubygems.org/gems/rack]. You can install it with:
|
161
|
-
|
162
|
-
gem install rack
|
163
|
-
|
164
|
-
== Usage
|
165
|
-
|
166
|
-
You should require the library:
|
167
|
-
|
168
|
-
require 'rack'
|
169
|
-
|
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.
|
173
|
-
|
174
|
-
== Configuration
|
175
|
-
|
176
|
-
Several parameters can be modified on Rack::Utils to configure \Rack behaviour.
|
177
|
-
|
178
|
-
e.g:
|
179
|
-
|
180
|
-
Rack::Utils.key_space_limit = 128
|
181
|
-
|
182
|
-
=== key_space_limit
|
183
|
-
|
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.
|
187
|
-
|
188
|
-
Defaults to 65536 characters.
|
189
|
-
|
190
|
-
=== param_depth_limit
|
191
|
-
|
192
|
-
The maximum amount of nesting allowed in parameters.
|
193
|
-
For example, if set to 3, this query string would be allowed:
|
194
|
-
|
195
|
-
?a[b][c]=d
|
196
|
-
|
197
|
-
but this query string would not be allowed:
|
198
|
-
|
199
|
-
?a[b][c][d]=e
|
200
|
-
|
201
|
-
Limiting the depth prevents a possible stack overflow when parsing parameters.
|
202
|
-
|
203
|
-
Defaults to 100.
|
204
|
-
|
205
|
-
=== multipart_file_limit
|
206
|
-
|
207
|
-
The maximum number of parts with a filename a request can contain.
|
208
|
-
Accepting too many part can lead to the server running out of file handles.
|
209
|
-
|
210
|
-
The default is 128, which means that a single request can't upload more than 128 files at once.
|
211
|
-
|
212
|
-
Set to 0 for no limit.
|
213
|
-
|
214
|
-
Can also be set via the +RACK_MULTIPART_FILE_LIMIT+ environment variable.
|
215
|
-
|
216
|
-
(This is also aliased as +multipart_part_limit+ and +RACK_MULTIPART_PART_LIMIT+ for compatibility)
|
217
|
-
|
218
|
-
=== multipart_total_part_limit
|
219
|
-
|
220
|
-
The maximum total number of parts a request can contain of any type, including
|
221
|
-
both file and non-file form fields.
|
222
|
-
|
223
|
-
The default is 4096, which means that a single request can't contain more than
|
224
|
-
4096 parts.
|
225
|
-
|
226
|
-
Set to 0 for no limit.
|
227
|
-
|
228
|
-
Can also be set via the +RACK_MULTIPART_TOTAL_PART_LIMIT+ environment variable.
|
229
|
-
|
230
|
-
== Changelog
|
231
|
-
|
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].
|
237
|
-
|
238
|
-
== Contact
|
239
|
-
|
240
|
-
Please post bugs, suggestions and patches to
|
241
|
-
the bug tracker at {issues}[https://github.com/rack/rack/issues].
|
242
|
-
|
243
|
-
Please post security related bugs and suggestions to the core team at
|
244
|
-
<https://groups.google.com/forum/#!forum/rack-core> or rack-core@googlegroups.com. This
|
245
|
-
list is not public. Due to wide usage of the library, it is strongly preferred
|
246
|
-
that we manage timing in order to provide viable patches at the time of
|
247
|
-
disclosure. Your assistance in this matter is greatly appreciated.
|
248
|
-
|
249
|
-
Mailing list archives are available at
|
250
|
-
<https://groups.google.com/forum/#!forum/rack-devel>.
|
251
|
-
|
252
|
-
Git repository (send Git patches to the mailing list):
|
253
|
-
|
254
|
-
* https://github.com/rack/rack
|
255
|
-
|
256
|
-
You are also welcome to join the #rack channel on irc.freenode.net.
|
257
|
-
|
258
|
-
== Thanks
|
259
|
-
|
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
|
270
|
-
|
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])
|
274
|
-
* James Tucker (raggi[https://github.com/raggi])
|
275
|
-
* Josh Peek (josh[https://github.com/josh])
|
276
|
-
* José Valim (josevalim[https://github.com/josevalim])
|
277
|
-
* Michael Fellinger (manveru[https://github.com/manveru])
|
278
|
-
* Santiago Pastorino (spastorino[https://github.com/spastorino])
|
279
|
-
* Konstantin Haase (rkh[https://github.com/rkh])
|
280
|
-
|
281
|
-
would like to thank:
|
282
|
-
|
283
|
-
* Adrian Madrid, for the LiteSpeed handler.
|
284
|
-
* Christoffer Sawicki, for the first Rails adapter and Rack::Deflater.
|
285
|
-
* Tim Fletcher, for the HTTP authentication code.
|
286
|
-
* Luc Heinrich for the Cookie sessions, the static file handler and bugfixes.
|
287
|
-
* Armin Ronacher, for the logo and racktools.
|
288
|
-
* Alex Beregszaszi, Alexander Kahn, Anil Wadghule, Aredridel, Ben
|
289
|
-
Alpert, Dan Kubb, Daniel Roethlisberger, Matt Todd, Tom Robinson,
|
290
|
-
Phil Hagelberg, S. Brent Faulkner, Bosko Milekic, Daniel Rodríguez
|
291
|
-
Troitiño, Genki Takiuchi, Geoffrey Grosenbach, Julien Sanchez, Kamal
|
292
|
-
Fariz Mahyuddin, Masayoshi Takahashi, Patrick Aljordm, Mig, Kazuhiro
|
293
|
-
Nishiyama, Jon Bardin, Konstantin Haase, Larry Siden, Matias
|
294
|
-
Korhonen, Sam Ruby, Simon Chiang, Tim Connor, Timur Batyrshin, and
|
295
|
-
Zach Brock for bug fixing and other improvements.
|
296
|
-
* Eric Wong, Hongli Lai, Jeremy Kemper for their continuous support
|
297
|
-
and API improvements.
|
298
|
-
* Yehuda Katz and Carl Lerche for refactoring rackup.
|
299
|
-
* Brian Candler, for Rack::ContentType.
|
300
|
-
* Graham Batty, for improved handler loading.
|
301
|
-
* Stephen Bannasch, for bug reports and documentation.
|
302
|
-
* Gary Wright, for proposing a better Rack::Response interface.
|
303
|
-
* Jonathan Buch, for improvements regarding Rack::Response.
|
304
|
-
* Armin Röhrl, for tracking down bugs in the Cookie generator.
|
305
|
-
* Alexander Kellett for testing the Gem and reviewing the announcement.
|
306
|
-
* Marcus Rückert, for help with configuring and debugging lighttpd.
|
307
|
-
* The WSGI team for the well-done and documented work they've done and
|
308
|
-
\Rack builds up on.
|
309
|
-
* All bug reporters and patch contributors not mentioned above.
|
310
|
-
|
311
|
-
== Links
|
312
|
-
|
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>
|
317
|
-
|
318
|
-
== License
|
319
|
-
|
320
|
-
\Rack is released under the {MIT License}[https://opensource.org/licenses/MIT].
|