rack 1.6.13 → 2.0.9
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.
- checksums.yaml +4 -4
- data/COPYING +1 -1
- data/HISTORY.md +138 -8
- data/README.rdoc +18 -28
- data/Rakefile +6 -14
- data/SPEC +3 -3
- data/contrib/rack_logo.svg +164 -111
- data/example/protectedlobster.rb +1 -1
- data/example/protectedlobster.ru +1 -1
- data/lib/rack/auth/abstract/request.rb +5 -1
- data/lib/rack/auth/digest/params.rb +2 -3
- data/lib/rack/auth/digest/request.rb +1 -1
- data/lib/rack/body_proxy.rb +14 -9
- data/lib/rack/builder.rb +3 -3
- data/lib/rack/chunked.rb +5 -5
- data/lib/rack/{commonlogger.rb → common_logger.rb} +3 -3
- data/lib/rack/content_length.rb +2 -2
- data/lib/rack/deflater.rb +4 -39
- data/lib/rack/directory.rb +66 -54
- data/lib/rack/etag.rb +5 -4
- data/lib/rack/events.rb +154 -0
- data/lib/rack/file.rb +64 -40
- data/lib/rack/handler/cgi.rb +15 -16
- data/lib/rack/handler/fastcgi.rb +13 -14
- data/lib/rack/handler/lsws.rb +11 -11
- data/lib/rack/handler/scgi.rb +15 -15
- data/lib/rack/handler/thin.rb +3 -0
- data/lib/rack/handler/webrick.rb +24 -26
- data/lib/rack/handler.rb +3 -25
- data/lib/rack/head.rb +15 -17
- data/lib/rack/lint.rb +40 -40
- data/lib/rack/lobster.rb +1 -1
- data/lib/rack/lock.rb +15 -10
- data/lib/rack/logger.rb +2 -2
- data/lib/rack/media_type.rb +38 -0
- data/lib/rack/{methodoverride.rb → method_override.rb} +6 -6
- data/lib/rack/mime.rb +18 -5
- data/lib/rack/mock.rb +36 -54
- data/lib/rack/multipart/generator.rb +5 -5
- data/lib/rack/multipart/parser.rb +270 -157
- data/lib/rack/multipart/uploaded_file.rb +1 -2
- data/lib/rack/multipart.rb +35 -6
- data/lib/rack/{nulllogger.rb → null_logger.rb} +1 -1
- data/lib/rack/query_parser.rb +192 -0
- data/lib/rack/recursive.rb +8 -8
- data/lib/rack/request.rb +394 -305
- data/lib/rack/response.rb +130 -57
- data/lib/rack/rewindable_input.rb +1 -12
- data/lib/rack/runtime.rb +10 -18
- data/lib/rack/sendfile.rb +5 -7
- data/lib/rack/server.rb +30 -23
- data/lib/rack/session/abstract/id.rb +110 -75
- data/lib/rack/session/cookie.rb +24 -17
- data/lib/rack/session/memcache.rb +9 -9
- data/lib/rack/session/pool.rb +8 -8
- data/lib/rack/show_exceptions.rb +386 -0
- data/lib/rack/{showstatus.rb → show_status.rb} +3 -3
- data/lib/rack/static.rb +30 -5
- data/lib/rack/tempfile_reaper.rb +2 -2
- data/lib/rack/urlmap.rb +15 -14
- data/lib/rack/utils.rb +138 -211
- data/lib/rack.rb +70 -21
- data/rack.gemspec +10 -9
- data/test/builder/an_underscore_app.rb +5 -0
- data/test/builder/options.ru +1 -1
- data/test/cgi/test.fcgi +1 -0
- data/test/cgi/test.gz +0 -0
- data/test/helper.rb +34 -0
- data/test/multipart/filename_with_encoded_words +7 -0
- data/test/multipart/filename_with_single_quote +7 -0
- data/test/multipart/quoted +15 -0
- data/test/multipart/rack-logo.png +0 -0
- data/test/multipart/unity3d_wwwform +11 -0
- data/test/registering_handler/rack/handler/registering_myself.rb +1 -1
- data/test/spec_auth_basic.rb +27 -19
- data/test/spec_auth_digest.rb +47 -46
- data/test/spec_body_proxy.rb +27 -27
- data/test/spec_builder.rb +51 -41
- data/test/spec_cascade.rb +24 -22
- data/test/spec_cgi.rb +49 -67
- data/test/spec_chunked.rb +37 -35
- data/test/{spec_commonlogger.rb → spec_common_logger.rb} +23 -21
- data/test/{spec_conditionalget.rb → spec_conditional_get.rb} +29 -28
- data/test/spec_config.rb +3 -2
- data/test/spec_content_length.rb +18 -17
- data/test/spec_content_type.rb +13 -12
- data/test/spec_deflater.rb +85 -49
- data/test/spec_directory.rb +87 -27
- data/test/spec_etag.rb +32 -31
- data/test/spec_events.rb +133 -0
- data/test/spec_fastcgi.rb +50 -72
- data/test/spec_file.rb +120 -77
- data/test/spec_handler.rb +19 -34
- data/test/spec_head.rb +15 -14
- data/test/spec_lint.rb +164 -199
- data/test/spec_lobster.rb +24 -23
- data/test/spec_lock.rb +79 -39
- data/test/spec_logger.rb +4 -3
- data/test/spec_media_type.rb +42 -0
- data/test/{spec_methodoverride.rb → spec_method_override.rb} +34 -35
- data/test/spec_mime.rb +19 -19
- data/test/spec_mock.rb +206 -144
- data/test/spec_multipart.rb +322 -200
- data/test/{spec_nulllogger.rb → spec_null_logger.rb} +5 -4
- data/test/spec_recursive.rb +17 -14
- data/test/spec_request.rb +780 -605
- data/test/spec_response.rb +233 -112
- data/test/spec_rewindable_input.rb +50 -40
- data/test/spec_runtime.rb +11 -10
- data/test/spec_sendfile.rb +30 -35
- data/test/spec_server.rb +78 -52
- data/test/spec_session_abstract_id.rb +11 -33
- data/test/spec_session_abstract_session_hash.rb +45 -0
- data/test/spec_session_cookie.rb +99 -67
- data/test/spec_session_memcache.rb +67 -68
- data/test/spec_session_pool.rb +52 -51
- data/test/{spec_showexceptions.rb → spec_show_exceptions.rb} +23 -28
- data/test/{spec_showstatus.rb → spec_show_status.rb} +36 -35
- data/test/spec_static.rb +71 -32
- data/test/spec_tempfile_reaper.rb +11 -10
- data/test/spec_thin.rb +55 -50
- data/test/spec_urlmap.rb +79 -78
- data/test/spec_utils.rb +441 -346
- data/test/spec_version.rb +2 -8
- data/test/spec_webrick.rb +93 -71
- data/test/static/foo.html +1 -0
- data/test/testrequest.rb +1 -1
- data/test/unregistered_handler/rack/handler/unregistered.rb +1 -1
- data/test/unregistered_handler/rack/handler/unregistered_long_one.rb +1 -1
- metadata +57 -36
- data/KNOWN-ISSUES +0 -44
- data/lib/rack/backports/uri/common_18.rb +0 -56
- data/lib/rack/backports/uri/common_192.rb +0 -52
- data/lib/rack/backports/uri/common_193.rb +0 -29
- data/lib/rack/handler/evented_mongrel.rb +0 -8
- data/lib/rack/handler/mongrel.rb +0 -106
- data/lib/rack/handler/swiftiplied_mongrel.rb +0 -8
- data/lib/rack/showexceptions.rb +0 -387
- data/lib/rack/utils/okjson.rb +0 -600
- data/test/spec_mongrel.rb +0 -182
- /data/lib/rack/{conditionalget.rb → conditional_get.rb} +0 -0
@@ -1,9 +1,10 @@
|
|
1
|
+
require 'minitest/autorun'
|
1
2
|
require 'rack/lint'
|
2
3
|
require 'rack/mock'
|
3
|
-
require 'rack/
|
4
|
+
require 'rack/null_logger'
|
4
5
|
|
5
6
|
describe Rack::NullLogger do
|
6
|
-
|
7
|
+
it "act as a noop logger" do
|
7
8
|
app = lambda { |env|
|
8
9
|
env['rack.logger'].warn "b00m"
|
9
10
|
[200, {'Content-Type' => 'text/plain'}, ["Hello, World!"]]
|
@@ -12,9 +13,9 @@ describe Rack::NullLogger do
|
|
12
13
|
logger = Rack::Lint.new(Rack::NullLogger.new(app))
|
13
14
|
|
14
15
|
res = logger.call(Rack::MockRequest.env_for)
|
15
|
-
res[0..1].
|
16
|
+
res[0..1].must_equal [
|
16
17
|
200, {'Content-Type' => 'text/plain'}
|
17
18
|
]
|
18
|
-
res[2].to_enum.to_a.
|
19
|
+
res[2].to_enum.to_a.must_equal ["Hello, World!"]
|
19
20
|
end
|
20
21
|
end
|
data/test/spec_recursive.rb
CHANGED
@@ -1,8 +1,10 @@
|
|
1
|
+
require 'minitest/autorun'
|
1
2
|
require 'rack/lint'
|
2
3
|
require 'rack/recursive'
|
3
4
|
require 'rack/mock'
|
4
5
|
|
5
6
|
describe Rack::Recursive do
|
7
|
+
before do
|
6
8
|
@app1 = lambda { |env|
|
7
9
|
res = Rack::Response.new
|
8
10
|
res["X-Path-Info"] = env["PATH_INFO"]
|
@@ -29,44 +31,45 @@ describe Rack::Recursive do
|
|
29
31
|
@app4 = lambda { |env|
|
30
32
|
raise Rack::ForwardRequest.new("http://example.org/app1/quux?meh")
|
31
33
|
}
|
32
|
-
|
34
|
+
end
|
35
|
+
|
33
36
|
def recursive(map)
|
34
37
|
Rack::Lint.new Rack::Recursive.new(Rack::URLMap.new(map))
|
35
38
|
end
|
36
39
|
|
37
|
-
|
40
|
+
it "allow for subrequests" do
|
38
41
|
res = Rack::MockRequest.new(recursive("/app1" => @app1,
|
39
42
|
"/app2" => @app2)).
|
40
43
|
get("/app2")
|
41
44
|
|
42
|
-
res.
|
43
|
-
res.body.
|
45
|
+
res.must_be :ok?
|
46
|
+
res.body.must_equal "App2App1"
|
44
47
|
end
|
45
48
|
|
46
|
-
|
49
|
+
it "raise error on requests not below the app" do
|
47
50
|
app = Rack::URLMap.new("/app1" => @app1,
|
48
51
|
"/app" => recursive("/1" => @app1,
|
49
52
|
"/2" => @app2))
|
50
53
|
|
51
54
|
lambda {
|
52
55
|
Rack::MockRequest.new(app).get("/app/2")
|
53
|
-
}.
|
54
|
-
message.
|
56
|
+
}.must_raise(ArgumentError).
|
57
|
+
message.must_match(/can only include below/)
|
55
58
|
end
|
56
59
|
|
57
|
-
|
60
|
+
it "support forwarding" do
|
58
61
|
app = recursive("/app1" => @app1,
|
59
62
|
"/app3" => @app3,
|
60
63
|
"/app4" => @app4)
|
61
64
|
|
62
65
|
res = Rack::MockRequest.new(app).get("/app3")
|
63
|
-
res.
|
64
|
-
res.body.
|
66
|
+
res.must_be :ok?
|
67
|
+
res.body.must_equal "App1"
|
65
68
|
|
66
69
|
res = Rack::MockRequest.new(app).get("/app4")
|
67
|
-
res.
|
68
|
-
res.body.
|
69
|
-
res["X-Path-Info"].
|
70
|
-
res["X-Query-String"].
|
70
|
+
res.must_be :ok?
|
71
|
+
res.body.must_equal "App1"
|
72
|
+
res["X-Path-Info"].must_equal "/quux"
|
73
|
+
res["X-Query-String"].must_equal "meh"
|
71
74
|
end
|
72
75
|
end
|