rack 1.2.8 → 1.3.0.beta
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.
- data/README +9 -177
- data/Rakefile +2 -1
- data/SPEC +2 -2
- data/lib/rack.rb +2 -13
- data/lib/rack/auth/abstract/request.rb +7 -5
- data/lib/rack/auth/digest/md5.rb +6 -2
- data/lib/rack/auth/digest/params.rb +5 -7
- data/lib/rack/auth/digest/request.rb +1 -1
- data/lib/rack/backports/uri/common.rb +64 -0
- data/lib/rack/builder.rb +60 -3
- data/lib/rack/chunked.rb +29 -22
- data/lib/rack/conditionalget.rb +35 -16
- data/lib/rack/content_length.rb +3 -3
- data/lib/rack/deflater.rb +5 -2
- data/lib/rack/etag.rb +38 -10
- data/lib/rack/file.rb +76 -43
- data/lib/rack/handler.rb +13 -7
- data/lib/rack/handler/cgi.rb +0 -2
- data/lib/rack/handler/fastcgi.rb +13 -4
- data/lib/rack/handler/lsws.rb +0 -2
- data/lib/rack/handler/mongrel.rb +12 -2
- data/lib/rack/handler/scgi.rb +9 -1
- data/lib/rack/handler/thin.rb +7 -1
- data/lib/rack/handler/webrick.rb +12 -5
- data/lib/rack/lint.rb +2 -2
- data/lib/rack/lock.rb +29 -3
- data/lib/rack/methodoverride.rb +1 -1
- data/lib/rack/mime.rb +2 -2
- data/lib/rack/mock.rb +28 -33
- data/lib/rack/multipart.rb +34 -0
- data/lib/rack/multipart/generator.rb +93 -0
- data/lib/rack/multipart/parser.rb +164 -0
- data/lib/rack/multipart/uploaded_file.rb +30 -0
- data/lib/rack/request.rb +55 -19
- data/lib/rack/response.rb +10 -8
- data/lib/rack/sendfile.rb +14 -18
- data/lib/rack/server.rb +55 -8
- data/lib/rack/session/abstract/id.rb +233 -22
- data/lib/rack/session/cookie.rb +99 -46
- data/lib/rack/session/memcache.rb +30 -56
- data/lib/rack/session/pool.rb +22 -43
- data/lib/rack/showexceptions.rb +40 -11
- data/lib/rack/showstatus.rb +9 -2
- data/lib/rack/static.rb +29 -9
- data/lib/rack/urlmap.rb +6 -1
- data/lib/rack/utils.rb +67 -326
- data/rack.gemspec +2 -3
- data/test/builder/anything.rb +5 -0
- data/test/builder/comment.ru +4 -0
- data/test/builder/end.ru +3 -0
- data/test/builder/options.ru +2 -0
- data/test/cgi/lighttpd.conf +1 -1
- data/test/cgi/lighttpd.errors +412 -0
- data/test/multipart/content_type_and_no_filename +6 -0
- data/test/multipart/text +5 -0
- data/test/multipart/webkit +32 -0
- data/test/registering_handler/rack/handler/registering_myself.rb +8 -0
- data/test/spec_auth_digest.rb +20 -5
- data/test/spec_builder.rb +29 -0
- data/test/spec_cgi.rb +11 -0
- data/test/spec_chunked.rb +1 -1
- data/test/spec_commonlogger.rb +1 -1
- data/test/spec_conditionalget.rb +47 -0
- data/test/spec_content_length.rb +0 -6
- data/test/spec_content_type.rb +5 -5
- data/test/spec_deflater.rb +46 -2
- data/test/spec_etag.rb +68 -1
- data/test/spec_fastcgi.rb +11 -0
- data/test/spec_file.rb +54 -3
- data/test/spec_handler.rb +23 -5
- data/test/spec_lint.rb +2 -2
- data/test/spec_lock.rb +111 -5
- data/test/spec_methodoverride.rb +2 -2
- data/test/spec_mock.rb +3 -3
- data/test/spec_mongrel.rb +1 -2
- data/test/spec_multipart.rb +279 -0
- data/test/spec_request.rb +222 -38
- data/test/spec_response.rb +9 -3
- data/test/spec_server.rb +74 -0
- data/test/spec_session_abstract_id.rb +43 -0
- data/test/spec_session_cookie.rb +97 -15
- data/test/spec_session_memcache.rb +60 -50
- data/test/spec_session_pool.rb +63 -40
- data/test/spec_showexceptions.rb +64 -0
- data/test/spec_static.rb +23 -0
- data/test/spec_utils.rb +65 -351
- data/test/spec_webrick.rb +23 -4
- metadata +35 -15
- data/test/spec_auth.rb +0 -57
data/test/spec_webrick.rb
CHANGED
@@ -43,7 +43,7 @@ describe Rack::Handler::WEBrick do
|
|
43
43
|
GET("/test")
|
44
44
|
response["REQUEST_METHOD"].should.equal "GET"
|
45
45
|
response["SCRIPT_NAME"].should.equal "/test"
|
46
|
-
response["REQUEST_PATH"].should.equal "/"
|
46
|
+
response["REQUEST_PATH"].should.equal "/test"
|
47
47
|
response["PATH_INFO"].should.be.equal ""
|
48
48
|
response["QUERY_STRING"].should.equal ""
|
49
49
|
response["test.postdata"].should.equal ""
|
@@ -51,14 +51,14 @@ describe Rack::Handler::WEBrick do
|
|
51
51
|
GET("/test/foo?quux=1")
|
52
52
|
response["REQUEST_METHOD"].should.equal "GET"
|
53
53
|
response["SCRIPT_NAME"].should.equal "/test"
|
54
|
-
response["REQUEST_PATH"].should.equal "/"
|
54
|
+
response["REQUEST_PATH"].should.equal "/test/foo"
|
55
55
|
response["PATH_INFO"].should.equal "/foo"
|
56
56
|
response["QUERY_STRING"].should.equal "quux=1"
|
57
57
|
|
58
58
|
GET("/test/foo%25encoding?quux=1")
|
59
59
|
response["REQUEST_METHOD"].should.equal "GET"
|
60
60
|
response["SCRIPT_NAME"].should.equal "/test"
|
61
|
-
response["REQUEST_PATH"].should.equal "/"
|
61
|
+
response["REQUEST_PATH"].should.equal "/test/foo%25encoding"
|
62
62
|
response["PATH_INFO"].should.equal "/foo%25encoding"
|
63
63
|
response["QUERY_STRING"].should.equal "quux=1"
|
64
64
|
end
|
@@ -68,7 +68,8 @@ describe Rack::Handler::WEBrick do
|
|
68
68
|
status.should.equal 200
|
69
69
|
response["REQUEST_METHOD"].should.equal "POST"
|
70
70
|
response["SCRIPT_NAME"].should.equal "/test"
|
71
|
-
response["REQUEST_PATH"].should.equal "/"
|
71
|
+
response["REQUEST_PATH"].should.equal "/test"
|
72
|
+
response["PATH_INFO"].should.equal ""
|
72
73
|
response["QUERY_STRING"].should.equal ""
|
73
74
|
response["HTTP_X_TEST_HEADER"].should.equal "42"
|
74
75
|
response["test.postdata"].should.equal "rack-form-data=23"
|
@@ -118,5 +119,23 @@ describe Rack::Handler::WEBrick do
|
|
118
119
|
@s.shutdown
|
119
120
|
end
|
120
121
|
|
122
|
+
should "return repeated headers" do
|
123
|
+
@server.mount "/headers", Rack::Handler::WEBrick,
|
124
|
+
Rack::Lint.new(lambda { |req|
|
125
|
+
[
|
126
|
+
401,
|
127
|
+
{ "Content-Type" => "text/plain",
|
128
|
+
"WWW-Authenticate" => "Bar realm=X\nBaz realm=Y" },
|
129
|
+
[""]
|
130
|
+
]
|
131
|
+
})
|
132
|
+
|
133
|
+
Net::HTTP.start(@host, @port) { |http|
|
134
|
+
res = http.get("/headers")
|
135
|
+
res.code.to_i.should.equal 401
|
136
|
+
res["www-authenticate"].should.equal "Bar realm=X, Baz realm=Y"
|
137
|
+
}
|
138
|
+
end
|
139
|
+
|
121
140
|
@server.shutdown
|
122
141
|
end
|
metadata
CHANGED
@@ -1,13 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rack
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
5
|
-
prerelease:
|
4
|
+
hash: 31098185
|
5
|
+
prerelease: 6
|
6
6
|
segments:
|
7
7
|
- 1
|
8
|
-
-
|
9
|
-
-
|
10
|
-
|
8
|
+
- 3
|
9
|
+
- 0
|
10
|
+
- beta
|
11
|
+
version: 1.3.0.beta
|
11
12
|
platform: ruby
|
12
13
|
authors:
|
13
14
|
- Christian Neukirchen
|
@@ -15,7 +16,8 @@ autorequire:
|
|
15
16
|
bindir: bin
|
16
17
|
cert_chain: []
|
17
18
|
|
18
|
-
date:
|
19
|
+
date: 2011-05-03 00:00:00 -07:00
|
20
|
+
default_executable:
|
19
21
|
dependencies:
|
20
22
|
- !ruby/object:Gem::Dependency
|
21
23
|
name: bacon
|
@@ -117,7 +119,6 @@ extensions: []
|
|
117
119
|
|
118
120
|
extra_rdoc_files:
|
119
121
|
- README
|
120
|
-
- SPEC
|
121
122
|
- KNOWN-ISSUES
|
122
123
|
files:
|
123
124
|
- bin/rackup
|
@@ -132,6 +133,7 @@ files:
|
|
132
133
|
- lib/rack/auth/digest/nonce.rb
|
133
134
|
- lib/rack/auth/digest/params.rb
|
134
135
|
- lib/rack/auth/digest/request.rb
|
136
|
+
- lib/rack/backports/uri/common.rb
|
135
137
|
- lib/rack/builder.rb
|
136
138
|
- lib/rack/cascade.rb
|
137
139
|
- lib/rack/chunked.rb
|
@@ -162,6 +164,10 @@ files:
|
|
162
164
|
- lib/rack/methodoverride.rb
|
163
165
|
- lib/rack/mime.rb
|
164
166
|
- lib/rack/mock.rb
|
167
|
+
- lib/rack/multipart/generator.rb
|
168
|
+
- lib/rack/multipart/parser.rb
|
169
|
+
- lib/rack/multipart/uploaded_file.rb
|
170
|
+
- lib/rack/multipart.rb
|
165
171
|
- lib/rack/nulllogger.rb
|
166
172
|
- lib/rack/recursive.rb
|
167
173
|
- lib/rack/reloader.rb
|
@@ -181,7 +187,12 @@ files:
|
|
181
187
|
- lib/rack/urlmap.rb
|
182
188
|
- lib/rack/utils.rb
|
183
189
|
- lib/rack.rb
|
190
|
+
- test/builder/anything.rb
|
191
|
+
- test/builder/comment.ru
|
192
|
+
- test/builder/end.ru
|
193
|
+
- test/builder/options.ru
|
184
194
|
- test/cgi/lighttpd.conf
|
195
|
+
- test/cgi/lighttpd.errors
|
185
196
|
- test/cgi/rackup_stub.rb
|
186
197
|
- test/cgi/sample_rackup.ru
|
187
198
|
- test/cgi/test
|
@@ -190,6 +201,7 @@ files:
|
|
190
201
|
- test/gemloader.rb
|
191
202
|
- test/multipart/bad_robots
|
192
203
|
- test/multipart/binary
|
204
|
+
- test/multipart/content_type_and_no_filename
|
193
205
|
- test/multipart/empty
|
194
206
|
- test/multipart/fail_16384_nofile
|
195
207
|
- test/multipart/file1.txt
|
@@ -203,8 +215,9 @@ files:
|
|
203
215
|
- test/multipart/none
|
204
216
|
- test/multipart/semicolon
|
205
217
|
- test/multipart/text
|
218
|
+
- test/multipart/webkit
|
206
219
|
- test/rackup/config.ru
|
207
|
-
- test/
|
220
|
+
- test/registering_handler/rack/handler/registering_myself.rb
|
208
221
|
- test/spec_auth_basic.rb
|
209
222
|
- test/spec_auth_digest.rb
|
210
223
|
- test/spec_builder.rb
|
@@ -230,6 +243,7 @@ files:
|
|
230
243
|
- test/spec_methodoverride.rb
|
231
244
|
- test/spec_mock.rb
|
232
245
|
- test/spec_mongrel.rb
|
246
|
+
- test/spec_multipart.rb
|
233
247
|
- test/spec_nulllogger.rb
|
234
248
|
- test/spec_recursive.rb
|
235
249
|
- test/spec_request.rb
|
@@ -237,6 +251,8 @@ files:
|
|
237
251
|
- test/spec_rewindable_input.rb
|
238
252
|
- test/spec_runtime.rb
|
239
253
|
- test/spec_sendfile.rb
|
254
|
+
- test/spec_server.rb
|
255
|
+
- test/spec_session_abstract_id.rb
|
240
256
|
- test/spec_session_cookie.rb
|
241
257
|
- test/spec_session_memcache.rb
|
242
258
|
- test/spec_session_pool.rb
|
@@ -256,6 +272,7 @@ files:
|
|
256
272
|
- Rakefile
|
257
273
|
- README
|
258
274
|
- SPEC
|
275
|
+
has_rdoc: true
|
259
276
|
homepage: http://rack.rubyforge.org
|
260
277
|
licenses: []
|
261
278
|
|
@@ -276,21 +293,22 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
276
293
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
277
294
|
none: false
|
278
295
|
requirements:
|
279
|
-
- - "
|
296
|
+
- - ">"
|
280
297
|
- !ruby/object:Gem::Version
|
281
|
-
hash:
|
298
|
+
hash: 25
|
282
299
|
segments:
|
283
|
-
-
|
284
|
-
|
300
|
+
- 1
|
301
|
+
- 3
|
302
|
+
- 1
|
303
|
+
version: 1.3.1
|
285
304
|
requirements: []
|
286
305
|
|
287
306
|
rubyforge_project: rack
|
288
|
-
rubygems_version: 1.
|
307
|
+
rubygems_version: 1.6.2
|
289
308
|
signing_key:
|
290
309
|
specification_version: 3
|
291
310
|
summary: a modular Ruby webserver interface
|
292
311
|
test_files:
|
293
|
-
- test/spec_auth.rb
|
294
312
|
- test/spec_auth_basic.rb
|
295
313
|
- test/spec_auth_digest.rb
|
296
314
|
- test/spec_builder.rb
|
@@ -316,6 +334,7 @@ test_files:
|
|
316
334
|
- test/spec_methodoverride.rb
|
317
335
|
- test/spec_mock.rb
|
318
336
|
- test/spec_mongrel.rb
|
337
|
+
- test/spec_multipart.rb
|
319
338
|
- test/spec_nulllogger.rb
|
320
339
|
- test/spec_recursive.rb
|
321
340
|
- test/spec_request.rb
|
@@ -323,6 +342,8 @@ test_files:
|
|
323
342
|
- test/spec_rewindable_input.rb
|
324
343
|
- test/spec_runtime.rb
|
325
344
|
- test/spec_sendfile.rb
|
345
|
+
- test/spec_server.rb
|
346
|
+
- test/spec_session_abstract_id.rb
|
326
347
|
- test/spec_session_cookie.rb
|
327
348
|
- test/spec_session_memcache.rb
|
328
349
|
- test/spec_session_pool.rb
|
@@ -333,4 +354,3 @@ test_files:
|
|
333
354
|
- test/spec_urlmap.rb
|
334
355
|
- test/spec_utils.rb
|
335
356
|
- test/spec_webrick.rb
|
336
|
-
has_rdoc: true
|
data/test/spec_auth.rb
DELETED
@@ -1,57 +0,0 @@
|
|
1
|
-
require 'rack'
|
2
|
-
|
3
|
-
describe Rack::Auth do
|
4
|
-
it "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
|
-
it "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
|
-
describe Rack::Auth::AbstractRequest do
|
19
|
-
it "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
|
-
it "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
|