rack 1.0.1 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of rack might be problematic. Click here for more details.
- data/COPYING +1 -1
- data/KNOWN-ISSUES +3 -0
- data/RDOX +0 -428
- data/README +61 -26
- data/SPEC +8 -1
- data/bin/rackup +2 -174
- data/lib/rack.rb +10 -8
- data/lib/rack/builder.rb +17 -0
- data/lib/rack/cascade.rb +17 -12
- data/lib/rack/chunked.rb +2 -2
- data/lib/rack/commonlogger.rb +31 -43
- data/lib/rack/config.rb +15 -0
- data/lib/rack/content_type.rb +1 -1
- data/lib/rack/directory.rb +6 -2
- data/lib/rack/etag.rb +23 -0
- data/lib/rack/file.rb +4 -2
- data/lib/rack/handler.rb +19 -0
- data/lib/rack/handler/cgi.rb +1 -1
- data/lib/rack/handler/fastcgi.rb +2 -3
- data/lib/rack/handler/lsws.rb +4 -1
- data/lib/rack/handler/mongrel.rb +8 -5
- data/lib/rack/handler/scgi.rb +4 -4
- data/lib/rack/handler/webrick.rb +2 -4
- data/lib/rack/lint.rb +44 -15
- data/lib/rack/logger.rb +20 -0
- data/lib/rack/mime.rb +3 -1
- data/lib/rack/mock.rb +30 -4
- data/lib/rack/nulllogger.rb +18 -0
- data/lib/rack/reloader.rb +4 -1
- data/lib/rack/request.rb +40 -15
- data/lib/rack/response.rb +5 -39
- data/lib/rack/runtime.rb +27 -0
- data/lib/rack/sendfile.rb +142 -0
- data/lib/rack/server.rb +212 -0
- data/lib/rack/session/abstract/id.rb +3 -5
- data/lib/rack/session/cookie.rb +3 -4
- data/lib/rack/session/memcache.rb +53 -43
- data/lib/rack/session/pool.rb +1 -1
- data/lib/rack/urlmap.rb +9 -8
- data/lib/rack/utils.rb +230 -11
- data/rack.gemspec +33 -49
- data/test/spec_rack_cascade.rb +3 -5
- data/test/spec_rack_cgi.rb +3 -3
- data/test/spec_rack_commonlogger.rb +39 -10
- data/test/spec_rack_config.rb +24 -0
- data/test/spec_rack_directory.rb +1 -1
- data/test/spec_rack_etag.rb +17 -0
- data/test/spec_rack_fastcgi.rb +2 -2
- data/test/spec_rack_file.rb +1 -1
- data/test/spec_rack_lint.rb +26 -19
- data/test/spec_rack_logger.rb +21 -0
- data/test/spec_rack_mock.rb +87 -1
- data/test/spec_rack_mongrel.rb +4 -4
- data/test/spec_rack_nulllogger.rb +13 -0
- data/test/spec_rack_request.rb +47 -6
- data/test/spec_rack_response.rb +3 -0
- data/test/spec_rack_runtime.rb +35 -0
- data/test/spec_rack_sendfile.rb +86 -0
- data/test/spec_rack_session_cookie.rb +1 -10
- data/test/spec_rack_session_memcache.rb +53 -20
- data/test/spec_rack_urlmap.rb +30 -0
- data/test/spec_rack_utils.rb +171 -6
- data/test/spec_rack_webrick.rb +4 -4
- data/test/spec_rackup.rb +154 -0
- metadata +37 -79
- data/Rakefile +0 -164
- data/lib/rack/auth/openid.rb +0 -480
- data/test/cgi/lighttpd.conf +0 -20
- data/test/cgi/test +0 -9
- data/test/cgi/test.fcgi +0 -8
- data/test/cgi/test.ru +0 -7
- data/test/multipart/binary +0 -0
- data/test/multipart/empty +0 -10
- data/test/multipart/ie +0 -6
- data/test/multipart/nested +0 -10
- data/test/multipart/none +0 -9
- data/test/multipart/semicolon +0 -6
- data/test/multipart/text +0 -10
- data/test/spec_rack_auth_openid.rb +0 -84
- data/test/testrequest.rb +0 -57
- data/test/unregistered_handler/rack/handler/unregistered.rb +0 -7
- data/test/unregistered_handler/rack/handler/unregistered_long_one.rb +0 -7
data/test/cgi/lighttpd.conf
DELETED
@@ -1,20 +0,0 @@
|
|
1
|
-
server.modules = ("mod_fastcgi", "mod_cgi")
|
2
|
-
server.document-root = "."
|
3
|
-
server.errorlog = "lighttpd.errors"
|
4
|
-
server.port = 9203
|
5
|
-
|
6
|
-
server.event-handler = "select"
|
7
|
-
|
8
|
-
cgi.assign = ("/test" => "",
|
9
|
-
# ".ru" => ""
|
10
|
-
)
|
11
|
-
|
12
|
-
fastcgi.server = ("test.fcgi" => ("localhost" =>
|
13
|
-
("min-procs" => 1,
|
14
|
-
"socket" => "/tmp/rack-test-fcgi",
|
15
|
-
"bin-path" => "test.fcgi")),
|
16
|
-
"test.ru" => ("localhost" =>
|
17
|
-
("min-procs" => 1,
|
18
|
-
"socket" => "/tmp/rack-test-ru-fcgi",
|
19
|
-
"bin-path" => "test.ru")),
|
20
|
-
)
|
data/test/cgi/test
DELETED
data/test/cgi/test.fcgi
DELETED
data/test/cgi/test.ru
DELETED
data/test/multipart/binary
DELETED
Binary file
|
data/test/multipart/empty
DELETED
data/test/multipart/ie
DELETED
data/test/multipart/nested
DELETED
data/test/multipart/none
DELETED
data/test/multipart/semicolon
DELETED
data/test/multipart/text
DELETED
@@ -1,84 +0,0 @@
|
|
1
|
-
require 'test/spec'
|
2
|
-
|
3
|
-
begin
|
4
|
-
# requires the ruby-openid gem
|
5
|
-
require 'rack/auth/openid'
|
6
|
-
|
7
|
-
context "Rack::Auth::OpenID" do
|
8
|
-
OID = Rack::Auth::OpenID
|
9
|
-
host = 'host'
|
10
|
-
subd = 'sub.host'
|
11
|
-
wild = '*.host'
|
12
|
-
path = 'path'
|
13
|
-
long = 'path/long'
|
14
|
-
scheme = 'http://'
|
15
|
-
realm = scheme+host+'/'+path
|
16
|
-
|
17
|
-
specify 'realm uri should be valid' do
|
18
|
-
lambda{OID.new('/'+path)}.should.raise ArgumentError
|
19
|
-
lambda{OID.new('/'+long)}.should.raise ArgumentError
|
20
|
-
lambda{OID.new(scheme+host)}.should.not.raise
|
21
|
-
lambda{OID.new(scheme+host+'/')}.should.not.raise
|
22
|
-
lambda{OID.new(scheme+host+'/'+path)}.should.not.raise
|
23
|
-
lambda{OID.new(scheme+subd)}.should.not.raise
|
24
|
-
lambda{OID.new(scheme+subd+'/')}.should.not.raise
|
25
|
-
lambda{OID.new(scheme+subd+'/'+path)}.should.not.raise
|
26
|
-
end
|
27
|
-
|
28
|
-
specify 'should be able to check if a uri is within the realm' do
|
29
|
-
end
|
30
|
-
|
31
|
-
specify 'return_to should be valid' do
|
32
|
-
uri = '/'+path
|
33
|
-
lambda{OID.new(realm, :return_to=>uri)}.should.raise ArgumentError
|
34
|
-
uri = '/'+long
|
35
|
-
lambda{OID.new(realm, :return_to=>uri)}.should.raise ArgumentError
|
36
|
-
uri = scheme+host
|
37
|
-
lambda{OID.new(realm, :return_to=>uri)}.should.raise ArgumentError
|
38
|
-
uri = scheme+host+'/'+path
|
39
|
-
lambda{OID.new(realm, :return_to=>uri)}.should.not.raise
|
40
|
-
uri = scheme+subd+'/'+path
|
41
|
-
lambda{OID.new(realm, :return_to=>uri)}.should.raise ArgumentError
|
42
|
-
uri = scheme+host+'/'+long
|
43
|
-
lambda{OID.new(realm, :return_to=>uri)}.should.not.raise
|
44
|
-
uri = scheme+subd+'/'+long
|
45
|
-
lambda{OID.new(realm, :return_to=>uri)}.should.raise ArgumentError
|
46
|
-
end
|
47
|
-
|
48
|
-
specify 'extensions should have required constants defined' do
|
49
|
-
badext = Rack::Auth::OpenID::BadExtension
|
50
|
-
ext = Object.new
|
51
|
-
lambda{OID.new(realm).add_extension(ext)}.should.raise(badext)
|
52
|
-
ext = Module.new
|
53
|
-
lambda{OID.new(realm).add_extension(ext)}.should.raise(badext)
|
54
|
-
ext::Request = nil
|
55
|
-
lambda{OID.new(realm).add_extension(ext)}.should.raise(badext)
|
56
|
-
ext::Response = nil
|
57
|
-
lambda{OID.new(realm).add_extension(ext)}.should.raise(badext)
|
58
|
-
ext::NS_URI = nil
|
59
|
-
lambda{OID.new(realm).add_extension(ext)}.should.raise(badext)
|
60
|
-
end
|
61
|
-
|
62
|
-
specify 'extensions should have Request and Response defined and inherit from OpenID::Extension' do
|
63
|
-
$-w, w = nil, $-w # yuck
|
64
|
-
badext = Rack::Auth::OpenID::BadExtension
|
65
|
-
ext = Module.new
|
66
|
-
ext::Request = nil
|
67
|
-
ext::Response = nil
|
68
|
-
ext::NS_URI = nil
|
69
|
-
lambda{OID.new(realm).add_extension(ext)}.should.raise(badext)
|
70
|
-
ext::Request = Class.new()
|
71
|
-
lambda{OID.new(realm).add_extension(ext)}.should.raise(badext)
|
72
|
-
ext::Response = Class.new()
|
73
|
-
lambda{OID.new(realm).add_extension(ext)}.should.raise(badext)
|
74
|
-
ext::Request = Class.new(::OpenID::Extension)
|
75
|
-
lambda{OID.new(realm).add_extension(ext)}.should.raise(badext)
|
76
|
-
ext::Response = Class.new(::OpenID::Extension)
|
77
|
-
lambda{OID.new(realm).add_extension(ext)}.should.raise(badext)
|
78
|
-
$-w = w
|
79
|
-
end
|
80
|
-
end
|
81
|
-
|
82
|
-
rescue LoadError
|
83
|
-
$stderr.puts "Skipping Rack::Auth::OpenID tests (ruby-openid 2 is required). `gem install ruby-openid` and try again."
|
84
|
-
end
|
data/test/testrequest.rb
DELETED
@@ -1,57 +0,0 @@
|
|
1
|
-
require 'yaml'
|
2
|
-
require 'net/http'
|
3
|
-
|
4
|
-
class TestRequest
|
5
|
-
def call(env)
|
6
|
-
status = env["QUERY_STRING"] =~ /secret/ ? 403 : 200
|
7
|
-
env["test.postdata"] = env["rack.input"].read
|
8
|
-
body = env.to_yaml
|
9
|
-
size = body.respond_to?(:bytesize) ? body.bytesize : body.size
|
10
|
-
[status, {"Content-Type" => "text/yaml", "Content-Length" => size.to_s}, [body]]
|
11
|
-
end
|
12
|
-
|
13
|
-
module Helpers
|
14
|
-
attr_reader :status, :response
|
15
|
-
|
16
|
-
def GET(path, header={})
|
17
|
-
Net::HTTP.start(@host, @port) { |http|
|
18
|
-
user = header.delete(:user)
|
19
|
-
passwd = header.delete(:passwd)
|
20
|
-
|
21
|
-
get = Net::HTTP::Get.new(path, header)
|
22
|
-
get.basic_auth user, passwd if user && passwd
|
23
|
-
http.request(get) { |response|
|
24
|
-
@status = response.code.to_i
|
25
|
-
@response = YAML.load(response.body)
|
26
|
-
}
|
27
|
-
}
|
28
|
-
end
|
29
|
-
|
30
|
-
def POST(path, formdata={}, header={})
|
31
|
-
Net::HTTP.start(@host, @port) { |http|
|
32
|
-
user = header.delete(:user)
|
33
|
-
passwd = header.delete(:passwd)
|
34
|
-
|
35
|
-
post = Net::HTTP::Post.new(path, header)
|
36
|
-
post.form_data = formdata
|
37
|
-
post.basic_auth user, passwd if user && passwd
|
38
|
-
http.request(post) { |response|
|
39
|
-
@status = response.code.to_i
|
40
|
-
@response = YAML.load(response.body)
|
41
|
-
}
|
42
|
-
}
|
43
|
-
end
|
44
|
-
end
|
45
|
-
end
|
46
|
-
|
47
|
-
class StreamingRequest
|
48
|
-
def self.call(env)
|
49
|
-
[200, {"Content-Type" => "text/plain"}, new]
|
50
|
-
end
|
51
|
-
|
52
|
-
def each
|
53
|
-
yield "hello there!\n"
|
54
|
-
sleep 5
|
55
|
-
yield "that is all.\n"
|
56
|
-
end
|
57
|
-
end
|