rack 2.2.8 → 3.1.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (87) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +353 -81
  3. data/CONTRIBUTING.md +63 -55
  4. data/MIT-LICENSE +1 -1
  5. data/README.md +328 -0
  6. data/SPEC.rdoc +204 -131
  7. data/lib/rack/auth/abstract/handler.rb +3 -1
  8. data/lib/rack/auth/abstract/request.rb +3 -1
  9. data/lib/rack/auth/basic.rb +1 -4
  10. data/lib/rack/bad_request.rb +8 -0
  11. data/lib/rack/body_proxy.rb +21 -3
  12. data/lib/rack/builder.rb +102 -69
  13. data/lib/rack/cascade.rb +2 -3
  14. data/lib/rack/common_logger.rb +25 -19
  15. data/lib/rack/conditional_get.rb +18 -15
  16. data/lib/rack/constants.rb +67 -0
  17. data/lib/rack/content_length.rb +12 -16
  18. data/lib/rack/content_type.rb +8 -5
  19. data/lib/rack/deflater.rb +40 -26
  20. data/lib/rack/directory.rb +9 -3
  21. data/lib/rack/etag.rb +14 -23
  22. data/lib/rack/events.rb +4 -0
  23. data/lib/rack/files.rb +15 -17
  24. data/lib/rack/head.rb +9 -8
  25. data/lib/rack/headers.rb +238 -0
  26. data/lib/rack/lint.rb +840 -644
  27. data/lib/rack/lock.rb +2 -5
  28. data/lib/rack/logger.rb +3 -0
  29. data/lib/rack/media_type.rb +17 -7
  30. data/lib/rack/method_override.rb +5 -1
  31. data/lib/rack/mime.rb +14 -5
  32. data/lib/rack/mock.rb +1 -271
  33. data/lib/rack/mock_request.rb +161 -0
  34. data/lib/rack/mock_response.rb +124 -0
  35. data/lib/rack/multipart/generator.rb +7 -5
  36. data/lib/rack/multipart/parser.rb +214 -90
  37. data/lib/rack/multipart/uploaded_file.rb +4 -0
  38. data/lib/rack/multipart.rb +53 -40
  39. data/lib/rack/null_logger.rb +9 -0
  40. data/lib/rack/query_parser.rb +81 -102
  41. data/lib/rack/recursive.rb +2 -0
  42. data/lib/rack/reloader.rb +0 -2
  43. data/lib/rack/request.rb +260 -123
  44. data/lib/rack/response.rb +151 -66
  45. data/lib/rack/rewindable_input.rb +24 -5
  46. data/lib/rack/runtime.rb +7 -6
  47. data/lib/rack/sendfile.rb +30 -25
  48. data/lib/rack/show_exceptions.rb +21 -4
  49. data/lib/rack/show_status.rb +17 -7
  50. data/lib/rack/static.rb +8 -8
  51. data/lib/rack/tempfile_reaper.rb +15 -4
  52. data/lib/rack/urlmap.rb +3 -1
  53. data/lib/rack/utils.rb +240 -237
  54. data/lib/rack/version.rb +1 -9
  55. data/lib/rack.rb +13 -89
  56. metadata +15 -44
  57. data/README.rdoc +0 -320
  58. data/Rakefile +0 -130
  59. data/bin/rackup +0 -5
  60. data/contrib/rack.png +0 -0
  61. data/contrib/rack.svg +0 -150
  62. data/contrib/rack_logo.svg +0 -164
  63. data/contrib/rdoc.css +0 -412
  64. data/example/lobster.ru +0 -6
  65. data/example/protectedlobster.rb +0 -16
  66. data/example/protectedlobster.ru +0 -10
  67. data/lib/rack/auth/digest/md5.rb +0 -131
  68. data/lib/rack/auth/digest/nonce.rb +0 -54
  69. data/lib/rack/auth/digest/params.rb +0 -54
  70. data/lib/rack/auth/digest/request.rb +0 -43
  71. data/lib/rack/chunked.rb +0 -117
  72. data/lib/rack/core_ext/regexp.rb +0 -14
  73. data/lib/rack/file.rb +0 -7
  74. data/lib/rack/handler/cgi.rb +0 -59
  75. data/lib/rack/handler/fastcgi.rb +0 -100
  76. data/lib/rack/handler/lsws.rb +0 -61
  77. data/lib/rack/handler/scgi.rb +0 -71
  78. data/lib/rack/handler/thin.rb +0 -36
  79. data/lib/rack/handler/webrick.rb +0 -129
  80. data/lib/rack/handler.rb +0 -104
  81. data/lib/rack/lobster.rb +0 -70
  82. data/lib/rack/server.rb +0 -466
  83. data/lib/rack/session/abstract/id.rb +0 -523
  84. data/lib/rack/session/cookie.rb +0 -204
  85. data/lib/rack/session/memcache.rb +0 -10
  86. data/lib/rack/session/pool.rb +0 -85
  87. data/rack.gemspec +0 -46
data/lib/rack/version.rb CHANGED
@@ -12,15 +12,7 @@
12
12
  # so it should be enough just to <tt>require 'rack'</tt> in your code.
13
13
 
14
14
  module Rack
15
- # The Rack protocol version number implemented.
16
- VERSION = [1, 3]
17
-
18
- # Return the Rack protocol version as a dotted string.
19
- def self.version
20
- VERSION.join(".")
21
- end
22
-
23
- RELEASE = "2.2.8"
15
+ RELEASE = "3.1.10"
24
16
 
25
17
  # Return the Rack release as a dotted string.
26
18
  def self.release
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
- 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
- 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
- module Digest
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,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rack
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.2.8
4
+ version: 3.1.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - Leah Neukirchen
8
- autorequire:
9
8
  bindir: bin
10
9
  cert_chain: []
11
- date: 2023-07-31 00:00:00.000000000 Z
10
+ date: 2025-02-12 00:00:00.000000000 Z
12
11
  dependencies:
13
12
  - !ruby/object:Gem::Dependency
14
13
  name: minitest
@@ -25,7 +24,7 @@ dependencies:
25
24
  - !ruby/object:Gem::Version
26
25
  version: '5.0'
27
26
  - !ruby/object:Gem::Dependency
28
- name: minitest-sprint
27
+ name: minitest-global_expectations
29
28
  requirement: !ruby/object:Gem::Requirement
30
29
  requirements:
31
30
  - - ">="
@@ -39,7 +38,7 @@ dependencies:
39
38
  - !ruby/object:Gem::Version
40
39
  version: '0'
41
40
  - !ruby/object:Gem::Dependency
42
- name: minitest-global_expectations
41
+ name: bundler
43
42
  requirement: !ruby/object:Gem::Requirement
44
43
  requirements:
45
44
  - - ">="
@@ -73,68 +72,48 @@ description: |
73
72
  servers, web frameworks, and software in between (the so-called
74
73
  middleware) into a single method call.
75
74
  email: leah@vuxu.org
76
- executables:
77
- - rackup
75
+ executables: []
78
76
  extensions: []
79
77
  extra_rdoc_files:
80
- - README.rdoc
78
+ - README.md
81
79
  - CHANGELOG.md
82
80
  - CONTRIBUTING.md
83
81
  files:
84
82
  - CHANGELOG.md
85
83
  - CONTRIBUTING.md
86
84
  - MIT-LICENSE
87
- - README.rdoc
88
- - Rakefile
85
+ - README.md
89
86
  - 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
87
  - lib/rack.rb
99
88
  - lib/rack/auth/abstract/handler.rb
100
89
  - lib/rack/auth/abstract/request.rb
101
90
  - lib/rack/auth/basic.rb
102
- - lib/rack/auth/digest/md5.rb
103
- - lib/rack/auth/digest/nonce.rb
104
- - lib/rack/auth/digest/params.rb
105
- - lib/rack/auth/digest/request.rb
91
+ - lib/rack/bad_request.rb
106
92
  - lib/rack/body_proxy.rb
107
93
  - lib/rack/builder.rb
108
94
  - lib/rack/cascade.rb
109
- - lib/rack/chunked.rb
110
95
  - lib/rack/common_logger.rb
111
96
  - lib/rack/conditional_get.rb
112
97
  - lib/rack/config.rb
98
+ - lib/rack/constants.rb
113
99
  - lib/rack/content_length.rb
114
100
  - lib/rack/content_type.rb
115
- - lib/rack/core_ext/regexp.rb
116
101
  - lib/rack/deflater.rb
117
102
  - lib/rack/directory.rb
118
103
  - lib/rack/etag.rb
119
104
  - lib/rack/events.rb
120
- - lib/rack/file.rb
121
105
  - 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
106
  - lib/rack/head.rb
107
+ - lib/rack/headers.rb
130
108
  - lib/rack/lint.rb
131
- - lib/rack/lobster.rb
132
109
  - lib/rack/lock.rb
133
110
  - lib/rack/logger.rb
134
111
  - lib/rack/media_type.rb
135
112
  - lib/rack/method_override.rb
136
113
  - lib/rack/mime.rb
137
114
  - lib/rack/mock.rb
115
+ - lib/rack/mock_request.rb
116
+ - lib/rack/mock_response.rb
138
117
  - lib/rack/multipart.rb
139
118
  - lib/rack/multipart/generator.rb
140
119
  - lib/rack/multipart/parser.rb
@@ -148,11 +127,6 @@ files:
148
127
  - lib/rack/rewindable_input.rb
149
128
  - lib/rack/runtime.rb
150
129
  - 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
130
  - lib/rack/show_exceptions.rb
157
131
  - lib/rack/show_status.rb
158
132
  - lib/rack/static.rb
@@ -160,16 +134,14 @@ files:
160
134
  - lib/rack/urlmap.rb
161
135
  - lib/rack/utils.rb
162
136
  - lib/rack/version.rb
163
- - rack.gemspec
164
137
  homepage: https://github.com/rack/rack
165
138
  licenses:
166
139
  - MIT
167
140
  metadata:
168
141
  bug_tracker_uri: https://github.com/rack/rack/issues
169
- changelog_uri: https://github.com/rack/rack/blob/master/CHANGELOG.md
142
+ changelog_uri: https://github.com/rack/rack/blob/main/CHANGELOG.md
170
143
  documentation_uri: https://rubydoc.info/github/rack/rack
171
144
  source_code_uri: https://github.com/rack/rack
172
- post_install_message:
173
145
  rdoc_options: []
174
146
  require_paths:
175
147
  - lib
@@ -177,15 +149,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
177
149
  requirements:
178
150
  - - ">="
179
151
  - !ruby/object:Gem::Version
180
- version: 2.3.0
152
+ version: 2.4.0
181
153
  required_rubygems_version: !ruby/object:Gem::Requirement
182
154
  requirements:
183
155
  - - ">="
184
156
  - !ruby/object:Gem::Version
185
157
  version: '0'
186
158
  requirements: []
187
- rubygems_version: 3.4.10
188
- signing_key:
159
+ rubygems_version: 3.6.2
189
160
  specification_version: 4
190
161
  summary: A modular Ruby webserver interface.
191
162
  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].