rack 2.2.14 → 3.1.14

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 +423 -70
  3. data/CONTRIBUTING.md +63 -55
  4. data/MIT-LICENSE +1 -1
  5. data/README.md +355 -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 -3
  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 +22 -17
  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 +17 -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 +8 -3
  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 +213 -95
  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 +79 -101
  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 +236 -237
  54. data/lib/rack/version.rb +1 -9
  55. data/lib/rack.rb +13 -89
  56. metadata +13 -39
  57. data/README.rdoc +0 -347
  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 -53
  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 -203
  85. data/lib/rack/session/memcache.rb +0 -10
  86. data/lib/rack/session/pool.rb +0 -90
  87. 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
- 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,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rack
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.2.14
4
+ version: 3.1.14
5
5
  platform: ruby
6
6
  authors:
7
7
  - Leah Neukirchen
@@ -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-sprint
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: minitest-global_expectations
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.rdoc
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.rdoc
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/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
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/master/CHANGELOG.md
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,7 +151,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
177
151
  requirements:
178
152
  - - ">="
179
153
  - !ruby/object:Gem::Version
180
- version: 2.3.0
154
+ version: 2.4.0
181
155
  required_rubygems_version: !ruby/object:Gem::Requirement
182
156
  requirements:
183
157
  - - ">="
data/README.rdoc DELETED
@@ -1,347 +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
- === `RACK_QUERY_PARSER_BYTESIZE_LIMIT`
183
-
184
- This environment variable sets the default for the maximum query string bytesize
185
- that `Rack::QueryParser` will attempt to parse. Attempts to use a query string
186
- that exceeds this number of bytes will result in a
187
- `Rack::QueryParser::QueryLimitError` exception. If this enviroment variable is
188
- provided, it must be an integer, or `Rack::QueryParser` will raise an exception.
189
-
190
- The default limit can be overridden on a per-`Rack::QueryParser` basis using
191
- the `bytesize_limit` keyword argument when creating the `Rack::QueryParser`.
192
-
193
- === `RACK_QUERY_PARSER_PARAMS_LIMIT`
194
-
195
- This environment variable sets the default for the maximum number of query
196
- parameters that `Rack::QueryParser` will attempt to parse. Attempts to use a
197
- query string with more than this many query parameters will result in a
198
- `Rack::QueryParser::QueryLimitError` exception. If this enviroment variable is
199
- provided, it must be an integer, or `Rack::QueryParser` will raise an exception.
200
-
201
- The default limit can be overridden on a per-`Rack::QueryParser` basis using
202
- the `params_limit` keyword argument when creating the `Rack::QueryParser`.
203
-
204
- This is implemented by counting the number of parameter separators in the
205
- query string, before attempting parsing, so if the same parameter key is
206
- used multiple times in the query, each counts as a separate parameter for
207
- this check.
208
-
209
- === key_space_limit
210
-
211
- The default number of bytes to allow all parameters keys in a given parameter hash to take up.
212
- Does not affect nested parameter hashes, so doesn't actually prevent an attacker from using
213
- more than this many bytes for parameter keys.
214
-
215
- Defaults to 65536 characters.
216
-
217
- === param_depth_limit
218
-
219
- The maximum amount of nesting allowed in parameters.
220
- For example, if set to 3, this query string would be allowed:
221
-
222
- ?a[b][c]=d
223
-
224
- but this query string would not be allowed:
225
-
226
- ?a[b][c][d]=e
227
-
228
- Limiting the depth prevents a possible stack overflow when parsing parameters.
229
-
230
- Defaults to 100.
231
-
232
- === multipart_file_limit
233
-
234
- The maximum number of parts with a filename a request can contain.
235
- Accepting too many part can lead to the server running out of file handles.
236
-
237
- The default is 128, which means that a single request can't upload more than 128 files at once.
238
-
239
- Set to 0 for no limit.
240
-
241
- Can also be set via the +RACK_MULTIPART_FILE_LIMIT+ environment variable.
242
-
243
- (This is also aliased as +multipart_part_limit+ and +RACK_MULTIPART_PART_LIMIT+ for compatibility)
244
-
245
- === multipart_total_part_limit
246
-
247
- The maximum total number of parts a request can contain of any type, including
248
- both file and non-file form fields.
249
-
250
- The default is 4096, which means that a single request can't contain more than
251
- 4096 parts.
252
-
253
- Set to 0 for no limit.
254
-
255
- Can also be set via the +RACK_MULTIPART_TOTAL_PART_LIMIT+ environment variable.
256
-
257
- == Changelog
258
-
259
- See {CHANGELOG.md}[https://github.com/rack/rack/blob/master/CHANGELOG.md].
260
-
261
- == Contributing
262
-
263
- See {CONTRIBUTING.md}[https://github.com/rack/rack/blob/master/CONTRIBUTING.md].
264
-
265
- == Contact
266
-
267
- Please post bugs, suggestions and patches to
268
- the bug tracker at {issues}[https://github.com/rack/rack/issues].
269
-
270
- Please post security related bugs and suggestions to the core team at
271
- <https://groups.google.com/forum/#!forum/rack-core> or rack-core@googlegroups.com. This
272
- list is not public. Due to wide usage of the library, it is strongly preferred
273
- that we manage timing in order to provide viable patches at the time of
274
- disclosure. Your assistance in this matter is greatly appreciated.
275
-
276
- Mailing list archives are available at
277
- <https://groups.google.com/forum/#!forum/rack-devel>.
278
-
279
- Git repository (send Git patches to the mailing list):
280
-
281
- * https://github.com/rack/rack
282
-
283
- You are also welcome to join the #rack channel on irc.freenode.net.
284
-
285
- == Thanks
286
-
287
- The \Rack Core Team, consisting of
288
-
289
- * Aaron Patterson (tenderlove[https://github.com/tenderlove])
290
- * Samuel Williams (ioquatix[https://github.com/ioquatix])
291
- * Jeremy Evans (jeremyevans[https://github.com/jeremyevans])
292
- * Eileen Uchitelle (eileencodes[https://github.com/eileencodes])
293
- * Matthew Draper (matthewd[https://github.com/matthewd])
294
- * Rafael França (rafaelfranca[https://github.com/rafaelfranca])
295
-
296
- and the \Rack Alumni
297
-
298
- * Ryan Tomayko (rtomayko[https://github.com/rtomayko])
299
- * Scytrin dai Kinthra (scytrin[https://github.com/scytrin])
300
- * Leah Neukirchen (leahneukirchen[https://github.com/leahneukirchen])
301
- * James Tucker (raggi[https://github.com/raggi])
302
- * Josh Peek (josh[https://github.com/josh])
303
- * José Valim (josevalim[https://github.com/josevalim])
304
- * Michael Fellinger (manveru[https://github.com/manveru])
305
- * Santiago Pastorino (spastorino[https://github.com/spastorino])
306
- * Konstantin Haase (rkh[https://github.com/rkh])
307
-
308
- would like to thank:
309
-
310
- * Adrian Madrid, for the LiteSpeed handler.
311
- * Christoffer Sawicki, for the first Rails adapter and Rack::Deflater.
312
- * Tim Fletcher, for the HTTP authentication code.
313
- * Luc Heinrich for the Cookie sessions, the static file handler and bugfixes.
314
- * Armin Ronacher, for the logo and racktools.
315
- * Alex Beregszaszi, Alexander Kahn, Anil Wadghule, Aredridel, Ben
316
- Alpert, Dan Kubb, Daniel Roethlisberger, Matt Todd, Tom Robinson,
317
- Phil Hagelberg, S. Brent Faulkner, Bosko Milekic, Daniel Rodríguez
318
- Troitiño, Genki Takiuchi, Geoffrey Grosenbach, Julien Sanchez, Kamal
319
- Fariz Mahyuddin, Masayoshi Takahashi, Patrick Aljordm, Mig, Kazuhiro
320
- Nishiyama, Jon Bardin, Konstantin Haase, Larry Siden, Matias
321
- Korhonen, Sam Ruby, Simon Chiang, Tim Connor, Timur Batyrshin, and
322
- Zach Brock for bug fixing and other improvements.
323
- * Eric Wong, Hongli Lai, Jeremy Kemper for their continuous support
324
- and API improvements.
325
- * Yehuda Katz and Carl Lerche for refactoring rackup.
326
- * Brian Candler, for Rack::ContentType.
327
- * Graham Batty, for improved handler loading.
328
- * Stephen Bannasch, for bug reports and documentation.
329
- * Gary Wright, for proposing a better Rack::Response interface.
330
- * Jonathan Buch, for improvements regarding Rack::Response.
331
- * Armin Röhrl, for tracking down bugs in the Cookie generator.
332
- * Alexander Kellett for testing the Gem and reviewing the announcement.
333
- * Marcus Rückert, for help with configuring and debugging lighttpd.
334
- * The WSGI team for the well-done and documented work they've done and
335
- \Rack builds up on.
336
- * All bug reporters and patch contributors not mentioned above.
337
-
338
- == Links
339
-
340
- \Rack:: <https://rack.github.io/>
341
- Official \Rack repositories:: <https://github.com/rack>
342
- \Rack Bug Tracking:: <https://github.com/rack/rack/issues>
343
- rack-devel mailing list:: <https://groups.google.com/forum/#!forum/rack-devel>
344
-
345
- == License
346
-
347
- \Rack is released under the {MIT License}[https://opensource.org/licenses/MIT].