rack 2.2.7 → 3.1.3
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 +291 -78
- data/CONTRIBUTING.md +63 -55
- data/MIT-LICENSE +1 -1
- data/README.md +328 -0
- data/SPEC.rdoc +213 -136
- data/lib/rack/auth/abstract/handler.rb +3 -1
- data/lib/rack/auth/abstract/request.rb +3 -1
- data/lib/rack/auth/basic.rb +1 -4
- data/lib/rack/bad_request.rb +8 -0
- data/lib/rack/body_proxy.rb +21 -3
- data/lib/rack/builder.rb +102 -69
- data/lib/rack/cascade.rb +2 -3
- data/lib/rack/common_logger.rb +23 -18
- data/lib/rack/conditional_get.rb +18 -15
- data/lib/rack/constants.rb +67 -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/files.rb +15 -17
- data/lib/rack/head.rb +9 -8
- data/lib/rack/headers.rb +238 -0
- data/lib/rack/lint.rb +864 -681
- data/lib/rack/lock.rb +2 -5
- data/lib/rack/logger.rb +3 -0
- data/lib/rack/media_type.rb +9 -4
- data/lib/rack/method_override.rb +5 -1
- data/lib/rack/mime.rb +14 -5
- data/lib/rack/mock.rb +1 -271
- data/lib/rack/mock_request.rb +171 -0
- data/lib/rack/mock_response.rb +124 -0
- data/lib/rack/multipart/generator.rb +7 -5
- data/lib/rack/multipart/parser.rb +218 -91
- data/lib/rack/multipart/uploaded_file.rb +4 -0
- data/lib/rack/multipart.rb +53 -40
- data/lib/rack/null_logger.rb +9 -0
- data/lib/rack/query_parser.rb +81 -102
- data/lib/rack/recursive.rb +2 -0
- data/lib/rack/reloader.rb +0 -2
- data/lib/rack/request.rb +248 -123
- data/lib/rack/response.rb +146 -66
- 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 +21 -4
- 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 +237 -235
- data/lib/rack/version.rb +1 -9
- data/lib/rack.rb +13 -89
- metadata +15 -41
- 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/auth/digest/md5.rb +0 -131
- data/lib/rack/auth/digest/nonce.rb +0 -54
- data/lib/rack/auth/digest/params.rb +0 -54
- data/lib/rack/auth/digest/request.rb +0 -43
- data/lib/rack/chunked.rb +0 -117
- data/lib/rack/core_ext/regexp.rb +0 -14
- data/lib/rack/file.rb +0 -7
- 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,130 +12,54 @@
|
|
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
|
-
|
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
|
-
autoload :Builder, "rack/builder"
|
18
|
+
autoload :BadRequest, "rack/bad_request"
|
80
19
|
autoload :BodyProxy, "rack/body_proxy"
|
20
|
+
autoload :Builder, "rack/builder"
|
81
21
|
autoload :Cascade, "rack/cascade"
|
82
|
-
autoload :Chunked, "rack/chunked"
|
83
22
|
autoload :CommonLogger, "rack/common_logger"
|
84
23
|
autoload :ConditionalGet, "rack/conditional_get"
|
85
24
|
autoload :Config, "rack/config"
|
86
25
|
autoload :ContentLength, "rack/content_length"
|
87
26
|
autoload :ContentType, "rack/content_type"
|
27
|
+
autoload :Deflater, "rack/deflater"
|
28
|
+
autoload :Directory, "rack/directory"
|
88
29
|
autoload :ETag, "rack/etag"
|
89
30
|
autoload :Events, "rack/events"
|
90
|
-
autoload :File, "rack/file"
|
91
31
|
autoload :Files, "rack/files"
|
92
|
-
autoload :Deflater, "rack/deflater"
|
93
|
-
autoload :Directory, "rack/directory"
|
94
32
|
autoload :ForwardRequest, "rack/recursive"
|
95
|
-
autoload :Handler, "rack/handler"
|
96
33
|
autoload :Head, "rack/head"
|
34
|
+
autoload :Headers, "rack/headers"
|
97
35
|
autoload :Lint, "rack/lint"
|
98
36
|
autoload :Lock, "rack/lock"
|
99
37
|
autoload :Logger, "rack/logger"
|
100
38
|
autoload :MediaType, "rack/media_type"
|
101
39
|
autoload :MethodOverride, "rack/method_override"
|
102
40
|
autoload :Mime, "rack/mime"
|
41
|
+
autoload :MockRequest, "rack/mock_request"
|
42
|
+
autoload :MockResponse, "rack/mock_response"
|
43
|
+
autoload :Multipart, "rack/multipart"
|
103
44
|
autoload :NullLogger, "rack/null_logger"
|
45
|
+
autoload :QueryParser, "rack/query_parser"
|
104
46
|
autoload :Recursive, "rack/recursive"
|
105
47
|
autoload :Reloader, "rack/reloader"
|
48
|
+
autoload :Request, "rack/request"
|
49
|
+
autoload :Response, "rack/response"
|
106
50
|
autoload :RewindableInput, "rack/rewindable_input"
|
107
51
|
autoload :Runtime, "rack/runtime"
|
108
52
|
autoload :Sendfile, "rack/sendfile"
|
109
|
-
autoload :Server, "rack/server"
|
110
53
|
autoload :ShowExceptions, "rack/show_exceptions"
|
111
54
|
autoload :ShowStatus, "rack/show_status"
|
112
55
|
autoload :Static, "rack/static"
|
113
56
|
autoload :TempfileReaper, "rack/tempfile_reaper"
|
114
57
|
autoload :URLMap, "rack/urlmap"
|
115
58
|
autoload :Utils, "rack/utils"
|
116
|
-
autoload :Multipart, "rack/multipart"
|
117
|
-
|
118
|
-
autoload :MockRequest, "rack/mock"
|
119
|
-
autoload :MockResponse, "rack/mock"
|
120
|
-
|
121
|
-
autoload :Request, "rack/request"
|
122
|
-
autoload :Response, "rack/response"
|
123
59
|
|
124
60
|
module Auth
|
125
61
|
autoload :Basic, "rack/auth/basic"
|
126
|
-
autoload :AbstractRequest, "rack/auth/abstract/request"
|
127
62
|
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"
|
63
|
+
autoload :AbstractRequest, "rack/auth/abstract/request"
|
140
64
|
end
|
141
65
|
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.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Leah Neukirchen
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2024-06-12 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,68 +73,48 @@ 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
|
102
|
-
- lib/rack/
|
103
|
-
- lib/rack/auth/digest/nonce.rb
|
104
|
-
- lib/rack/auth/digest/params.rb
|
105
|
-
- lib/rack/auth/digest/request.rb
|
92
|
+
- lib/rack/bad_request.rb
|
106
93
|
- lib/rack/body_proxy.rb
|
107
94
|
- lib/rack/builder.rb
|
108
95
|
- lib/rack/cascade.rb
|
109
|
-
- lib/rack/chunked.rb
|
110
96
|
- lib/rack/common_logger.rb
|
111
97
|
- lib/rack/conditional_get.rb
|
112
98
|
- lib/rack/config.rb
|
99
|
+
- lib/rack/constants.rb
|
113
100
|
- lib/rack/content_length.rb
|
114
101
|
- lib/rack/content_type.rb
|
115
|
-
- lib/rack/core_ext/regexp.rb
|
116
102
|
- lib/rack/deflater.rb
|
117
103
|
- lib/rack/directory.rb
|
118
104
|
- lib/rack/etag.rb
|
119
105
|
- lib/rack/events.rb
|
120
|
-
- lib/rack/file.rb
|
121
106
|
- 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
107
|
- lib/rack/head.rb
|
108
|
+
- lib/rack/headers.rb
|
130
109
|
- lib/rack/lint.rb
|
131
|
-
- lib/rack/lobster.rb
|
132
110
|
- lib/rack/lock.rb
|
133
111
|
- lib/rack/logger.rb
|
134
112
|
- lib/rack/media_type.rb
|
135
113
|
- lib/rack/method_override.rb
|
136
114
|
- lib/rack/mime.rb
|
137
115
|
- lib/rack/mock.rb
|
116
|
+
- lib/rack/mock_request.rb
|
117
|
+
- lib/rack/mock_response.rb
|
138
118
|
- lib/rack/multipart.rb
|
139
119
|
- lib/rack/multipart/generator.rb
|
140
120
|
- lib/rack/multipart/parser.rb
|
@@ -148,11 +128,6 @@ files:
|
|
148
128
|
- lib/rack/rewindable_input.rb
|
149
129
|
- lib/rack/runtime.rb
|
150
130
|
- 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
131
|
- lib/rack/show_exceptions.rb
|
157
132
|
- lib/rack/show_status.rb
|
158
133
|
- lib/rack/static.rb
|
@@ -160,13 +135,12 @@ files:
|
|
160
135
|
- lib/rack/urlmap.rb
|
161
136
|
- lib/rack/utils.rb
|
162
137
|
- lib/rack/version.rb
|
163
|
-
- rack.gemspec
|
164
138
|
homepage: https://github.com/rack/rack
|
165
139
|
licenses:
|
166
140
|
- MIT
|
167
141
|
metadata:
|
168
142
|
bug_tracker_uri: https://github.com/rack/rack/issues
|
169
|
-
changelog_uri: https://github.com/rack/rack/blob/
|
143
|
+
changelog_uri: https://github.com/rack/rack/blob/main/CHANGELOG.md
|
170
144
|
documentation_uri: https://rubydoc.info/github/rack/rack
|
171
145
|
source_code_uri: https://github.com/rack/rack
|
172
146
|
post_install_message:
|
@@ -177,14 +151,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
177
151
|
requirements:
|
178
152
|
- - ">="
|
179
153
|
- !ruby/object:Gem::Version
|
180
|
-
version: 2.
|
154
|
+
version: 2.4.0
|
181
155
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
182
156
|
requirements:
|
183
157
|
- - ">="
|
184
158
|
- !ruby/object:Gem::Version
|
185
159
|
version: '0'
|
186
160
|
requirements: []
|
187
|
-
rubygems_version: 3.
|
161
|
+
rubygems_version: 3.5.9
|
188
162
|
signing_key:
|
189
163
|
specification_version: 4
|
190
164
|
summary: A modular Ruby webserver interface.
|
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].
|