rack 1.1.6 → 1.6.9

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 (212) hide show
  1. checksums.yaml +7 -0
  2. data/COPYING +1 -1
  3. data/HISTORY.md +375 -0
  4. data/KNOWN-ISSUES +23 -0
  5. data/README.rdoc +312 -0
  6. data/Rakefile +124 -0
  7. data/SPEC +125 -32
  8. data/contrib/rack.png +0 -0
  9. data/contrib/rack.svg +150 -0
  10. data/contrib/rack_logo.svg +1 -1
  11. data/contrib/rdoc.css +412 -0
  12. data/example/protectedlobster.rb +1 -1
  13. data/lib/rack/auth/abstract/handler.rb +4 -4
  14. data/lib/rack/auth/abstract/request.rb +7 -5
  15. data/lib/rack/auth/basic.rb +1 -1
  16. data/lib/rack/auth/digest/md5.rb +7 -3
  17. data/lib/rack/auth/digest/nonce.rb +1 -1
  18. data/lib/rack/auth/digest/params.rb +7 -9
  19. data/lib/rack/auth/digest/request.rb +10 -9
  20. data/lib/rack/backports/uri/common_18.rb +56 -0
  21. data/lib/rack/backports/uri/common_192.rb +52 -0
  22. data/lib/rack/backports/uri/common_193.rb +29 -0
  23. data/lib/rack/body_proxy.rb +39 -0
  24. data/lib/rack/builder.rb +106 -22
  25. data/lib/rack/cascade.rb +17 -6
  26. data/lib/rack/chunked.rb +44 -24
  27. data/lib/rack/commonlogger.rb +36 -13
  28. data/lib/rack/conditionalget.rb +49 -17
  29. data/lib/rack/config.rb +5 -0
  30. data/lib/rack/content_length.rb +14 -6
  31. data/lib/rack/content_type.rb +7 -1
  32. data/lib/rack/deflater.rb +73 -15
  33. data/lib/rack/directory.rb +18 -8
  34. data/lib/rack/etag.rb +59 -9
  35. data/lib/rack/file.rb +106 -44
  36. data/lib/rack/handler/cgi.rb +11 -11
  37. data/lib/rack/handler/fastcgi.rb +18 -6
  38. data/lib/rack/handler/lsws.rb +2 -4
  39. data/lib/rack/handler/mongrel.rb +22 -6
  40. data/lib/rack/handler/scgi.rb +16 -8
  41. data/lib/rack/handler/thin.rb +19 -4
  42. data/lib/rack/handler/webrick.rb +72 -19
  43. data/lib/rack/handler.rb +47 -14
  44. data/lib/rack/head.rb +10 -2
  45. data/lib/rack/lint.rb +260 -75
  46. data/lib/rack/lobster.rb +13 -8
  47. data/lib/rack/lock.rb +13 -3
  48. data/lib/rack/logger.rb +0 -2
  49. data/lib/rack/methodoverride.rb +27 -8
  50. data/lib/rack/mime.rb +625 -167
  51. data/lib/rack/mock.rb +78 -53
  52. data/lib/rack/multipart/generator.rb +93 -0
  53. data/lib/rack/multipart/parser.rb +253 -0
  54. data/lib/rack/multipart/uploaded_file.rb +34 -0
  55. data/lib/rack/multipart.rb +34 -0
  56. data/lib/rack/nulllogger.rb +21 -2
  57. data/lib/rack/recursive.rb +10 -5
  58. data/lib/rack/reloader.rb +3 -2
  59. data/lib/rack/request.rb +201 -74
  60. data/lib/rack/response.rb +41 -28
  61. data/lib/rack/rewindable_input.rb +15 -11
  62. data/lib/rack/runtime.rb +16 -3
  63. data/lib/rack/sendfile.rb +47 -29
  64. data/lib/rack/server.rb +223 -47
  65. data/lib/rack/session/abstract/id.rb +289 -30
  66. data/lib/rack/session/cookie.rb +133 -44
  67. data/lib/rack/session/memcache.rb +30 -56
  68. data/lib/rack/session/pool.rb +19 -43
  69. data/lib/rack/showexceptions.rb +53 -15
  70. data/lib/rack/showstatus.rb +14 -7
  71. data/lib/rack/static.rb +124 -12
  72. data/lib/rack/tempfile_reaper.rb +22 -0
  73. data/lib/rack/urlmap.rb +49 -15
  74. data/lib/rack/utils/okjson.rb +600 -0
  75. data/lib/rack/utils.rb +363 -361
  76. data/lib/rack.rb +17 -23
  77. data/rack.gemspec +11 -20
  78. data/test/builder/anything.rb +5 -0
  79. data/test/builder/comment.ru +4 -0
  80. data/test/builder/end.ru +5 -0
  81. data/test/builder/line.ru +1 -0
  82. data/test/builder/options.ru +2 -0
  83. data/test/cgi/assets/folder/test.js +1 -0
  84. data/test/cgi/assets/fonts/font.eot +1 -0
  85. data/test/cgi/assets/images/image.png +1 -0
  86. data/test/cgi/assets/index.html +1 -0
  87. data/test/cgi/assets/javascripts/app.js +1 -0
  88. data/test/cgi/assets/stylesheets/app.css +1 -0
  89. data/test/cgi/lighttpd.conf +26 -0
  90. data/test/cgi/rackup_stub.rb +6 -0
  91. data/test/cgi/sample_rackup.ru +5 -0
  92. data/test/cgi/test +9 -0
  93. data/test/cgi/test+directory/test+file +1 -0
  94. data/test/cgi/test.fcgi +8 -0
  95. data/test/cgi/test.ru +5 -0
  96. data/test/gemloader.rb +10 -0
  97. data/test/multipart/bad_robots +259 -0
  98. data/test/multipart/binary +0 -0
  99. data/test/multipart/content_type_and_no_filename +6 -0
  100. data/test/multipart/empty +10 -0
  101. data/test/multipart/fail_16384_nofile +814 -0
  102. data/test/multipart/file1.txt +1 -0
  103. data/test/multipart/filename_and_modification_param +7 -0
  104. data/test/multipart/filename_and_no_name +6 -0
  105. data/test/multipart/filename_with_escaped_quotes +6 -0
  106. data/test/multipart/filename_with_escaped_quotes_and_modification_param +7 -0
  107. data/test/multipart/filename_with_null_byte +7 -0
  108. data/test/multipart/filename_with_percent_escaped_quotes +6 -0
  109. data/test/multipart/filename_with_unescaped_percentages +6 -0
  110. data/test/multipart/filename_with_unescaped_percentages2 +6 -0
  111. data/test/multipart/filename_with_unescaped_percentages3 +6 -0
  112. data/test/multipart/filename_with_unescaped_quotes +6 -0
  113. data/test/multipart/ie +6 -0
  114. data/test/multipart/invalid_character +6 -0
  115. data/test/multipart/mixed_files +21 -0
  116. data/test/multipart/nested +10 -0
  117. data/test/multipart/none +9 -0
  118. data/test/multipart/semicolon +6 -0
  119. data/test/multipart/text +15 -0
  120. data/test/multipart/three_files_three_fields +31 -0
  121. data/test/multipart/webkit +32 -0
  122. data/test/rackup/config.ru +31 -0
  123. data/test/registering_handler/rack/handler/registering_myself.rb +8 -0
  124. data/test/{spec_rack_auth_basic.rb → spec_auth_basic.rb} +23 -15
  125. data/test/{spec_rack_auth_digest.rb → spec_auth_digest.rb} +56 -29
  126. data/test/spec_body_proxy.rb +85 -0
  127. data/test/spec_builder.rb +223 -0
  128. data/test/{spec_rack_cascade.rb → spec_cascade.rb} +28 -15
  129. data/test/{spec_rack_cgi.rb → spec_cgi.rb} +44 -31
  130. data/test/spec_chunked.rb +101 -0
  131. data/test/spec_commonlogger.rb +93 -0
  132. data/test/spec_conditionalget.rb +102 -0
  133. data/test/{spec_rack_config.rb → spec_config.rb} +6 -8
  134. data/test/spec_content_length.rb +85 -0
  135. data/test/spec_content_type.rb +45 -0
  136. data/test/spec_deflater.rb +339 -0
  137. data/test/{spec_rack_directory.rb → spec_directory.rb} +37 -10
  138. data/test/spec_etag.rb +107 -0
  139. data/test/{spec_rack_fastcgi.rb → spec_fastcgi.rb} +47 -29
  140. data/test/spec_file.rb +221 -0
  141. data/test/spec_handler.rb +72 -0
  142. data/test/spec_head.rb +45 -0
  143. data/test/{spec_rack_lint.rb → spec_lint.rb} +82 -60
  144. data/test/spec_lobster.rb +58 -0
  145. data/test/spec_lock.rb +164 -0
  146. data/test/spec_logger.rb +23 -0
  147. data/test/spec_methodoverride.rb +95 -0
  148. data/test/spec_mime.rb +51 -0
  149. data/test/{spec_rack_mock.rb → spec_mock.rb} +92 -38
  150. data/test/{spec_rack_mongrel.rb → spec_mongrel.rb} +46 -53
  151. data/test/spec_multipart.rb +600 -0
  152. data/test/spec_nulllogger.rb +20 -0
  153. data/test/spec_recursive.rb +72 -0
  154. data/test/spec_request.rb +1227 -0
  155. data/test/spec_response.rb +407 -0
  156. data/test/spec_rewindable_input.rb +118 -0
  157. data/test/spec_runtime.rb +49 -0
  158. data/test/spec_sendfile.rb +130 -0
  159. data/test/spec_server.rb +167 -0
  160. data/test/spec_session_abstract_id.rb +53 -0
  161. data/test/spec_session_cookie.rb +410 -0
  162. data/test/{spec_rack_session_memcache.rb → spec_session_memcache.rb} +119 -71
  163. data/test/{spec_rack_session_pool.rb → spec_session_pool.rb} +106 -69
  164. data/test/spec_showexceptions.rb +85 -0
  165. data/test/spec_showstatus.rb +103 -0
  166. data/test/spec_static.rb +145 -0
  167. data/test/spec_tempfile_reaper.rb +63 -0
  168. data/test/{spec_rack_thin.rb → spec_thin.rb} +35 -35
  169. data/test/{spec_rack_urlmap.rb → spec_urlmap.rb} +40 -19
  170. data/test/spec_utils.rb +647 -0
  171. data/test/spec_version.rb +17 -0
  172. data/test/spec_webrick.rb +184 -0
  173. data/test/static/another/index.html +1 -0
  174. data/test/static/index.html +1 -0
  175. data/test/testrequest.rb +78 -0
  176. data/test/unregistered_handler/rack/handler/unregistered.rb +7 -0
  177. data/test/unregistered_handler/rack/handler/unregistered_long_one.rb +7 -0
  178. metadata +220 -239
  179. data/RDOX +0 -0
  180. data/README +0 -592
  181. data/lib/rack/adapter/camping.rb +0 -22
  182. data/test/spec_auth.rb +0 -57
  183. data/test/spec_rack_builder.rb +0 -84
  184. data/test/spec_rack_camping.rb +0 -55
  185. data/test/spec_rack_chunked.rb +0 -62
  186. data/test/spec_rack_commonlogger.rb +0 -61
  187. data/test/spec_rack_conditionalget.rb +0 -41
  188. data/test/spec_rack_content_length.rb +0 -43
  189. data/test/spec_rack_content_type.rb +0 -30
  190. data/test/spec_rack_deflater.rb +0 -127
  191. data/test/spec_rack_etag.rb +0 -17
  192. data/test/spec_rack_file.rb +0 -75
  193. data/test/spec_rack_handler.rb +0 -43
  194. data/test/spec_rack_head.rb +0 -30
  195. data/test/spec_rack_lobster.rb +0 -45
  196. data/test/spec_rack_lock.rb +0 -38
  197. data/test/spec_rack_logger.rb +0 -21
  198. data/test/spec_rack_methodoverride.rb +0 -60
  199. data/test/spec_rack_nulllogger.rb +0 -13
  200. data/test/spec_rack_recursive.rb +0 -77
  201. data/test/spec_rack_request.rb +0 -594
  202. data/test/spec_rack_response.rb +0 -221
  203. data/test/spec_rack_rewindable_input.rb +0 -118
  204. data/test/spec_rack_runtime.rb +0 -35
  205. data/test/spec_rack_sendfile.rb +0 -86
  206. data/test/spec_rack_session_cookie.rb +0 -92
  207. data/test/spec_rack_showexceptions.rb +0 -21
  208. data/test/spec_rack_showstatus.rb +0 -72
  209. data/test/spec_rack_static.rb +0 -37
  210. data/test/spec_rack_utils.rb +0 -557
  211. data/test/spec_rack_webrick.rb +0 -130
  212. data/test/spec_rackup.rb +0 -164
data/README DELETED
@@ -1,592 +0,0 @@
1
- = Rack, a modular Ruby webserver interface {<img src="https://secure.travis-ci.org/rack/rack.png" alt="Build Status" />}[http://travis-ci.org/rack/rack] {<img src="https://gemnasium.com/rack/rack.png" alt="Dependency Status" />}[https://gemnasium.com/rack/rack]
2
-
3
- Rack provides a minimal, modular and adaptable interface for developing
4
- web applications in Ruby. By wrapping HTTP requests and responses in
5
- the simplest way possible, it unifies and distills the API for web
6
- servers, web frameworks, and software in between (the so-called
7
- middleware) into a single method call.
8
-
9
- The exact details of this are described in the Rack specification,
10
- which all Rack applications should conform to.
11
-
12
- == Supported web servers
13
-
14
- The included *handlers* connect all kinds of web servers to Rack:
15
- * Mongrel
16
- * EventedMongrel
17
- * SwiftipliedMongrel
18
- * WEBrick
19
- * FCGI
20
- * CGI
21
- * 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
- * Unicorn
33
- * unixrack
34
- * uWSGI
35
- * Zbatery
36
-
37
- Any valid Rack app will run the same on all these handlers, without
38
- changing anything.
39
-
40
- == Supported web frameworks
41
-
42
- These frameworks include Rack adapters in their distributions:
43
- * Camping
44
- * Coset
45
- * Halcyon
46
- * Mack
47
- * Maveric
48
- * Merb
49
- * Racktools::SimpleApplication
50
- * Ramaze
51
- * Ruby on Rails
52
- * Rum
53
- * Sinatra
54
- * Sin
55
- * Vintage
56
- * Waves
57
- * Wee
58
- * ... and many others.
59
-
60
- Current links to these projects can be found at
61
- http://wiki.ramaze.net/Home#other-frameworks
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.
68
- * Rack::CommonLogger, for creating Apache-style logfiles.
69
- * Rack::ShowException, for catching unhandled exceptions and
70
- presenting them in a nice and helpful way with clickable backtrace.
71
- * Rack::File, for serving static files.
72
- * ...many others!
73
-
74
- All these components use the same interface, which is described in
75
- detail in the Rack specification. These optional components can be
76
- used in any way you wish.
77
-
78
- == Convenience
79
-
80
- 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
83
- over:
84
- * Rack::Request, which also provides query string parsing and
85
- multipart handling.
86
- * Rack::Response, for convenient generation of HTTP replies and
87
- cookie handling.
88
- * Rack::MockRequest and Rack::MockResponse for efficient and quick
89
- testing of Rack application without real HTTP round-trips.
90
-
91
- == rack-contrib
92
-
93
- 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.
96
-
97
- * http://github.com/rack/rack-contrib
98
-
99
- == rackup
100
-
101
- rackup is a useful tool for running Rack applications, which uses the
102
- Rack::Builder DSL to configure middleware and build up applications
103
- easily.
104
-
105
- 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.
108
-
109
- == Quick start
110
-
111
- Try the lobster!
112
-
113
- Either with the embedded WEBrick starter:
114
-
115
- ruby -Ilib lib/rack/lobster.rb
116
-
117
- Or with rackup:
118
-
119
- bin/rackup -Ilib example/lobster.ru
120
-
121
- By default, the lobster is found at http://localhost:9292.
122
-
123
- == Installing with RubyGems
124
-
125
- A Gem of Rack is available at rubygems.org. You can install it with:
126
-
127
- gem install rack
128
-
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 test/spec testing framework:
137
-
138
- gem install test-spec
139
-
140
- There are two rake-based test tasks:
141
-
142
- rake test tests all the fast tests (no Handlers or Adapters)
143
- rake fulltest runs all the tests
144
-
145
- The fast testsuite has no dependencies outside of the core Ruby
146
- installation and test-spec.
147
-
148
- To run the test suite completely, you need:
149
-
150
- * fcgi
151
- * memcache-client
152
- * mongrel
153
- * thin
154
-
155
- The full set of tests test FCGI access with lighttpd (on port
156
- 9203) so you will need lighttpd installed as well as the FCGI
157
- libraries and the fcgi gem:
158
-
159
- Download and install lighttpd:
160
-
161
- http://www.lighttpd.net/download
162
-
163
- Installing the FCGI libraries:
164
-
165
- curl -O http://www.fastcgi.com/dist/fcgi-2.4.0.tar.gz
166
- tar xzvf fcgi-2.4.0.tar.gz
167
- cd fcgi-2.4.0
168
- ./configure --prefix=/usr/local
169
- make
170
- sudo make install
171
- cd ..
172
-
173
- Installing the Ruby fcgi gem:
174
-
175
- gem install fcgi
176
-
177
- Furthermore, to test Memcache sessions, you need memcached (will be
178
- run on port 11211) and memcache-client installed.
179
-
180
- == History
181
-
182
- * March 3rd, 2007: First public release 0.1.
183
-
184
- * May 16th, 2007: Second public release 0.2.
185
- * HTTP Basic authentication.
186
- * Cookie Sessions.
187
- * Static file handler.
188
- * Improved Rack::Request.
189
- * Improved Rack::Response.
190
- * Added Rack::ShowStatus, for better default error messages.
191
- * Bug fixes in the Camping adapter.
192
- * Removed Rails adapter, was too alpha.
193
-
194
- * February 26th, 2008: Third public release 0.3.
195
- * LiteSpeed handler, by Adrian Madrid.
196
- * SCGI handler, by Jeremy Evans.
197
- * Pool sessions, by blink.
198
- * OpenID authentication, by blink.
199
- * :Port and :File options for opening FastCGI sockets, by blink.
200
- * Last-Modified HTTP header for Rack::File, by blink.
201
- * Rack::Builder#use now accepts blocks, by Corey Jewett.
202
- (See example/protectedlobster.ru)
203
- * HTTP status 201 can contain a Content-Type and a body now.
204
- * Many bugfixes, especially related to Cookie handling.
205
-
206
- * August 21st, 2008: Fourth public release 0.4.
207
- * New middleware, Rack::Deflater, by Christoffer Sawicki.
208
- * OpenID authentication now needs ruby-openid 2.
209
- * New Memcache sessions, by blink.
210
- * Explicit EventedMongrel handler, by Joshua Peek <josh@joshpeek.com>
211
- * Rack::Reloader is not loaded in rackup development mode.
212
- * rackup can daemonize with -D.
213
- * Many bugfixes, especially for pool sessions, URLMap, thread safety
214
- and tempfile handling.
215
- * Improved tests.
216
- * Rack moved to Git.
217
-
218
- * January 6th, 2009: Fifth public release 0.9.
219
- * Rack is now managed by the Rack Core Team.
220
- * Rack::Lint is stricter and follows the HTTP RFCs more closely.
221
- * Added ConditionalGet middleware.
222
- * Added ContentLength middleware.
223
- * Added Deflater middleware.
224
- * Added Head middleware.
225
- * Added MethodOverride middleware.
226
- * Rack::Mime now provides popular MIME-types and their extension.
227
- * Mongrel Header now streams.
228
- * Added Thin handler.
229
- * Official support for swiftiplied Mongrel.
230
- * Secure cookies.
231
- * Made HeaderHash case-preserving.
232
- * Many bugfixes and small improvements.
233
-
234
- * January 9th, 2009: Sixth public release 0.9.1.
235
- * Fix directory traversal exploits in Rack::File and Rack::Directory.
236
-
237
- * April 25th, 2009: Seventh public release 1.0.0.
238
- * SPEC change: Rack::VERSION has been pushed to [1,0].
239
- * SPEC change: header values must be Strings now, split on "\n".
240
- * SPEC change: Content-Length can be missing, in this case chunked transfer
241
- encoding is used.
242
- * SPEC change: rack.input must be rewindable and support reading into
243
- a buffer, wrap with Rack::RewindableInput if it isn't.
244
- * SPEC change: rack.session is now specified.
245
- * SPEC change: Bodies can now additionally respond to #to_path with
246
- a filename to be served.
247
- * NOTE: String bodies break in 1.9, use an Array consisting of a
248
- single String instead.
249
- * New middleware Rack::Lock.
250
- * New middleware Rack::ContentType.
251
- * Rack::Reloader has been rewritten.
252
- * Major update to Rack::Auth::OpenID.
253
- * Support for nested parameter parsing in Rack::Response.
254
- * Support for redirects in Rack::Response.
255
- * HttpOnly cookie support in Rack::Response.
256
- * The Rakefile has been rewritten.
257
- * Many bugfixes and small improvements.
258
-
259
- * October 18th, 2009: Eighth public release 1.0.1.
260
- * Bump remainder of rack.versions.
261
- * Support the pure Ruby FCGI implementation.
262
- * Fix for form names containing "=": split first then unescape components
263
- * Fixes the handling of the filename parameter with semicolons in names.
264
- * Add anchor to nested params parsing regexp to prevent stack overflows
265
- * Use more compatible gzip write api instead of "<<".
266
- * Make sure that Reloader doesn't break when executed via ruby -e
267
- * Make sure WEBrick respects the :Host option
268
- * Many Ruby 1.9 fixes.
269
-
270
- * January 3rd, 2010: Ninth public release 1.1.0.
271
- * Moved Auth::OpenID to rack-contrib.
272
- * SPEC change that relaxes Lint slightly to allow subclasses of the
273
- required types
274
- * SPEC change to document rack.input binary mode in greator detail
275
- * SPEC define optional rack.logger specification
276
- * File servers support X-Cascade header
277
- * Imported Config middleware
278
- * Imported ETag middleware
279
- * Imported Runtime middleware
280
- * Imported Sendfile middleware
281
- * New Logger and NullLogger middlewares
282
- * Added mime type for .ogv and .manifest.
283
- * Don't squeeze PATH_INFO slashes
284
- * Use Content-Type to determine POST params parsing
285
- * Update Rack::Utils::HTTP_STATUS_CODES hash
286
- * Add status code lookup utility
287
- * Response should call #to_i on the status
288
- * Add Request#user_agent
289
- * Request#host knows about forwared host
290
- * Return an empty string for Request#host if HTTP_HOST and
291
- SERVER_NAME are both missing
292
- * Allow MockRequest to accept hash params
293
- * Optimizations to HeaderHash
294
- * Refactored rackup into Rack::Server
295
- * Added Utils.build_nested_query to complement Utils.parse_nested_query
296
- * Added Utils::Multipart.build_multipart to complement
297
- Utils::Multipart.parse_multipart
298
- * Extracted set and delete cookie helpers into Utils so they can be
299
- used outside Response
300
- * Extract parse_query and parse_multipart in Request so subclasses
301
- can change their behavior
302
- * Enforce binary encoding in RewindableInput
303
- * Set correct external_encoding for handlers that don't use RewindableInput
304
-
305
- * June 13th, 2010: Tenth public release 1.2.0.
306
- * Removed Camping adapter: Camping 2.0 supports Rack as-is
307
- * Removed parsing of quoted values
308
- * Add Request.trace? and Request.options?
309
- * Add mime-type for .webm and .htc
310
- * Fix HTTP_X_FORWARDED_FOR
311
- * Various multipart fixes
312
- * Switch test suite to bacon
313
-
314
- * June 15th, 2010: Eleventh public release 1.2.1.
315
- * Make CGI handler rewindable
316
- * Rename spec/ to test/ to not conflict with SPEC on lesser
317
- operating systems
318
-
319
- * March 13th, 2011: Twelfth public release 1.2.2/1.1.2.
320
- * Security fix in Rack::Auth::Digest::MD5: when authenticator
321
- returned nil, permission was granted on empty password.
322
-
323
- * May 22nd, 2011: Thirteenth public release 1.3.0
324
- * Various performance optimizations
325
- * Various multipart fixes
326
- * Various multipart refactors
327
- * Infinite loop fix for multipart
328
- * Test coverage for Rack::Server returns
329
- * Allow files with '..', but not path components that are '..'
330
- * rackup accepts handler-specific options on the command line
331
- * Request#params no longer merges POST into GET (but returns the same)
332
- * Use URI.encode_www_form_component instead. Use core methods for escaping.
333
- * Allow multi-line comments in the config file
334
- * Bug L#94 reported by Nikolai Lugovoi, query parameter unescaping.
335
- * Rack::Response now deletes Content-Length when appropriate
336
- * Rack::Deflater now supports streaming
337
- * Improved Rack::Handler loading and searching
338
- * Support for the PATCH verb
339
- * env['rack.session.options'] now contains session options
340
- * Cookies respect renew
341
- * Session middleware uses SecureRandom.hex
342
-
343
- * May 22nd, 2011: Fourteenth public release 1.2.3
344
- * Pulled in relevant bug fixes from 1.3
345
- * Fixed 1.8.6 support
346
-
347
- * July 13, 2011: Fifteenth public release 1.3.1
348
- * Fix 1.9.1 support
349
- * Fix JRuby support
350
- * Properly handle $KCODE in Rack::Utils.escape
351
- * Make method_missing/respond_to behavior consistent for Rack::Lock,
352
- Rack::Auth::Digest::Request and Rack::Multipart::UploadedFile
353
- * Reenable passing rack.session to session middleware
354
- * Rack::CommonLogger handles streaming responses correctly
355
- * Rack::MockResponse calls close on the body object
356
- * Fix a DOS vector from MRI stdlib backport
357
-
358
- * July 16, 2011: Sixteenth public release 1.3.2
359
- * Fix for Rails and rack-test, Rack::Utils#escape calls to_s
360
-
361
- * Not Yet Released: Seventeenth public release 1.3.3
362
- * Fix bug with broken query parameters in Rack::ShowExceptions
363
- * Rack::Request#cookies no longer swallows exceptions on broken input
364
- * Prevents XSS attacks enabled by bug in Ruby 1.8's regexp engine
365
- * Rack::ConditionalGet handles broken If-Modified-Since helpers
366
-
367
- * September 16, 2011: Eighteenth public release 1.2.4
368
- * Fix a bug with MRI regex engine to prevent XSS by malformed unicode
369
-
370
- * October 1, 2011: Nineteenth public release 1.3.4
371
- * Backport security fix from 1.9.3, also fixes some roundtrip issues in URI
372
- * Small documentation update
373
- * Fix an issue where BodyProxy could cause an infinite recursion
374
- * Add some supporting files for travis-ci
375
-
376
- * October 17, 2011: Twentieth public release 1.3.5
377
- * Fix annoying warnings caused by the backport in 1.3.4
378
-
379
- * December 28th, 2011: Twenty first public release: 1.1.3.
380
- * Security fix. http://www.ocert.org/advisories/ocert-2011-003.html
381
- Further information here: http://jruby.org/2011/12/27/jruby-1-6-5-1
382
-
383
- * December 28th, 2011: Twenty fourth public release 1.4.0
384
- * Ruby 1.8.6 support has officially been dropped. Not all tests pass.
385
- * Raise sane error messages for broken config.ru
386
- * Allow combining run and map in a config.ru
387
- * Rack::ContentType will not set Content-Type for responses without a body
388
- * Status code 205 does not send a response body
389
- * Rack::Response::Helpers will not rely on instance variables
390
- * Rack::Utils.build_query no longer outputs '=' for nil query values
391
- * Various mime types added
392
- * Rack::MockRequest now supports HEAD
393
- * Rack::Directory now supports files that contain RFC3986 reserved chars
394
- * Rack::File now only supports GET and HEAD requests
395
- * Rack::Server#start now passes the block to Rack::Handler::<h>#run
396
- * Rack::Static now supports an index option
397
- * Added the Teapot status code
398
- * rackup now defaults to Thin instead of Mongrel (if installed)
399
- * Support added for HTTP_X_FORWARDED_SCHEME
400
- * Numerous bug fixes, including many fixes for new and alternate rubies
401
-
402
- * January 22nd, 2012: Twenty fifth public release 1.4.1
403
- * Alter the keyspace limit calculations to reduce issues with nested params
404
- * Add a workaround for multipart parsing where files contain unescaped "%"
405
- * Added Rack::Response::Helpers#method_not_allowed? (code 405)
406
- * Rack::File now returns 404 for illegal directory traversals
407
- * Rack::File now returns 405 for illegal methods (non HEAD/GET)
408
- * Rack::Cascade now catches 405 by default, as well as 404
409
- * Cookies missing '--' no longer cause an exception to be raised
410
- * Various style changes and documentation spelling errors
411
- * Rack::BodyProxy always ensures to execute its block
412
- * Additional test coverage around cookies and secrets
413
- * Rack::Session::Cookie can now be supplied either secret or old_secret
414
- * Tests are no longer dependent on set order
415
- * Rack::Static no longer defaults to serving index files
416
- * Rack.release was fixed
417
-
418
- * January 6th, 2013: Twenty sixth public release 1.1.4
419
- * Add warnings when users do not provide a session secret
420
-
421
- * January 6th, 2013: Twenty seventh public release 1.2.6
422
- * Add warnings when users do not provide a session secret
423
- * Fix parsing performance for unquoted filenames
424
-
425
- * January 6th, 2013: Twenty eighth public release 1.3.7
426
- * Add warnings when users do not provide a session secret
427
- * Fix parsing performance for unquoted filenames
428
- * Updated URI backports
429
- * Fix URI backport version matching, and silence constant warnings
430
- * Correct parameter parsing with empty values
431
- * Correct rackup '-I' flag, to allow multiple uses
432
- * Correct rackup pidfile handling
433
- * Report rackup line numbers correctly
434
- * Fix request loops caused by non-stale nonces with time limits
435
- * Fix reloader on Windows
436
- * Prevent infinite recursions from Response#to_ary
437
- * Various middleware better conforms to the body close specification
438
- * Updated language for the body close specification
439
- * Additional notes regarding ECMA escape compatibility issues
440
- * Fix the parsing of multiple ranges in range headers
441
-
442
- * January 6th, 2013: Twenty ninth public release 1.4.2
443
- * Add warnings when users do not provide a session secret
444
- * Fix parsing performance for unquoted filenames
445
- * Updated URI backports
446
- * Fix URI backport version matching, and silence constant warnings
447
- * Correct parameter parsing with empty values
448
- * Correct rackup '-I' flag, to allow multiple uses
449
- * Correct rackup pidfile handling
450
- * Report rackup line numbers correctly
451
- * Fix request loops caused by non-stale nonces with time limits
452
- * Fix reloader on Windows
453
- * Prevent infinite recursions from Response#to_ary
454
- * Various middleware better conforms to the body close specification
455
- * Updated language for the body close specification
456
- * Additional notes regarding ECMA escape compatibility issues
457
- * Fix the parsing of multiple ranges in range headers
458
- * Prevent errors from empty parameter keys
459
- * Added PATCH verb to Rack::Request
460
- * Various documentation updates
461
- * Fix session merge semantics (fixes rack-test)
462
- * Rack::Static :index can now handle multiple directories
463
- * All tests now utilize Rack::Lint (special thanks to Lars Gierth)
464
- * Rack::File cache_control parameter is now deprecated, and removed by 1.5
465
- * Correct Rack::Directory script name escaping
466
- * Rack::Static supports header rules for sophisticated configurations
467
- * Multipart parsing now works without a Content-Length header
468
- * New logos courtesy of Zachary Scott!
469
- * Rack::BodyProxy now explicitly defines #each, useful for C extensions
470
- * Cookies that are not URI escaped no longer cause exceptions
471
-
472
- * January 7th, 2013: Thirtieth public release 1.3.8
473
- * Security: Prevent unbounded reads in large multipart boundaries
474
-
475
- * January 7th, 2013: Thirty first public release 1.4.3
476
- * Security: Prevent unbounded reads in large multipart boundaries
477
-
478
- * January 13th, 2013: Thirty second public release 1.4.4, 1.3.9, 1.2.7, 1.1.5
479
- * [SEC] Rack::Auth::AbstractRequest no longer symbolizes arbitrary strings
480
- * Fixed erroneous test case in the 1.3.x series
481
-
482
- * February 7th, Thirty fifth public release 1.1.6, 1.2.8, 1.3.10
483
- * Fix CVE-2013-0263, timing attack against Rack::Session::Cookie
484
-
485
- * February 7th, Thirty fifth public release 1.4.5
486
- * Fix CVE-2013-0263, timing attack against Rack::Session::Cookie
487
- * Fix CVE-2013-0262, symlink path traversal in Rack::File
488
-
489
- * February 7th, Thirty fifth public release 1.5.2
490
- * Fix CVE-2013-0263, timing attack against Rack::Session::Cookie
491
- * Fix CVE-2013-0262, symlink path traversal in Rack::File
492
- * Add various methods to Session for enhanced Rails compatibility
493
- * Request#trusted_proxy? now only matches whole stirngs
494
- * Add JSON cookie coder, to be default in Rack 1.6+ due to security concerns
495
- * URLMap host matching in environments that don't set the Host header fixed
496
- * Fix a race condition that could result in overwritten pidfiles
497
- * Various documentation additions
498
-
499
- == Contact
500
-
501
- Please post bugs, suggestions and patches to
502
- the bug tracker at <http://github.com/rack/rack/issues>.
503
-
504
- Please post security related bugs and suggestions to the core team at
505
- <https://groups.google.com/group/rack-core> or rack-core@googlegroups.com. Due
506
- to wide usage of the library, it is strongly preferred that we manage timing in
507
- order to provide viable patches at the time of disclosure. Your assistance in
508
- this matter is greatly appreciated.
509
-
510
- Mailing list archives are available at
511
- <http://groups.google.com/group/rack-devel>.
512
-
513
- Git repository (send Git patches to the mailing list):
514
- * http://github.com/rack/rack
515
- * http://git.vuxu.org/cgi-bin/gitweb.cgi?p=rack-github.git
516
-
517
- You are also welcome to join the #rack channel on irc.freenode.net.
518
-
519
- == Thanks
520
-
521
- The Rack Core Team, consisting of
522
-
523
- * Christian Neukirchen (chneukirchen)
524
- * James Tucker (raggi)
525
- * Josh Peek (josh)
526
- * Michael Fellinger (manveru)
527
- * Ryan Tomayko (rtomayko)
528
- * Scytrin dai Kinthra (scytrin)
529
- * Aaron Patterson (tenderlove)
530
- * Konstantin Haase (rkh)
531
-
532
- would like to thank:
533
-
534
- * Adrian Madrid, for the LiteSpeed handler.
535
- * Christoffer Sawicki, for the first Rails adapter and Rack::Deflater.
536
- * Tim Fletcher, for the HTTP authentication code.
537
- * Luc Heinrich for the Cookie sessions, the static file handler and bugfixes.
538
- * Armin Ronacher, for the logo and racktools.
539
- * Alex Beregszaszi, Alexander Kahn, Anil Wadghule, Aredridel, Ben
540
- Alpert, Dan Kubb, Daniel Roethlisberger, Matt Todd, Tom Robinson,
541
- Phil Hagelberg, S. Brent Faulkner, Bosko Milekic, Daniel Rodríguez
542
- Troitiño, Genki Takiuchi, Geoffrey Grosenbach, Julien Sanchez, Kamal
543
- Fariz Mahyuddin, Masayoshi Takahashi, Patrick Aljordm, Mig, Kazuhiro
544
- Nishiyama, Jon Bardin, Konstantin Haase, Larry Siden, Matias
545
- Korhonen, Sam Ruby, Simon Chiang, Tim Connor, Timur Batyrshin, and
546
- Zach Brock for bug fixing and other improvements.
547
- * Eric Wong, Hongli Lai, Jeremy Kemper for their continuous support
548
- and API improvements.
549
- * Yehuda Katz and Carl Lerche for refactoring rackup.
550
- * Brian Candler, for Rack::ContentType.
551
- * Graham Batty, for improved handler loading.
552
- * Stephen Bannasch, for bug reports and documentation.
553
- * Gary Wright, for proposing a better Rack::Response interface.
554
- * Jonathan Buch, for improvements regarding Rack::Response.
555
- * Armin Röhrl, for tracking down bugs in the Cookie generator.
556
- * Alexander Kellett for testing the Gem and reviewing the announcement.
557
- * Marcus Rückert, for help with configuring and debugging lighttpd.
558
- * The WSGI team for the well-done and documented work they've done and
559
- Rack builds up on.
560
- * All bug reporters and patch contributors not mentioned above.
561
-
562
- == Copyright
563
-
564
- Copyright (C) 2007, 2008, 2009, 2010 Christian Neukirchen <http://purl.org/net/chneukirchen>
565
-
566
- Permission is hereby granted, free of charge, to any person obtaining a copy
567
- of this software and associated documentation files (the "Software"), to
568
- deal in the Software without restriction, including without limitation the
569
- rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
570
- sell copies of the Software, and to permit persons to whom the Software is
571
- furnished to do so, subject to the following conditions:
572
-
573
- The above copyright notice and this permission notice shall be included in
574
- all copies or substantial portions of the Software.
575
-
576
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
577
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
578
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
579
- THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
580
- IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
581
- CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
582
-
583
- == Links
584
-
585
- Rack:: <http://rack.github.com/>
586
- Official Rack repositories:: <http://github.com/rack>
587
- Rack Bug Tracking:: <http://github.com/rack/rack/issues>
588
- rack-devel mailing list:: <http://groups.google.com/group/rack-devel>
589
- Rack's Rubyforge project:: <http://rubyforge.org/projects/rack>
590
-
591
- Christian Neukirchen:: <http://chneukirchen.org/>
592
-
@@ -1,22 +0,0 @@
1
- module Rack
2
- module Adapter
3
- class Camping
4
- def initialize(app)
5
- @app = app
6
- end
7
-
8
- def call(env)
9
- env["PATH_INFO"] ||= ""
10
- env["SCRIPT_NAME"] ||= ""
11
- controller = @app.run(env['rack.input'], env)
12
- h = controller.headers
13
- h.each_pair do |k,v|
14
- if v.kind_of? URI
15
- h[k] = v.to_s
16
- end
17
- end
18
- [controller.status, controller.headers, [controller.body.to_s]]
19
- end
20
- end
21
- end
22
- end
data/test/spec_auth.rb DELETED
@@ -1,57 +0,0 @@
1
- require 'rack'
2
-
3
- context "Rack::Auth" do
4
- specify "should have all common authentication schemes" do
5
- Rack::Auth.schemes.should.include? 'basic'
6
- Rack::Auth.schemes.should.include? 'digest'
7
- Rack::Auth.schemes.should.include? 'bearer'
8
- Rack::Auth.schemes.should.include? 'token'
9
- end
10
-
11
- specify "should allow registration of new auth schemes" do
12
- Rack::Auth.schemes.should.not.include "test"
13
- Rack::Auth.add_scheme "test"
14
- Rack::Auth.schemes.should.include "test"
15
- end
16
- end
17
-
18
- context "Rack::Auth::AbstractRequest" do
19
- specify "should symbolize known auth schemes" do
20
- env = Rack::MockRequest.env_for('/')
21
- env['HTTP_AUTHORIZATION'] = 'Basic aXJyZXNwb25zaWJsZQ=='
22
- req = Rack::Auth::AbstractRequest.new(env)
23
- req.scheme.should.equal :basic
24
-
25
-
26
- env['HTTP_AUTHORIZATION'] = 'Digest aXJyZXNwb25zaWJsZQ=='
27
- req = Rack::Auth::AbstractRequest.new(env)
28
- req.scheme.should.equal :digest
29
-
30
- env['HTTP_AUTHORIZATION'] = 'Bearer aXJyZXNwb25zaWJsZQ=='
31
- req = Rack::Auth::AbstractRequest.new(env)
32
- req.scheme.should.equal :bearer
33
-
34
- env['HTTP_AUTHORIZATION'] = 'MAC aXJyZXNwb25zaWJsZQ=='
35
- req = Rack::Auth::AbstractRequest.new(env)
36
- req.scheme.should.equal :mac
37
-
38
- env['HTTP_AUTHORIZATION'] = 'Token aXJyZXNwb25zaWJsZQ=='
39
- req = Rack::Auth::AbstractRequest.new(env)
40
- req.scheme.should.equal :token
41
-
42
- env['HTTP_AUTHORIZATION'] = 'OAuth aXJyZXNwb25zaWJsZQ=='
43
- req = Rack::Auth::AbstractRequest.new(env)
44
- req.scheme.should.equal :oauth
45
-
46
- env['HTTP_AUTHORIZATION'] = 'OAuth2 aXJyZXNwb25zaWJsZQ=='
47
- req = Rack::Auth::AbstractRequest.new(env)
48
- req.scheme.should.equal :oauth2
49
- end
50
-
51
- specify "should not symbolize unknown auth schemes" do
52
- env = Rack::MockRequest.env_for('/')
53
- env['HTTP_AUTHORIZATION'] = 'magic aXJyZXNwb25zaWJsZQ=='
54
- req = Rack::Auth::AbstractRequest.new(env)
55
- req.scheme.should == "magic"
56
- end
57
- end