rails-rfc6570 3.3.0 → 3.5.0

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 (140) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +25 -0
  3. data/README.md +3 -1
  4. data/lib/rails/rfc6570/formatter.rb +9 -12
  5. data/lib/rails/rfc6570/patches.rb +1 -1
  6. data/lib/rails/rfc6570/version.rb +1 -1
  7. data/lib/rails/rfc6570.rb +10 -29
  8. data/spec/dummy/config/application.rb +5 -1
  9. data/spec/dummy/config/environments/test.rb +1 -1
  10. data/spec/rails/rfc6570/extensions/route_set_spec.rb +29 -0
  11. data/spec/rails/rfc6570/helper_spec.rb +44 -0
  12. data/spec/rails/rfc6570/visitor_spec.rb +12 -0
  13. data/spec/rails/rfc6570_spec.rb +49 -1
  14. data/spec/spec_helper.rb +6 -0
  15. data/vendor/bundle/ruby/3.4.0/bundler/gems/rubocop-config-3bcd2110ca87/LICENSE +21 -0
  16. data/vendor/bundle/ruby/3.4.0/bundler/gems/rubocop-config-3bcd2110ca87/README.md +23 -0
  17. data/vendor/bundle/ruby/3.4.0/bundler/gems/rubocop-config-3bcd2110ca87/rubocop-config.gemspec +31 -0
  18. data/vendor/bundle/ruby/3.4.0/gems/actionpack-8.0.3/CHANGELOG.md +285 -0
  19. data/vendor/bundle/ruby/3.4.0/gems/actionpack-8.0.3/MIT-LICENSE +21 -0
  20. data/vendor/bundle/ruby/3.4.0/gems/actionpack-8.0.3/README.rdoc +57 -0
  21. data/vendor/bundle/ruby/3.4.0/gems/actionview-8.0.3/CHANGELOG.md +129 -0
  22. data/vendor/bundle/ruby/3.4.0/gems/actionview-8.0.3/MIT-LICENSE +21 -0
  23. data/vendor/bundle/ruby/3.4.0/gems/actionview-8.0.3/README.rdoc +40 -0
  24. data/vendor/bundle/ruby/3.4.0/gems/activesupport-8.0.3/CHANGELOG.md +309 -0
  25. data/vendor/bundle/ruby/3.4.0/gems/activesupport-8.0.3/MIT-LICENSE +20 -0
  26. data/vendor/bundle/ruby/3.4.0/gems/activesupport-8.0.3/README.rdoc +40 -0
  27. data/vendor/bundle/ruby/3.4.0/gems/addressable-2.8.7/CHANGELOG.md +301 -0
  28. data/vendor/bundle/ruby/3.4.0/gems/addressable-2.8.7/LICENSE.txt +202 -0
  29. data/vendor/bundle/ruby/3.4.0/gems/addressable-2.8.7/README.md +121 -0
  30. data/vendor/bundle/ruby/3.4.0/gems/addressable-2.8.7/addressable.gemspec +28 -0
  31. data/vendor/bundle/ruby/3.4.0/gems/base64-0.3.0/README.md +48 -0
  32. data/vendor/bundle/ruby/3.4.0/gems/benchmark-0.4.1/README.md +138 -0
  33. data/vendor/bundle/ruby/3.4.0/gems/benchmark-0.4.1/benchmark.gemspec +32 -0
  34. data/vendor/bundle/ruby/3.4.0/gems/bigdecimal-3.2.3/LICENSE +56 -0
  35. data/vendor/bundle/ruby/3.4.0/gems/bigdecimal-3.2.3/bigdecimal.gemspec +57 -0
  36. data/vendor/bundle/ruby/3.4.0/gems/builder-3.3.0/MIT-LICENSE +20 -0
  37. data/vendor/bundle/ruby/3.4.0/gems/builder-3.3.0/README.md +258 -0
  38. data/vendor/bundle/ruby/3.4.0/gems/builder-3.3.0/builder.gemspec +49 -0
  39. data/vendor/bundle/ruby/3.4.0/gems/concurrent-ruby-1.3.5/CHANGELOG.md +603 -0
  40. data/vendor/bundle/ruby/3.4.0/gems/concurrent-ruby-1.3.5/LICENSE.txt +21 -0
  41. data/vendor/bundle/ruby/3.4.0/gems/concurrent-ruby-1.3.5/README.md +407 -0
  42. data/vendor/bundle/ruby/3.4.0/gems/connection_pool-2.5.4/LICENSE +20 -0
  43. data/vendor/bundle/ruby/3.4.0/gems/connection_pool-2.5.4/README.md +188 -0
  44. data/vendor/bundle/ruby/3.4.0/gems/connection_pool-2.5.4/connection_pool.gemspec +24 -0
  45. data/vendor/bundle/ruby/3.4.0/gems/crass-1.0.6/LICENSE +18 -0
  46. data/vendor/bundle/ruby/3.4.0/gems/crass-1.0.6/README.md +192 -0
  47. data/vendor/bundle/ruby/3.4.0/gems/crass-1.0.6/crass.gemspec +31 -0
  48. data/vendor/bundle/ruby/3.4.0/gems/diff-lcs-1.6.2/CHANGELOG.md +518 -0
  49. data/vendor/bundle/ruby/3.4.0/gems/diff-lcs-1.6.2/README.md +92 -0
  50. data/vendor/bundle/ruby/3.4.0/gems/drb-2.2.3/LICENSE.txt +22 -0
  51. data/vendor/bundle/ruby/3.4.0/gems/drb-2.2.3/drb.gemspec +42 -0
  52. data/vendor/bundle/ruby/3.4.0/gems/erubi-1.13.1/CHANGELOG +111 -0
  53. data/vendor/bundle/ruby/3.4.0/gems/erubi-1.13.1/MIT-LICENSE +21 -0
  54. data/vendor/bundle/ruby/3.4.0/gems/erubi-1.13.1/README.rdoc +151 -0
  55. data/vendor/bundle/ruby/3.4.0/gems/i18n-1.14.7/MIT-LICENSE +20 -0
  56. data/vendor/bundle/ruby/3.4.0/gems/i18n-1.14.7/README.md +127 -0
  57. data/vendor/bundle/ruby/3.4.0/gems/logger-1.7.0/README.md +104 -0
  58. data/vendor/bundle/ruby/3.4.0/gems/loofah-2.24.1/CHANGELOG.md +598 -0
  59. data/vendor/bundle/ruby/3.4.0/gems/loofah-2.24.1/MIT-LICENSE.txt +23 -0
  60. data/vendor/bundle/ruby/3.4.0/gems/loofah-2.24.1/README.md +410 -0
  61. data/vendor/bundle/ruby/3.4.0/gems/minitest-5.25.5/README.rdoc +842 -0
  62. data/vendor/bundle/ruby/3.4.0/gems/nokogiri-1.18.10-x86_64-linux-gnu/LICENSE-DEPENDENCIES.md +2224 -0
  63. data/vendor/bundle/ruby/3.4.0/gems/nokogiri-1.18.10-x86_64-linux-gnu/LICENSE.md +9 -0
  64. data/vendor/bundle/ruby/3.4.0/gems/nokogiri-1.18.10-x86_64-linux-gnu/README.md +293 -0
  65. data/vendor/bundle/ruby/3.4.0/gems/public_suffix-6.0.2/CHANGELOG.md +498 -0
  66. data/vendor/bundle/ruby/3.4.0/gems/public_suffix-6.0.2/LICENSE.txt +22 -0
  67. data/vendor/bundle/ruby/3.4.0/gems/public_suffix-6.0.2/README.md +222 -0
  68. data/vendor/bundle/ruby/3.4.0/gems/racc-1.8.1/README.ja.rdoc +58 -0
  69. data/vendor/bundle/ruby/3.4.0/gems/racc-1.8.1/README.rdoc +60 -0
  70. data/vendor/bundle/ruby/3.4.0/gems/rack-3.2.1/CHANGELOG.md +1236 -0
  71. data/vendor/bundle/ruby/3.4.0/gems/rack-3.2.1/MIT-LICENSE +20 -0
  72. data/vendor/bundle/ruby/3.4.0/gems/rack-3.2.1/README.md +376 -0
  73. data/vendor/bundle/ruby/3.4.0/gems/rack-test-2.2.0/MIT-LICENSE.txt +20 -0
  74. data/vendor/bundle/ruby/3.4.0/gems/rack-test-2.2.0/README.md +139 -0
  75. data/vendor/bundle/ruby/3.4.0/gems/rails-dom-testing-2.3.0/MIT-LICENSE +23 -0
  76. data/vendor/bundle/ruby/3.4.0/gems/rails-dom-testing-2.3.0/README.md +94 -0
  77. data/vendor/bundle/ruby/3.4.0/gems/rails-html-sanitizer-1.6.2/CHANGELOG.md +255 -0
  78. data/vendor/bundle/ruby/3.4.0/gems/rails-html-sanitizer-1.6.2/MIT-LICENSE +23 -0
  79. data/vendor/bundle/ruby/3.4.0/gems/rails-html-sanitizer-1.6.2/README.md +267 -0
  80. data/vendor/bundle/ruby/3.4.0/gems/rake-13.3.0/MIT-LICENSE +21 -0
  81. data/vendor/bundle/ruby/3.4.0/gems/rake-13.3.0/README.rdoc +155 -0
  82. data/vendor/bundle/ruby/3.4.0/gems/rake-13.3.0/rake.gemspec +101 -0
  83. data/vendor/bundle/ruby/3.4.0/gems/rake-release-1.3.0/LICENSE +21 -0
  84. data/vendor/bundle/ruby/3.4.0/gems/rake-release-1.3.0/README.md +107 -0
  85. data/vendor/bundle/ruby/3.4.0/gems/rake-release-1.3.0/rake-release.gemspec +23 -0
  86. data/vendor/bundle/ruby/3.4.0/gems/rspec-3.13.1/LICENSE.md +27 -0
  87. data/vendor/bundle/ruby/3.4.0/gems/rspec-3.13.1/README.md +47 -0
  88. data/vendor/bundle/ruby/3.4.0/gems/rspec-core-3.13.5/LICENSE.md +26 -0
  89. data/vendor/bundle/ruby/3.4.0/gems/rspec-core-3.13.5/README.md +389 -0
  90. data/vendor/bundle/ruby/3.4.0/gems/rspec-expectations-3.13.5/LICENSE.md +25 -0
  91. data/vendor/bundle/ruby/3.4.0/gems/rspec-expectations-3.13.5/README.md +326 -0
  92. data/vendor/bundle/ruby/3.4.0/gems/rspec-mocks-3.13.5/LICENSE.md +25 -0
  93. data/vendor/bundle/ruby/3.4.0/gems/rspec-mocks-3.13.5/README.md +465 -0
  94. data/vendor/bundle/ruby/3.4.0/gems/rspec-support-3.13.6/LICENSE.md +23 -0
  95. data/vendor/bundle/ruby/3.4.0/gems/rspec-support-3.13.6/README.md +40 -0
  96. data/vendor/bundle/ruby/3.4.0/gems/securerandom-0.4.1/README.md +72 -0
  97. data/vendor/bundle/ruby/3.4.0/gems/tzinfo-2.0.6/LICENSE +19 -0
  98. data/vendor/bundle/ruby/3.4.0/gems/tzinfo-2.0.6/README.md +406 -0
  99. data/vendor/bundle/ruby/3.4.0/gems/uri-1.0.3/README.md +55 -0
  100. data/vendor/bundle/ruby/3.4.0/gems/useragent-0.16.11/LICENSE +20 -0
  101. data/vendor/bundle/ruby/3.4.0/gems/useragent-0.16.11/README.md +42 -0
  102. data/vendor/bundle/ruby/3.4.0/specifications/actionpack-8.0.3.gemspec +36 -0
  103. data/vendor/bundle/ruby/3.4.0/specifications/actionview-8.0.3.gemspec +33 -0
  104. data/vendor/bundle/ruby/3.4.0/specifications/activesupport-8.0.3.gemspec +38 -0
  105. data/vendor/bundle/ruby/3.4.0/specifications/addressable-2.8.7.gemspec +30 -0
  106. data/vendor/bundle/ruby/3.4.0/specifications/base64-0.3.0.gemspec +23 -0
  107. data/vendor/bundle/ruby/3.4.0/specifications/benchmark-0.4.1.gemspec +23 -0
  108. data/vendor/bundle/ruby/3.4.0/specifications/bigdecimal-3.2.3.gemspec +25 -0
  109. data/vendor/bundle/ruby/3.4.0/specifications/builder-3.3.0.gemspec +22 -0
  110. data/vendor/bundle/ruby/3.4.0/specifications/concurrent-ruby-1.3.5.gemspec +24 -0
  111. data/vendor/bundle/ruby/3.4.0/specifications/connection_pool-2.5.4.gemspec +28 -0
  112. data/vendor/bundle/ruby/3.4.0/specifications/crass-1.0.6.gemspec +27 -0
  113. data/vendor/bundle/ruby/3.4.0/specifications/diff-lcs-1.6.2.gemspec +35 -0
  114. data/vendor/bundle/ruby/3.4.0/specifications/drb-2.2.3.gemspec +22 -0
  115. data/vendor/bundle/ruby/3.4.0/specifications/erubi-1.13.1.gemspec +29 -0
  116. data/vendor/bundle/ruby/3.4.0/specifications/i18n-1.14.7.gemspec +26 -0
  117. data/vendor/bundle/ruby/3.4.0/specifications/logger-1.7.0.gemspec +22 -0
  118. data/vendor/bundle/ruby/3.4.0/specifications/loofah-2.24.1.gemspec +27 -0
  119. data/vendor/bundle/ruby/3.4.0/specifications/minitest-5.25.5.gemspec +31 -0
  120. data/vendor/bundle/ruby/3.4.0/specifications/nokogiri-1.18.10-x86_64-linux-gnu.gemspec +31 -0
  121. data/vendor/bundle/ruby/3.4.0/specifications/public_suffix-6.0.2.gemspec +24 -0
  122. data/vendor/bundle/ruby/3.4.0/specifications/racc-1.8.1.gemspec +28 -0
  123. data/vendor/bundle/ruby/3.4.0/specifications/rack-3.2.1.gemspec +31 -0
  124. data/vendor/bundle/ruby/3.4.0/specifications/rack-session-2.1.1.gemspec +30 -0
  125. data/vendor/bundle/ruby/3.4.0/specifications/rack-test-2.2.0.gemspec +29 -0
  126. data/vendor/bundle/ruby/3.4.0/specifications/rails-dom-testing-2.3.0.gemspec +28 -0
  127. data/vendor/bundle/ruby/3.4.0/specifications/rails-html-sanitizer-1.6.2.gemspec +27 -0
  128. data/vendor/bundle/ruby/3.4.0/specifications/rake-13.3.0.gemspec +26 -0
  129. data/vendor/bundle/ruby/3.4.0/specifications/rake-release-1.3.0.gemspec +26 -0
  130. data/vendor/bundle/ruby/3.4.0/specifications/rspec-3.13.1.gemspec +31 -0
  131. data/vendor/bundle/ruby/3.4.0/specifications/rspec-core-3.13.5.gemspec +31 -0
  132. data/vendor/bundle/ruby/3.4.0/specifications/rspec-expectations-3.13.5.gemspec +29 -0
  133. data/vendor/bundle/ruby/3.4.0/specifications/rspec-mocks-3.13.5.gemspec +29 -0
  134. data/vendor/bundle/ruby/3.4.0/specifications/rspec-support-3.13.6.gemspec +29 -0
  135. data/vendor/bundle/ruby/3.4.0/specifications/securerandom-0.4.1.gemspec +23 -0
  136. data/vendor/bundle/ruby/3.4.0/specifications/tzinfo-2.0.6.gemspec +30 -0
  137. data/vendor/bundle/ruby/3.4.0/specifications/uri-1.0.3.gemspec +23 -0
  138. data/vendor/bundle/ruby/3.4.0/specifications/useragent-0.16.11.gemspec +25 -0
  139. metadata +129 -8
  140. data/spec/dummy/log/test.log +0 -432
@@ -0,0 +1,20 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (C) 2007-2021 Leah Neukirchen <http://leahneukirchen.org/infopage.html>
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to
7
+ deal in the Software without restriction, including without limitation the
8
+ rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
9
+ sell copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
18
+ THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
19
+ IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
20
+ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,376 @@
1
+ # ![Rack](contrib/logo.webp)
2
+
3
+ Rack provides a minimal, modular, and adaptable interface for developing web
4
+ applications in Ruby. By wrapping HTTP requests and responses in the simplest
5
+ way possible, it unifies and distills the bridge between web servers, web
6
+ frameworks, and web application into a single method call.
7
+
8
+ The exact details of this are described in the [Rack Specification], which all
9
+ Rack applications should conform to. Browse the [Documentation] for more
10
+ information.
11
+
12
+ ## Version support
13
+
14
+ | Version | Support |
15
+ |----------|------------------------------------|
16
+ | 3.2.x | Bug fixes and security patches. |
17
+ | 3.1.x | Security patches only. |
18
+ | 3.0.x | End of support. |
19
+ | 2.2.x | Security patches only. |
20
+ | <= 2.1.x | End of support. |
21
+
22
+ **Rack 2.2.x is in security maintenance mode**. Please upgrade to Rack 3.1+ as soon
23
+ as possible to ensure you are receiving the latest features and security patches.
24
+
25
+ Please see the [Security Policy] for more information.
26
+
27
+ ## Change log
28
+
29
+ See the [Changelog](CHANGELOG.md) for a detailed list of changes in each version of Rack.
30
+
31
+ ### Rack 3.2 (latest release)
32
+
33
+ This version of rack contains bug fixes and security patches.
34
+
35
+ ### Rack 3.1
36
+
37
+ This version of rack contains bug fixes and security patches.
38
+
39
+ ### Rack 3.0
40
+
41
+ This version of rack contains significant changes which are detailed in the
42
+ [Upgrade Guide](UPGRADE-GUIDE.md). It is recommended to upgrade to Rack 3 as soon
43
+ as possible to receive the latest features and security patches.
44
+
45
+ ### Rack 2.2
46
+
47
+ This version of Rack is receiving security patches only, and effort should be
48
+ made to move to Rack 3.
49
+
50
+ Starting in Ruby 3.4 the `base64` dependency will no longer be a default gem,
51
+ and may cause a warning or error about `base64` being missing. To correct this,
52
+ add `base64` as a dependency to your project.
53
+
54
+ ## Installation
55
+
56
+ Add the rack gem to your application bundle, or follow the instructions provided
57
+ by a [supported web framework](#supported-web-frameworks):
58
+
59
+ ```bash
60
+ # Install it generally:
61
+ $ gem install rack
62
+
63
+ # or, add it to your current application gemfile:
64
+ $ bundle add rack
65
+ ```
66
+
67
+ If you need features from `Rack::Session` or `bin/rackup` please add those gems separately.
68
+
69
+ ```bash
70
+ $ gem install rack-session rackup
71
+ ```
72
+
73
+ ## Usage
74
+
75
+ Create a file called `config.ru` with the following contents:
76
+
77
+ ```ruby
78
+ run do |env|
79
+ [200, {}, ["Hello World"]]
80
+ end
81
+ ```
82
+
83
+ Run this using the rackup gem or another [supported web
84
+ server](#supported-web-servers).
85
+
86
+ ```bash
87
+ $ gem install rackup
88
+ $ rackup
89
+
90
+ # In another shell:
91
+ $ curl http://localhost:9292
92
+ Hello World
93
+ ```
94
+
95
+ ## Supported web servers
96
+
97
+ Rack is supported by a wide range of servers, including:
98
+
99
+ * [Agoo](https://github.com/ohler55/agoo)
100
+ * [Falcon](https://github.com/socketry/falcon)
101
+ * [Iodine](https://github.com/boazsegev/iodine)
102
+ * [NGINX Unit](https://unit.nginx.org/)
103
+ * [Phusion Passenger](https://www.phusionpassenger.com/) (which is mod_rack for
104
+ Apache and for nginx)
105
+ * [Pitchfork](https://github.com/Shopify/pitchfork)
106
+ * [Puma](https://puma.io/)
107
+ * [Thin](https://github.com/macournoyer/thin)
108
+ * [Unicorn](https://yhbt.net/unicorn/)
109
+ * [uWSGI](https://uwsgi-docs.readthedocs.io/en/latest/)
110
+ * [Lamby](https://lamby.custominktech.com) (for AWS Lambda)
111
+
112
+ You will need to consult the server documentation to find out what features and
113
+ limitations they may have. In general, any valid Rack app will run the same on
114
+ all these servers, without changing anything.
115
+
116
+ ### Rackup
117
+
118
+ Rack provides a separate gem, [rackup](https://github.com/rack/rackup) which is
119
+ a generic interface for running a Rack application on supported servers, which
120
+ include `WEBRick`, `Puma`, `Falcon` and others.
121
+
122
+ ## Supported web frameworks
123
+
124
+ These frameworks and many others support the [Rack Specification]:
125
+
126
+ * [Camping](https://github.com/camping/camping)
127
+ * [Hanami](https://hanamirb.org/)
128
+ * [Ramaze](https://github.com/ramaze/ramaze)
129
+ * [Padrino](https://padrinorb.com/)
130
+ * [Roda](https://github.com/jeremyevans/roda)
131
+ * [Ruby on Rails](https://rubyonrails.org/)
132
+ * [Rum](https://github.com/leahneukirchen/rum)
133
+ * [Sinatra](https://sinatrarb.com/)
134
+ * [Utopia](https://github.com/socketry/utopia)
135
+ * [WABuR](https://github.com/ohler55/wabur)
136
+
137
+ ## Available middleware shipped with Rack
138
+
139
+ Between the server and the framework, Rack can be customized to your
140
+ applications needs using middleware. Rack itself ships with the following
141
+ middleware:
142
+
143
+ * `Rack::CommonLogger` for creating Apache-style logfiles.
144
+ * `Rack::ConditionalGet` for returning [Not
145
+ Modified](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/304)
146
+ responses when the response has not changed.
147
+ * `Rack::Config` for modifying the environment before processing the request.
148
+ * `Rack::ContentLength` for setting a `content-length` header based on body
149
+ size.
150
+ * `Rack::ContentType` for setting a default `content-type` header for responses.
151
+ * `Rack::Deflater` for compressing responses with gzip.
152
+ * `Rack::ETag` for setting `etag` header on bodies that can be buffered.
153
+ * `Rack::Events` for providing easy hooks when a request is received and when
154
+ the response is sent.
155
+ * `Rack::Head` for returning an empty body for HEAD requests.
156
+ * `Rack::Lint` for checking conformance to the [Rack Specification].
157
+ * `Rack::Lock` for serializing requests using a mutex.
158
+ * `Rack::MethodOverride` for modifying the request method based on a submitted
159
+ parameter.
160
+ * `Rack::Recursive` for including data from other paths in the application, and
161
+ for performing internal redirects.
162
+ * `Rack::Reloader` for reloading files if they have been modified.
163
+ * `Rack::Runtime` for including a response header with the time taken to process
164
+ the request.
165
+ * `Rack::Sendfile` for working with web servers that can use optimized file
166
+ serving for file system paths.
167
+ * `Rack::ShowException` for catching unhandled exceptions and presenting them in
168
+ a nice and helpful way with clickable backtrace.
169
+ * `Rack::ShowStatus` for using nice error pages for empty client error
170
+ responses.
171
+ * `Rack::Static` for configurable serving of static files.
172
+ * `Rack::TempfileReaper` for removing temporary files creating during a request.
173
+
174
+ All these components use the same interface, which is described in detail in the
175
+ [Rack Specification]. These optional components can be used in any way you wish.
176
+
177
+ ### Convenience interfaces
178
+
179
+ If you want to develop outside of existing frameworks, implement your own ones,
180
+ or develop middleware, Rack provides many helpers to create Rack applications
181
+ quickly and without doing the same web stuff all over:
182
+
183
+ * `Rack::Request` which also provides query string parsing and multipart
184
+ handling.
185
+ * `Rack::Response` for convenient generation of HTTP replies and cookie
186
+ handling.
187
+ * `Rack::MockRequest` and `Rack::MockResponse` for efficient and quick testing
188
+ of Rack application without real HTTP round-trips.
189
+ * `Rack::Cascade` for trying additional Rack applications if an application
190
+ returns a not found or method not supported response.
191
+ * `Rack::Directory` for serving files under a given directory, with directory
192
+ indexes.
193
+ * `Rack::Files` for serving files under a given directory, without directory
194
+ indexes.
195
+ * `Rack::MediaType` for parsing content-type headers.
196
+ * `Rack::Mime` for determining content-type based on file extension.
197
+ * `Rack::RewindableInput` for making any IO object rewindable, using a temporary
198
+ file buffer.
199
+ * `Rack::URLMap` to route to multiple applications inside the same process.
200
+
201
+ ## Configuration
202
+
203
+ Rack exposes several configuration parameters to control various features of the
204
+ implementation.
205
+
206
+ ### `RACK_QUERY_PARSER_BYTESIZE_LIMIT`
207
+
208
+ This environment variable sets the default for the maximum query string bytesize
209
+ that `Rack::QueryParser` will attempt to parse. Attempts to use a query string
210
+ that exceeds this number of bytes will result in a
211
+ `Rack::QueryParser::QueryLimitError` exception. If this enviroment variable is
212
+ provided, it must be an integer, or `Rack::QueryParser` will raise an exception.
213
+
214
+ The default limit can be overridden on a per-`Rack::QueryParser` basis using
215
+ the `bytesize_limit` keyword argument when creating the `Rack::QueryParser`.
216
+
217
+ ### `RACK_QUERY_PARSER_PARAMS_LIMIT`
218
+
219
+ This environment variable sets the default for the maximum number of query
220
+ parameters that `Rack::QueryParser` will attempt to parse. Attempts to use a
221
+ query string with more than this many query parameters will result in a
222
+ `Rack::QueryParser::QueryLimitError` exception. If this enviroment variable is
223
+ provided, it must be an integer, or `Rack::QueryParser` will raise an exception.
224
+
225
+ The default limit can be overridden on a per-`Rack::QueryParser` basis using
226
+ the `params_limit` keyword argument when creating the `Rack::QueryParser`.
227
+
228
+ This is implemented by counting the number of parameter separators in the
229
+ query string, before attempting parsing, so if the same parameter key is
230
+ used multiple times in the query, each counts as a separate parameter for
231
+ this check.
232
+
233
+ ### `param_depth_limit`
234
+
235
+ ```ruby
236
+ Rack::Utils.param_depth_limit = 32 # default
237
+ ```
238
+
239
+ The maximum amount of nesting allowed in parameters. For example, if set to 3,
240
+ this query string would be allowed:
241
+
242
+ ```
243
+ ?a[b][c]=d
244
+ ```
245
+
246
+ but this query string would not be allowed:
247
+
248
+ ```
249
+ ?a[b][c][d]=e
250
+ ```
251
+
252
+ Limiting the depth prevents a possible stack overflow when parsing parameters.
253
+
254
+ ### `multipart_file_limit`
255
+
256
+ ```ruby
257
+ Rack::Utils.multipart_file_limit = 128 # default
258
+ ```
259
+
260
+ The maximum number of parts with a filename a request can contain. Accepting
261
+ too many parts can lead to the server running out of file handles.
262
+
263
+ The default is 128, which means that a single request can't upload more than 128
264
+ files at once. Set to 0 for no limit.
265
+
266
+ Can also be set via the `RACK_MULTIPART_FILE_LIMIT` environment variable.
267
+
268
+ (This is also aliased as `multipart_part_limit` and `RACK_MULTIPART_PART_LIMIT` for compatibility)
269
+
270
+ ### `multipart_total_part_limit`
271
+
272
+ The maximum total number of parts a request can contain of any type, including
273
+ both file and non-file form fields.
274
+
275
+ The default is 4096, which means that a single request can't contain more than
276
+ 4096 parts.
277
+
278
+ Set to 0 for no limit.
279
+
280
+ Can also be set via the `RACK_MULTIPART_TOTAL_PART_LIMIT` environment variable.
281
+
282
+ ## Contributing
283
+
284
+ See [CONTRIBUTING.md](CONTRIBUTING.md) for specific details about how to make a
285
+ contribution to Rack.
286
+
287
+ Please post bugs, suggestions and patches to [GitHub Issues](https://github.com/rack/rack/issues).
288
+
289
+ Please check our [Security Policy](https://github.com/rack/rack/security/policy)
290
+ for responsible disclosure and security bug reporting process. Due to wide usage
291
+ of the library, it is strongly preferred that we manage timing in order to
292
+ provide viable patches at the time of disclosure. Your assistance in this matter
293
+ is greatly appreciated.
294
+
295
+ ## See Also
296
+
297
+ ### `rackup`
298
+
299
+ A useful tool for running Rack applications from the command line, including
300
+ `Rackup::Server` (previously `Rack::Server`) for scripting servers.
301
+
302
+ * https://github.com/rack/rackup
303
+
304
+ ### `rack-contrib`
305
+
306
+ The plethora of useful middleware created the need for a project that collects
307
+ fresh Rack middleware. `rack-contrib` includes a variety of add-on components
308
+ for Rack and it is easy to contribute new modules.
309
+
310
+ * https://github.com/rack/rack-contrib
311
+
312
+ ### `rack-session`
313
+
314
+ Provides convenient session management for Rack.
315
+
316
+ * https://github.com/rack/rack-session
317
+
318
+ ## Thanks
319
+
320
+ The Rack Core Team, consisting of
321
+
322
+ * Aaron Patterson [tenderlove](https://github.com/tenderlove)
323
+ * Samuel Williams [ioquatix](https://github.com/ioquatix)
324
+ * Jeremy Evans [jeremyevans](https://github.com/jeremyevans)
325
+ * Eileen Uchitelle [eileencodes](https://github.com/eileencodes)
326
+ * Matthew Draper [matthewd](https://github.com/matthewd)
327
+ * Rafael França [rafaelfranca](https://github.com/rafaelfranca)
328
+
329
+ and the Rack Alumni
330
+
331
+ * Ryan Tomayko [rtomayko](https://github.com/rtomayko)
332
+ * Scytrin dai Kinthra [scytrin](https://github.com/scytrin)
333
+ * Leah Neukirchen [leahneukirchen](https://github.com/leahneukirchen)
334
+ * James Tucker [raggi](https://github.com/raggi)
335
+ * Josh Peek [josh](https://github.com/josh)
336
+ * José Valim [josevalim](https://github.com/josevalim)
337
+ * Michael Fellinger [manveru](https://github.com/manveru)
338
+ * Santiago Pastorino [spastorino](https://github.com/spastorino)
339
+ * Konstantin Haase [rkh](https://github.com/rkh)
340
+
341
+ would like to thank:
342
+
343
+ * Adrian Madrid, for the LiteSpeed handler.
344
+ * Christoffer Sawicki, for the first Rails adapter and `Rack::Deflater`.
345
+ * Tim Fletcher, for the HTTP authentication code.
346
+ * Luc Heinrich for the Cookie sessions, the static file handler and bugfixes.
347
+ * Armin Ronacher, for the logo and racktools.
348
+ * Alex Beregszaszi, Alexander Kahn, Anil Wadghule, Aredridel, Ben Alpert, Dan
349
+ Kubb, Daniel Roethlisberger, Matt Todd, Tom Robinson, Phil Hagelberg, S. Brent
350
+ Faulkner, Bosko Milekic, Daniel Rodríguez Troitiño, Genki Takiuchi, Geoffrey
351
+ Grosenbach, Julien Sanchez, Kamal Fariz Mahyuddin, Masayoshi Takahashi,
352
+ Patrick Aljordm, Mig, Kazuhiro Nishiyama, Jon Bardin, Konstantin Haase, Larry
353
+ Siden, Matias Korhonen, Sam Ruby, Simon Chiang, Tim Connor, Timur Batyrshin,
354
+ and Zach Brock for bug fixing and other improvements.
355
+ * Eric Wong, Hongli Lai, Jeremy Kemper for their continuous support and API
356
+ improvements.
357
+ * Yehuda Katz and Carl Lerche for refactoring rackup.
358
+ * Brian Candler, for `Rack::ContentType`.
359
+ * Graham Batty, for improved handler loading.
360
+ * Stephen Bannasch, for bug reports and documentation.
361
+ * Gary Wright, for proposing a better `Rack::Response` interface.
362
+ * Jonathan Buch, for improvements regarding `Rack::Response`.
363
+ * Armin Röhrl, for tracking down bugs in the Cookie generator.
364
+ * Alexander Kellett for testing the Gem and reviewing the announcement.
365
+ * Marcus Rückert, for help with configuring and debugging lighttpd.
366
+ * The WSGI team for the well-done and documented work they've done and Rack
367
+ builds up on.
368
+ * All bug reporters and patch contributors not mentioned above.
369
+
370
+ ## License
371
+
372
+ Rack is released under the [MIT License](MIT-LICENSE).
373
+
374
+ [Rack Specification]: https://rack.github.io/rack/main/SPEC_rdoc.html
375
+ [Documentation]: https://rack.github.io/rack/
376
+ [Security Policy]: SECURITY.md
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2008-2009 Bryan Helmkamp, Engine Yard Inc.
2
+ Copyright (c) 2022 Jeremy Evans
3
+
4
+ Permission is hereby granted, free of charge, to any person obtaining a copy
5
+ of this software and associated documentation files (the "Software"), to deal
6
+ in the Software without restriction, including without limitation the rights
7
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8
+ copies of the Software, and to permit persons to whom the Software is
9
+ furnished to do so, subject to the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be included in
12
+ all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20
+ THE SOFTWARE.
@@ -0,0 +1,139 @@
1
+ # Rack::Test
2
+ [![Gem Version](https://badge.fury.io/rb/rack-test.svg)](https://badge.fury.io/rb/rack-test)
3
+
4
+ Code: https://github.com/rack/rack-test
5
+
6
+ ## Description
7
+
8
+ Rack::Test is a small, simple testing API for Rack apps. It can be used on its
9
+ own or as a reusable starting point for Web frameworks and testing libraries
10
+ to build on.
11
+
12
+ ## Features
13
+
14
+ * Allows for submitting requests and testing responses
15
+ * Maintains a cookie jar across requests
16
+ * Supports request headers used for subsequent requests
17
+ * Follow redirects when requested
18
+
19
+ ## Examples
20
+
21
+ These examples use `test/unit` but it's equally possible to use `rack-test` with
22
+ other testing frameworks such as `minitest` or `rspec`.
23
+
24
+ ```ruby
25
+ require "test/unit"
26
+ require "rack/test"
27
+ require "json"
28
+
29
+ class HomepageTest < Test::Unit::TestCase
30
+ include Rack::Test::Methods
31
+
32
+ def app
33
+ lambda { |env| [200, {'content-type' => 'text/plain'}, ['All responses are OK']] }
34
+ end
35
+
36
+ def test_response_is_ok
37
+ # Optionally set headers used for all requests in this spec:
38
+ #header 'accept-charset', 'utf-8'
39
+
40
+ # First argument is treated as the path
41
+ get '/'
42
+
43
+ assert last_response.ok?
44
+ assert_equal 'All responses are OK', last_response.body
45
+ end
46
+
47
+ def delete_with_url_params_and_body
48
+ # First argument can have a query string
49
+ #
50
+ # Second argument is used as the parameters for the request, which will be
51
+ # included in the request body for non-GET requests.
52
+ delete '/?foo=bar', JSON.generate('baz' => 'zot')
53
+ end
54
+
55
+ def post_with_json
56
+ # Third argument is the rack environment to use for the request. The following
57
+ # entries in the submitted rack environment are treated specially (in addition
58
+ # to options supported by `Rack::MockRequest#env_for`:
59
+ #
60
+ # :cookie : Set a cookie for the current session before submitting the request.
61
+ #
62
+ # :query_params : Set parameters for the query string (as opposed to the body).
63
+ # Value should be a hash of parameters.
64
+ #
65
+ # :xhr : Set HTTP_X_REQUESTED_WITH env key to XMLHttpRequest.
66
+ post(uri, JSON.generate('baz' => 'zot'), 'CONTENT_TYPE' => 'application/json')
67
+ end
68
+ end
69
+ ```
70
+
71
+ `rack-test` will test the app returned by the `app` method. If you are loading middleware
72
+ in a `config.ru` file, and want to test that, you should load the Rack app created from
73
+ the `config.ru` file:
74
+
75
+ ```ruby
76
+ OUTER_APP = Rack::Builder.parse_file("config.ru").first
77
+
78
+ class TestApp < Test::Unit::TestCase
79
+ include Rack::Test::Methods
80
+
81
+ def app
82
+ OUTER_APP
83
+ end
84
+
85
+ def test_root
86
+ get "/"
87
+ assert last_response.ok?
88
+ end
89
+ end
90
+ ```
91
+
92
+ ## Install
93
+
94
+ To install the latest release as a gem:
95
+
96
+ ```
97
+ gem install rack-test
98
+ ```
99
+
100
+ Or add to your `Gemfile`:
101
+
102
+ ```
103
+ gem 'rack-test'
104
+ ```
105
+
106
+ ## Contribution
107
+
108
+ Contributions are welcome. Please make sure to:
109
+
110
+ * Use a regular forking workflow
111
+ * Write tests for the new or changed behaviour
112
+ * Provide an explanation/motivation in your commit message / PR message
113
+ * Ensure `History.md` is updated
114
+
115
+ ## Authors
116
+
117
+ - Contributions from Bryan Helmkamp, Jeremy Evans, Simon Rozet, and others
118
+ - Much of the original code was extracted from Merb 1.0's request helper
119
+
120
+ ## License
121
+
122
+ `rack-test` is released under the [MIT License](MIT-LICENSE.txt).
123
+
124
+ ## Supported platforms
125
+
126
+ * Ruby 2.0+
127
+ * JRuby 9.1+
128
+
129
+ ## Releasing
130
+
131
+ * Bump VERSION in lib/rack/test/version.rb
132
+ * Ensure `History.md` is up-to-date, including correct version and date
133
+ * `git commit . -m 'Release $VERSION'`
134
+ * `git push`
135
+ * `git tag -a -m 'Tag the $VERSION release' $VERSION`
136
+ * `git push --tags`
137
+ * `gem build rack-test.gemspec`
138
+ * `gem push rack-test-$VERSION.gem`
139
+ * Add a discussion post for the release
@@ -0,0 +1,23 @@
1
+ Copyright (c) 2013-2015 Kasper Timm Hansen
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
23
+
@@ -0,0 +1,94 @@
1
+ # Rails::Dom::Testing
2
+
3
+ This gem is responsible for comparing HTML doms and asserting that DOM elements are present in Rails applications.
4
+ Doms are compared via `assert_dom_equal` and `assert_dom_not_equal`.
5
+ Elements are asserted via `assert_dom`, `assert_dom_encoded`, `assert_dom_email` and a subset of the dom can be selected with `css_select`.
6
+ The gem is developed for Rails 4.2 and above, and will not work on previous versions.
7
+
8
+ ## Usage
9
+
10
+ ### Dom Assertions
11
+
12
+ ```ruby
13
+ assert_dom_equal '<h1>Lingua França</h1>', '<h1>Lingua França</h1>'
14
+
15
+ assert_dom_not_equal '<h1>Portuguese</h1>', '<h1>Danish</h1>'
16
+ ```
17
+
18
+ ### Selector Assertions
19
+
20
+ ```ruby
21
+ # implicitly selects from the document_root_element
22
+ css_select '.hello' # => Nokogiri::XML::NodeSet of elements with hello class
23
+
24
+ # select from a supplied node. assert_dom asserts elements exist.
25
+ assert_dom document_root_element.at('.hello'), '.goodbye'
26
+
27
+ # select from a supplied node. assert_not_dom asserts elements do not exist.
28
+ assert_not_dom document_root_element.at('.hello'), '.goodbye'
29
+
30
+ # elements in CDATA encoded sections can also be selected
31
+ assert_dom_encoded '#out-of-your-element'
32
+
33
+ # assert elements within an html email exists
34
+ assert_dom_email '#you-got-mail'
35
+ ```
36
+
37
+ The documentation in [selector_assertions.rb](https://github.com/rails/rails-dom-testing/blob/master/lib/rails/dom/testing/assertions/selector_assertions.rb) goes into a lot more detail of how selector assertions can be used.
38
+
39
+ ### HTML versions
40
+
41
+ By default, assertions will use Nokogiri's HTML4 parser.
42
+
43
+ If `Rails::Dom::Testing.default_html_version` is set to `:html5`, then the assertions will use
44
+ Nokogiri's HTML5 parser. (If the HTML5 parser is not available on your platform, then a
45
+ `NotImplementedError` will be raised.)
46
+
47
+ When testing in a Rails application, the parser default can also be set by setting
48
+ `Rails.application.config.dom_testing_default_html_version`.
49
+
50
+ Some assertions support an `html_version:` keyword argument which can override the default for that
51
+ assertion. For example:
52
+
53
+ ``` ruby
54
+ # compare DOMs built with the HTML5 parser
55
+ assert_dom_equal(expected, actual, html_version: :html5)
56
+
57
+ # compare DOMs built with the HTML4 parser
58
+ assert_dom_not_equal(expected, actual, html_version: :html4)
59
+ ```
60
+
61
+ Please see documentation for individual assertions for more details.
62
+
63
+ ## Installation
64
+
65
+ Add this line to your application's Gemfile:
66
+
67
+ gem 'rails-dom-testing'
68
+
69
+ And then execute:
70
+
71
+ $ bundle
72
+
73
+ Or install it yourself as:
74
+
75
+ $ gem install rails-dom-testing
76
+
77
+ ## Read more
78
+
79
+ Under the hood the doms are parsed with Nokogiri, and you'll generally be working with these two classes:
80
+ - [`Nokogiri::XML::Node`](http://www.rubydoc.info/github/sparklemotion/nokogiri/Nokogiri/XML/Node)
81
+ - [`Nokogiri::XML::NodeSet`](http://www.rubydoc.info/github/sparklemotion/nokogiri/Nokogiri/XML/NodeSet)
82
+
83
+ Read more about Nokogiri:
84
+ - [Nokogiri](http://nokogiri.org)
85
+
86
+ ## Contributing to Rails::Dom::Testing
87
+
88
+ Rails::Dom::Testing is work of many contributors. You're encouraged to submit pull requests, propose
89
+ features and discuss issues.
90
+
91
+ See [CONTRIBUTING](CONTRIBUTING.md).
92
+
93
+ ## License
94
+ Rails::Dom::Testing is released under the [MIT License](MIT-LICENSE).