rack 1.6.11 → 2.2.0

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.

Files changed (190) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +675 -0
  3. data/CONTRIBUTING.md +136 -0
  4. data/{COPYING → MIT-LICENSE} +4 -2
  5. data/README.rdoc +157 -163
  6. data/Rakefile +38 -32
  7. data/{SPEC → SPEC.rdoc} +41 -13
  8. data/bin/rackup +1 -0
  9. data/contrib/rack_logo.svg +164 -111
  10. data/example/lobster.ru +2 -0
  11. data/example/protectedlobster.rb +4 -2
  12. data/example/protectedlobster.ru +3 -1
  13. data/lib/rack/auth/abstract/handler.rb +3 -1
  14. data/lib/rack/auth/abstract/request.rb +6 -2
  15. data/lib/rack/auth/basic.rb +7 -4
  16. data/lib/rack/auth/digest/md5.rb +13 -11
  17. data/lib/rack/auth/digest/nonce.rb +6 -3
  18. data/lib/rack/auth/digest/params.rb +5 -4
  19. data/lib/rack/auth/digest/request.rb +6 -4
  20. data/lib/rack/body_proxy.rb +21 -15
  21. data/lib/rack/builder.rb +119 -26
  22. data/lib/rack/cascade.rb +28 -12
  23. data/lib/rack/chunked.rb +70 -22
  24. data/lib/rack/common_logger.rb +80 -0
  25. data/lib/rack/{conditionalget.rb → conditional_get.rb} +20 -16
  26. data/lib/rack/config.rb +2 -0
  27. data/lib/rack/content_length.rb +9 -8
  28. data/lib/rack/content_type.rb +5 -4
  29. data/lib/rack/core_ext/regexp.rb +14 -0
  30. data/lib/rack/deflater.rb +60 -70
  31. data/lib/rack/directory.rb +117 -85
  32. data/lib/rack/etag.rb +9 -7
  33. data/lib/rack/events.rb +153 -0
  34. data/lib/rack/file.rb +4 -149
  35. data/lib/rack/files.rb +218 -0
  36. data/lib/rack/handler/cgi.rb +17 -19
  37. data/lib/rack/handler/fastcgi.rb +17 -18
  38. data/lib/rack/handler/lsws.rb +14 -14
  39. data/lib/rack/handler/scgi.rb +22 -21
  40. data/lib/rack/handler/thin.rb +20 -11
  41. data/lib/rack/handler/webrick.rb +39 -32
  42. data/lib/rack/handler.rb +9 -26
  43. data/lib/rack/head.rb +16 -18
  44. data/lib/rack/lint.rb +110 -64
  45. data/lib/rack/lobster.rb +10 -10
  46. data/lib/rack/lock.rb +17 -11
  47. data/lib/rack/logger.rb +4 -2
  48. data/lib/rack/media_type.rb +43 -0
  49. data/lib/rack/{methodoverride.rb → method_override.rb} +10 -8
  50. data/lib/rack/mime.rb +27 -6
  51. data/lib/rack/mock.rb +124 -65
  52. data/lib/rack/multipart/generator.rb +20 -16
  53. data/lib/rack/multipart/parser.rb +273 -162
  54. data/lib/rack/multipart/uploaded_file.rb +15 -8
  55. data/lib/rack/multipart.rb +39 -8
  56. data/lib/rack/{nulllogger.rb → null_logger.rb} +3 -1
  57. data/lib/rack/query_parser.rb +217 -0
  58. data/lib/rack/recursive.rb +11 -9
  59. data/lib/rack/reloader.rb +8 -4
  60. data/lib/rack/request.rb +543 -305
  61. data/lib/rack/response.rb +244 -88
  62. data/lib/rack/rewindable_input.rb +5 -15
  63. data/lib/rack/runtime.rb +12 -18
  64. data/lib/rack/sendfile.rb +17 -15
  65. data/lib/rack/server.rb +125 -47
  66. data/lib/rack/session/abstract/id.rb +216 -93
  67. data/lib/rack/session/cookie.rb +47 -31
  68. data/lib/rack/session/memcache.rb +4 -87
  69. data/lib/rack/session/pool.rb +26 -17
  70. data/lib/rack/show_exceptions.rb +390 -0
  71. data/lib/rack/{showstatus.rb → show_status.rb} +8 -8
  72. data/lib/rack/static.rb +48 -11
  73. data/lib/rack/tempfile_reaper.rb +3 -3
  74. data/lib/rack/urlmap.rb +26 -19
  75. data/lib/rack/utils.rb +208 -294
  76. data/lib/rack/version.rb +29 -0
  77. data/lib/rack.rb +76 -33
  78. data/rack.gemspec +43 -30
  79. metadata +62 -183
  80. data/HISTORY.md +0 -375
  81. data/KNOWN-ISSUES +0 -44
  82. data/lib/rack/backports/uri/common_18.rb +0 -56
  83. data/lib/rack/backports/uri/common_192.rb +0 -52
  84. data/lib/rack/backports/uri/common_193.rb +0 -29
  85. data/lib/rack/commonlogger.rb +0 -72
  86. data/lib/rack/handler/evented_mongrel.rb +0 -8
  87. data/lib/rack/handler/mongrel.rb +0 -106
  88. data/lib/rack/handler/swiftiplied_mongrel.rb +0 -8
  89. data/lib/rack/showexceptions.rb +0 -387
  90. data/lib/rack/utils/okjson.rb +0 -600
  91. data/test/builder/anything.rb +0 -5
  92. data/test/builder/comment.ru +0 -4
  93. data/test/builder/end.ru +0 -5
  94. data/test/builder/line.ru +0 -1
  95. data/test/builder/options.ru +0 -2
  96. data/test/cgi/assets/folder/test.js +0 -1
  97. data/test/cgi/assets/fonts/font.eot +0 -1
  98. data/test/cgi/assets/images/image.png +0 -1
  99. data/test/cgi/assets/index.html +0 -1
  100. data/test/cgi/assets/javascripts/app.js +0 -1
  101. data/test/cgi/assets/stylesheets/app.css +0 -1
  102. data/test/cgi/lighttpd.conf +0 -26
  103. data/test/cgi/rackup_stub.rb +0 -6
  104. data/test/cgi/sample_rackup.ru +0 -5
  105. data/test/cgi/test +0 -9
  106. data/test/cgi/test+directory/test+file +0 -1
  107. data/test/cgi/test.fcgi +0 -8
  108. data/test/cgi/test.ru +0 -5
  109. data/test/gemloader.rb +0 -10
  110. data/test/multipart/bad_robots +0 -259
  111. data/test/multipart/binary +0 -0
  112. data/test/multipart/content_type_and_no_filename +0 -6
  113. data/test/multipart/empty +0 -10
  114. data/test/multipart/fail_16384_nofile +0 -814
  115. data/test/multipart/file1.txt +0 -1
  116. data/test/multipart/filename_and_modification_param +0 -7
  117. data/test/multipart/filename_and_no_name +0 -6
  118. data/test/multipart/filename_with_escaped_quotes +0 -6
  119. data/test/multipart/filename_with_escaped_quotes_and_modification_param +0 -7
  120. data/test/multipart/filename_with_null_byte +0 -7
  121. data/test/multipart/filename_with_percent_escaped_quotes +0 -6
  122. data/test/multipart/filename_with_unescaped_percentages +0 -6
  123. data/test/multipart/filename_with_unescaped_percentages2 +0 -6
  124. data/test/multipart/filename_with_unescaped_percentages3 +0 -6
  125. data/test/multipart/filename_with_unescaped_quotes +0 -6
  126. data/test/multipart/ie +0 -6
  127. data/test/multipart/invalid_character +0 -6
  128. data/test/multipart/mixed_files +0 -21
  129. data/test/multipart/nested +0 -10
  130. data/test/multipart/none +0 -9
  131. data/test/multipart/semicolon +0 -6
  132. data/test/multipart/text +0 -15
  133. data/test/multipart/three_files_three_fields +0 -31
  134. data/test/multipart/webkit +0 -32
  135. data/test/rackup/config.ru +0 -31
  136. data/test/registering_handler/rack/handler/registering_myself.rb +0 -8
  137. data/test/spec_auth_basic.rb +0 -81
  138. data/test/spec_auth_digest.rb +0 -259
  139. data/test/spec_body_proxy.rb +0 -85
  140. data/test/spec_builder.rb +0 -223
  141. data/test/spec_cascade.rb +0 -61
  142. data/test/spec_cgi.rb +0 -102
  143. data/test/spec_chunked.rb +0 -101
  144. data/test/spec_commonlogger.rb +0 -93
  145. data/test/spec_conditionalget.rb +0 -102
  146. data/test/spec_config.rb +0 -22
  147. data/test/spec_content_length.rb +0 -85
  148. data/test/spec_content_type.rb +0 -45
  149. data/test/spec_deflater.rb +0 -339
  150. data/test/spec_directory.rb +0 -88
  151. data/test/spec_etag.rb +0 -107
  152. data/test/spec_fastcgi.rb +0 -107
  153. data/test/spec_file.rb +0 -221
  154. data/test/spec_handler.rb +0 -72
  155. data/test/spec_head.rb +0 -45
  156. data/test/spec_lint.rb +0 -550
  157. data/test/spec_lobster.rb +0 -58
  158. data/test/spec_lock.rb +0 -164
  159. data/test/spec_logger.rb +0 -23
  160. data/test/spec_methodoverride.rb +0 -111
  161. data/test/spec_mime.rb +0 -51
  162. data/test/spec_mock.rb +0 -297
  163. data/test/spec_mongrel.rb +0 -182
  164. data/test/spec_multipart.rb +0 -600
  165. data/test/spec_nulllogger.rb +0 -20
  166. data/test/spec_recursive.rb +0 -72
  167. data/test/spec_request.rb +0 -1232
  168. data/test/spec_response.rb +0 -407
  169. data/test/spec_rewindable_input.rb +0 -118
  170. data/test/spec_runtime.rb +0 -49
  171. data/test/spec_sendfile.rb +0 -130
  172. data/test/spec_server.rb +0 -167
  173. data/test/spec_session_abstract_id.rb +0 -53
  174. data/test/spec_session_cookie.rb +0 -410
  175. data/test/spec_session_memcache.rb +0 -321
  176. data/test/spec_session_pool.rb +0 -209
  177. data/test/spec_showexceptions.rb +0 -98
  178. data/test/spec_showstatus.rb +0 -103
  179. data/test/spec_static.rb +0 -145
  180. data/test/spec_tempfile_reaper.rb +0 -63
  181. data/test/spec_thin.rb +0 -91
  182. data/test/spec_urlmap.rb +0 -236
  183. data/test/spec_utils.rb +0 -647
  184. data/test/spec_version.rb +0 -17
  185. data/test/spec_webrick.rb +0 -184
  186. data/test/static/another/index.html +0 -1
  187. data/test/static/index.html +0 -1
  188. data/test/testrequest.rb +0 -78
  189. data/test/unregistered_handler/rack/handler/unregistered.rb +0 -7
  190. data/test/unregistered_handler/rack/handler/unregistered_long_one.rb +0 -7
data/CONTRIBUTING.md ADDED
@@ -0,0 +1,136 @@
1
+ Contributing to Rack
2
+ =====================
3
+
4
+ Rack is work of [hundreds of contributors](https://github.com/rack/rack/graphs/contributors). You're encouraged to submit [pull requests](https://github.com/rack/rack/pulls), [propose features and discuss issues](https://github.com/rack/rack/issues). When in doubt, post to the [rack-devel](http://groups.google.com/group/rack-devel) mailing list.
5
+
6
+ #### Fork the Project
7
+
8
+ Fork the [project on Github](https://github.com/rack/rack) and check out your copy.
9
+
10
+ ```
11
+ git clone https://github.com/contributor/rack.git
12
+ cd rack
13
+ git remote add upstream https://github.com/rack/rack.git
14
+ ```
15
+
16
+ #### Create a Topic Branch
17
+
18
+ Make sure your fork is up-to-date and create a topic branch for your feature or bug fix.
19
+
20
+ ```
21
+ git checkout master
22
+ git pull upstream master
23
+ git checkout -b my-feature-branch
24
+ ```
25
+
26
+ #### Bundle Install and Quick Test
27
+
28
+ Ensure that you can build the project and run quick tests.
29
+
30
+ ```
31
+ bundle install --without extra
32
+ bundle exec rake test
33
+ ```
34
+
35
+ #### Running All Tests
36
+
37
+ Install all dependencies.
38
+
39
+ ```
40
+ bundle install
41
+ ```
42
+
43
+ Run all tests.
44
+
45
+ ```
46
+ rake test
47
+ ```
48
+
49
+ The test suite has no dependencies outside of the core Ruby installation and bacon.
50
+
51
+ Some tests will be skipped if a dependency is not found.
52
+
53
+ To run the test suite completely, you need:
54
+
55
+ * fcgi
56
+ * dalli
57
+ * thin
58
+
59
+ To test Memcache sessions, you need memcached (will be run on port 11211) and dalli installed.
60
+
61
+ #### Write Tests
62
+
63
+ Try to write a test that reproduces the problem you're trying to fix or describes a feature that you want to build.
64
+
65
+ We definitely appreciate pull requests that highlight or reproduce a problem, even without a fix.
66
+
67
+ #### Write Code
68
+
69
+ Implement your feature or bug fix.
70
+
71
+ Make sure that `bundle exec rake fulltest` completes without errors.
72
+
73
+ #### Write Documentation
74
+
75
+ Document any external behavior in the [README](README.rdoc).
76
+
77
+ #### Update Changelog
78
+
79
+ Add a line to [CHANGELOG](CHANGELOG.md).
80
+
81
+ #### Commit Changes
82
+
83
+ Make sure git knows your name and email address:
84
+
85
+ ```
86
+ git config --global user.name "Your Name"
87
+ git config --global user.email "contributor@example.com"
88
+ ```
89
+
90
+ Writing good commit logs is important. A commit log should describe what changed and why.
91
+
92
+ ```
93
+ git add ...
94
+ git commit
95
+ ```
96
+
97
+ #### Push
98
+
99
+ ```
100
+ git push origin my-feature-branch
101
+ ```
102
+
103
+ #### Make a Pull Request
104
+
105
+ Go to https://github.com/contributor/rack and select your feature branch. Click the 'Pull Request' button and fill out the form. Pull requests are usually reviewed within a few days.
106
+
107
+ #### Rebase
108
+
109
+ If you've been working on a change for a while, rebase with upstream/master.
110
+
111
+ ```
112
+ git fetch upstream
113
+ git rebase upstream/master
114
+ git push origin my-feature-branch -f
115
+ ```
116
+
117
+ #### Make Required Changes
118
+
119
+ Amend your previous commit and force push the changes.
120
+
121
+ ```
122
+ git commit --amend
123
+ git push origin my-feature-branch -f
124
+ ```
125
+
126
+ #### Check on Your Pull Request
127
+
128
+ Go back to your pull request after a few minutes and see whether it passed muster with Travis-CI. Everything should look green, otherwise fix issues and amend your commit as described above.
129
+
130
+ #### Be Patient
131
+
132
+ It's likely that your change will not be merged and that the nitpicky maintainers will ask you to do more, or fix seemingly benign problems. Hang on there!
133
+
134
+ #### Thank You
135
+
136
+ Please do know that we really appreciate and value your time and work. We love you, really.
@@ -1,4 +1,6 @@
1
- Copyright (c) 2007-2015 Christian Neukirchen <purl.org/net/chneukirchen>
1
+ The MIT License (MIT)
2
+
3
+ Copyright (C) 2007-2019 Leah Neukirchen <http://leahneukirchen.org/infopage.html>
2
4
 
3
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
4
6
  of this software and associated documentation files (the "Software"), to
@@ -13,6 +15,6 @@ all copies or substantial portions of the Software.
13
15
  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
16
  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
17
  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
16
- THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
18
+ THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
17
19
  IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
18
20
  CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.rdoc CHANGED
@@ -1,110 +1,145 @@
1
- = Rack, a modular Ruby webserver interface {<img src="https://secure.travis-ci.org/rack/rack.svg" alt="Build Status" />}[http://travis-ci.org/rack/rack] {<img src="https://gemnasium.com/rack/rack.svg" alt="Dependency Status" />}[https://gemnasium.com/rack/rack]
1
+ = \Rack, a modular Ruby webserver interface
2
2
 
3
- Rack provides a minimal, modular and adaptable interface for developing
4
- web applications in Ruby. By wrapping HTTP requests and responses in
3
+ {<img src="https://rack.github.io/logo.png" width="400" alt="rack powers web applications" />}[https://rack.github.io/]
4
+
5
+ {<img src="https://circleci.com/gh/rack/rack.svg?style=svg" alt="CircleCI" />}[https://circleci.com/gh/rack/rack]
6
+ {<img src="https://badge.fury.io/rb/rack.svg" alt="Gem Version" />}[http://badge.fury.io/rb/rack]
7
+ {<img src="https://api.dependabot.com/badges/compatibility_score?dependency-name=rack&package-manager=bundler&version-scheme=semver" alt="SemVer Stability" />}[https://dependabot.com/compatibility-score.html?dependency-name=rack&package-manager=bundler&version-scheme=semver]
8
+ {<img src="http://inch-ci.org/github/rack/rack.svg?branch=master" alt="Inline docs" />}[http://inch-ci.org/github/rack/rack]
9
+
10
+ \Rack provides a minimal, modular, and adaptable interface for developing
11
+ web applications in Ruby. By wrapping HTTP requests and responses in
5
12
  the simplest way possible, it unifies and distills the API for web
6
13
  servers, web frameworks, and software in between (the so-called
7
14
  middleware) into a single method call.
8
15
 
9
- The exact details of this are described in the Rack specification,
10
- which all Rack applications should conform to.
16
+ The exact details of this are described in the \Rack specification,
17
+ which all \Rack applications should conform to.
11
18
 
12
19
  == Supported web servers
13
20
 
14
- The included *handlers* connect all kinds of web servers to Rack:
15
- * Mongrel
16
- * EventedMongrel
17
- * SwiftipliedMongrel
18
- * WEBrick
21
+ The included *handlers* connect all kinds of web servers to \Rack:
22
+
23
+ * WEBrick[https://github.com/ruby/webrick]
19
24
  * FCGI
20
25
  * CGI
21
26
  * SCGI
22
- * LiteSpeed
23
- * Thin
24
-
25
- These web servers include Rack handlers in their distributions:
26
- * Ebb
27
- * Fuzed
28
- * Glassfish v3
29
- * Phusion Passenger (which is mod_rack for Apache and for nginx)
30
- * Puma
31
- * Rainbows!
32
- * Reel
33
- * Unicorn
34
- * unixrack
35
- * uWSGI
36
- * yahns
37
- * Zbatery
38
-
39
- Any valid Rack app will run the same on all these handlers, without
27
+ * LiteSpeed[https://www.litespeedtech.com/]
28
+ * Thin[https://rubygems.org/gems/thin]
29
+
30
+ These web servers include \Rack handlers in their distributions:
31
+
32
+ * Agoo[https://github.com/ohler55/agoo]
33
+ * Falcon[https://github.com/socketry/falcon]
34
+ * Iodine[https://github.com/boazsegev/iodine]
35
+ * {NGINX Unit}[https://unit.nginx.org/]
36
+ * {Phusion Passenger}[https://www.phusionpassenger.com/] (which is mod_rack for Apache and for nginx)
37
+ * Puma[https://puma.io/]
38
+ * Unicorn[https://yhbt.net/unicorn/]
39
+ * uWSGI[https://uwsgi-docs.readthedocs.io/en/latest/]
40
+
41
+ Any valid \Rack app will run the same on all these handlers, without
40
42
  changing anything.
41
43
 
42
44
  == Supported web frameworks
43
45
 
44
- These frameworks include Rack adapters in their distributions:
45
- * Camping
46
- * Coset
47
- * Espresso
48
- * Halcyon
49
- * Mack
50
- * Maveric
51
- * Merb
52
- * Racktools::SimpleApplication
53
- * Ramaze
54
- * Ruby on Rails
55
- * Rum
56
- * Sinatra
57
- * Sin
58
- * Vintage
59
- * Waves
60
- * Wee
61
- * ... and many others.
62
-
63
- == Available middleware
64
-
65
- Between the server and the framework, Rack can be customized to your
66
- applications needs using middleware, for example:
67
- * Rack::URLMap, to route to multiple applications inside the same process.
46
+ These frameworks and many others support the \Rack API:
47
+
48
+ * Camping[http://www.ruby-camping.com/]
49
+ * Coset[http://leahneukirchen.org/repos/coset/]
50
+ * Hanami[https://hanamirb.org/]
51
+ * Padrino[http://padrinorb.com/]
52
+ * Ramaze[http://ramaze.net/]
53
+ * Roda[https://github.com/jeremyevans/roda]
54
+ * {Ruby on Rails}[https://rubyonrails.org/]
55
+ * Rum[https://github.com/leahneukirchen/rum]
56
+ * Sinatra[http://sinatrarb.com/]
57
+ * Utopia[https://github.com/socketry/utopia]
58
+ * WABuR[https://github.com/ohler55/wabur]
59
+
60
+ == Available middleware shipped with \Rack
61
+
62
+ Between the server and the framework, \Rack can be customized to your
63
+ applications needs using middleware. \Rack itself ships with the following
64
+ middleware:
65
+
66
+ * Rack::Chunked, for streaming responses using chunked encoding.
68
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.
69
91
  * Rack::ShowException, for catching unhandled exceptions and
70
92
  presenting them in a nice and helpful way with clickable backtrace.
71
- * Rack::File, for serving static files.
72
- * ...many others!
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.
73
98
 
74
99
  All these components use the same interface, which is described in
75
- detail in the Rack specification. These optional components can be
100
+ detail in the \Rack specification. These optional components can be
76
101
  used in any way you wish.
77
102
 
78
103
  == Convenience
79
104
 
80
105
  If you want to develop outside of existing frameworks, implement your
81
- own ones, or develop middleware, Rack provides many helpers to create
82
- Rack applications quickly and without doing the same web stuff all
106
+ own ones, or develop middleware, \Rack provides many helpers to create
107
+ \Rack applications quickly and without doing the same web stuff all
83
108
  over:
109
+
84
110
  * Rack::Request, which also provides query string parsing and
85
111
  multipart handling.
86
112
  * Rack::Response, for convenient generation of HTTP replies and
87
113
  cookie handling.
88
114
  * Rack::MockRequest and Rack::MockResponse for efficient and quick
89
- testing of Rack application without real HTTP round-trips.
115
+ testing of \Rack application without real HTTP round-trips.
116
+ * Rack::Cascade, for trying additional \Rack applications if an
117
+ application returns a not found or method not supported response.
118
+ * Rack::Directory, for serving files under a given directory, with
119
+ directory indexes.
120
+ * Rack::MediaType, for parsing Content-Type headers.
121
+ * Rack::Mime, for determining Content-Type based on file extension.
122
+ * Rack::RewindableInput, for making any IO object rewindable, using
123
+ a temporary file buffer.
124
+ * Rack::URLMap, to route to multiple applications inside the same process.
90
125
 
91
126
  == rack-contrib
92
127
 
93
128
  The plethora of useful middleware created the need for a project that
94
- collects fresh Rack middleware. rack-contrib includes a variety of
95
- add-on components for Rack and it is easy to contribute new modules.
129
+ collects fresh \Rack middleware. rack-contrib includes a variety of
130
+ add-on components for \Rack and it is easy to contribute new modules.
96
131
 
97
132
  * https://github.com/rack/rack-contrib
98
133
 
99
134
  == rackup
100
135
 
101
- rackup is a useful tool for running Rack applications, which uses the
136
+ rackup is a useful tool for running \Rack applications, which uses the
102
137
  Rack::Builder DSL to configure middleware and build up applications
103
138
  easily.
104
139
 
105
140
  rackup automatically figures out the environment it is run in, and
106
- runs your application as FastCGI, CGI, or standalone with Mongrel or
107
- WEBrick---all from the same configuration.
141
+ runs your application as FastCGI, CGI, or WEBrick---all from the
142
+ same configuration.
108
143
 
109
144
  == Quick start
110
145
 
@@ -122,79 +157,50 @@ By default, the lobster is found at http://localhost:9292.
122
157
 
123
158
  == Installing with RubyGems
124
159
 
125
- A Gem of Rack is available at rubygems.org. You can install it with:
160
+ A Gem of \Rack is available at {rubygems.org}[https://rubygems.org/gems/rack]. You can install it with:
126
161
 
127
162
  gem install rack
128
163
 
129
- I also provide a local mirror of the gems (and development snapshots)
130
- at my site:
131
-
132
- gem install rack --source http://chneukirchen.org/releases/gems/
133
-
134
- == Running the tests
135
-
136
- Testing Rack requires the bacon testing framework:
137
-
138
- bundle install --without extra # to be able to run the fast tests
139
-
140
- Or:
141
-
142
- bundle install # this assumes that you have installed native extensions!
164
+ == Usage
143
165
 
144
- There are two rake-based test tasks:
166
+ You should require the library:
145
167
 
146
- rake test tests all the fast tests (no Handlers or Adapters)
147
- rake fulltest runs all the tests
168
+ require 'rack'
148
169
 
149
- The fast testsuite has no dependencies outside of the core Ruby
150
- installation and bacon.
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.
151
173
 
152
- To run the test suite completely, you need:
153
-
154
- * fcgi
155
- * memcache-client
156
- * mongrel
157
- * thin
158
-
159
- The full set of tests test FCGI access with lighttpd (on port
160
- 9203) so you will need lighttpd installed as well as the FCGI
161
- libraries and the fcgi gem:
174
+ == Configuration
162
175
 
163
- Download and install lighttpd:
176
+ Several parameters can be modified on Rack::Utils to configure \Rack behaviour.
164
177
 
165
- http://www.lighttpd.net/download
178
+ e.g:
166
179
 
167
- Installing the FCGI libraries:
180
+ Rack::Utils.key_space_limit = 128
168
181
 
169
- curl -O http://www.fastcgi.com/dist/fcgi-2.4.0.tar.gz
170
- tar xzvf fcgi-2.4.0.tar.gz
171
- cd fcgi-2.4.0
172
- ./configure --prefix=/usr/local
173
- make
174
- sudo make install
175
- cd ..
182
+ === key_space_limit
176
183
 
177
- Installing the Ruby fcgi gem:
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.
178
187
 
179
- gem install fcgi
188
+ Defaults to 65536 characters.
180
189
 
181
- Furthermore, to test Memcache sessions, you need memcached (will be
182
- run on port 11211) and memcache-client installed.
190
+ === param_depth_limit
183
191
 
184
- == Configuration
192
+ The maximum amount of nesting allowed in parameters.
193
+ For example, if set to 3, this query string would be allowed:
185
194
 
186
- Several parameters can be modified on Rack::Utils to configure Rack behaviour.
195
+ ?a[b][c]=d
187
196
 
188
- e.g:
197
+ but this query string would not be allowed:
189
198
 
190
- Rack::Utils.key_space_limit = 128
199
+ ?a[b][c][d]=e
191
200
 
192
- === key_space_limit
201
+ Limiting the depth prevents a possible stack overflow when parsing parameters.
193
202
 
194
- The default number of bytes to allow a single parameter key to take up.
195
- This helps prevent a rogue client from flooding a Request.
196
-
197
- Default to 65536 characters (4 kiB in worst case).
203
+ Defaults to 100.
198
204
 
199
205
  === multipart_part_limit
200
206
 
@@ -205,49 +211,58 @@ The default is 128, which means that a single request can't upload more than 128
205
211
 
206
212
  Set to 0 for no limit.
207
213
 
208
- Can also be set via the RACK_MULTIPART_PART_LIMIT environment variable.
214
+ Can also be set via the +RACK_MULTIPART_PART_LIMIT+ environment variable.
215
+
216
+ == Changelog
217
+
218
+ See {CHANGELOG.md}[https://github.com/rack/rack/blob/master/CHANGELOG.md].
209
219
 
210
- == History
220
+ == Contributing
211
221
 
212
- See <https://github.com/rack/HISTORY.md>.
222
+ See {CONTRIBUTING.md}[https://github.com/rack/rack/blob/master/CONTRIBUTING.md].
213
223
 
214
224
  == Contact
215
225
 
216
226
  Please post bugs, suggestions and patches to
217
- the bug tracker at <https://github.com/rack/rack/issues>.
227
+ the bug tracker at {issues}[https://github.com/rack/rack/issues].
218
228
 
219
229
  Please post security related bugs and suggestions to the core team at
220
- <https://groups.google.com/group/rack-core> or rack-core@googlegroups.com. This
230
+ <https://groups.google.com/forum/#!forum/rack-core> or rack-core@googlegroups.com. This
221
231
  list is not public. Due to wide usage of the library, it is strongly preferred
222
232
  that we manage timing in order to provide viable patches at the time of
223
233
  disclosure. Your assistance in this matter is greatly appreciated.
224
234
 
225
235
  Mailing list archives are available at
226
- <https://groups.google.com/group/rack-devel>.
236
+ <https://groups.google.com/forum/#!forum/rack-devel>.
227
237
 
228
238
  Git repository (send Git patches to the mailing list):
239
+
229
240
  * https://github.com/rack/rack
230
- * http://git.vuxu.org/cgi-bin/gitweb.cgi?p=rack-github.git
231
241
 
232
242
  You are also welcome to join the #rack channel on irc.freenode.net.
233
243
 
234
244
  == Thanks
235
245
 
236
- The Rack Core Team, consisting of
246
+ The \Rack Core Team, consisting of
237
247
 
238
- * Christian Neukirchen (chneukirchen)
239
- * James Tucker (raggi)
240
- * Josh Peek (josh)
241
- * José Valim (josevalim)
242
- * Michael Fellinger (manveru)
243
- * Aaron Patterson (tenderlove)
244
- * Santiago Pastorino (spastorino)
245
- * Konstantin Haase (rkh)
248
+ * Aaron Patterson (tenderlove[https://github.com/tenderlove])
249
+ * Samuel Williams (ioquatix[https://github.com/ioquatix])
250
+ * Jeremy Evans (jeremyevans[https://github.com/jeremyevans])
251
+ * Eileen Uchitelle (eileencodes[https://github.com/eileencodes])
252
+ * Matthew Draper (matthewd[https://github.com/matthewd])
253
+ * Rafael França (rafaelfranca[https://github.com/rafaelfranca])
246
254
 
247
- and the Rack Alumnis
255
+ and the \Rack Alumni
248
256
 
249
- * Ryan Tomayko (rtomayko)
250
- * Scytrin dai Kinthra (scytrin)
257
+ * Ryan Tomayko (rtomayko[https://github.com/rtomayko])
258
+ * Scytrin dai Kinthra (scytrin[https://github.com/scytrin])
259
+ * Leah Neukirchen (leahneukirchen[https://github.com/leahneukirchen])
260
+ * James Tucker (raggi[https://github.com/raggi])
261
+ * Josh Peek (josh[https://github.com/josh])
262
+ * José Valim (josevalim[https://github.com/josevalim])
263
+ * Michael Fellinger (manveru[https://github.com/manveru])
264
+ * Santiago Pastorino (spastorino[https://github.com/spastorino])
265
+ * Konstantin Haase (rkh[https://github.com/rkh])
251
266
 
252
267
  would like to thank:
253
268
 
@@ -276,37 +291,16 @@ would like to thank:
276
291
  * Alexander Kellett for testing the Gem and reviewing the announcement.
277
292
  * Marcus Rückert, for help with configuring and debugging lighttpd.
278
293
  * The WSGI team for the well-done and documented work they've done and
279
- Rack builds up on.
294
+ \Rack builds up on.
280
295
  * All bug reporters and patch contributors not mentioned above.
281
296
 
282
- == Copyright
283
-
284
- Copyright (C) 2007, 2008, 2009, 2010 Christian Neukirchen <http://purl.org/net/chneukirchen>
285
-
286
- Permission is hereby granted, free of charge, to any person obtaining a copy
287
- of this software and associated documentation files (the "Software"), to
288
- deal in the Software without restriction, including without limitation the
289
- rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
290
- sell copies of the Software, and to permit persons to whom the Software is
291
- furnished to do so, subject to the following conditions:
292
-
293
- The above copyright notice and this permission notice shall be included in
294
- all copies or substantial portions of the Software.
295
-
296
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
297
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
298
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
299
- THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
300
- IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
301
- CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
302
-
303
297
  == Links
304
298
 
305
- Rack:: <http://rack.github.io/>
306
- Official Rack repositories:: <https://github.com/rack>
307
- Rack Bug Tracking:: <https://github.com/rack/rack/issues>
308
- rack-devel mailing list:: <https://groups.google.com/group/rack-devel>
309
- Rack's Rubyforge project:: <http://rubyforge.org/projects/rack>
299
+ \Rack:: <https://rack.github.io/>
300
+ Official \Rack repositories:: <https://github.com/rack>
301
+ \Rack Bug Tracking:: <https://github.com/rack/rack/issues>
302
+ rack-devel mailing list:: <https://groups.google.com/forum/#!forum/rack-devel>
310
303
 
311
- Christian Neukirchen:: <http://chneukirchen.org/>
304
+ == License
312
305
 
306
+ \Rack is released under the {MIT License}[https://opensource.org/licenses/MIT].