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.

Files changed (82) hide show
  1. data/COPYING +1 -1
  2. data/KNOWN-ISSUES +3 -0
  3. data/RDOX +0 -428
  4. data/README +61 -26
  5. data/SPEC +8 -1
  6. data/bin/rackup +2 -174
  7. data/lib/rack.rb +10 -8
  8. data/lib/rack/builder.rb +17 -0
  9. data/lib/rack/cascade.rb +17 -12
  10. data/lib/rack/chunked.rb +2 -2
  11. data/lib/rack/commonlogger.rb +31 -43
  12. data/lib/rack/config.rb +15 -0
  13. data/lib/rack/content_type.rb +1 -1
  14. data/lib/rack/directory.rb +6 -2
  15. data/lib/rack/etag.rb +23 -0
  16. data/lib/rack/file.rb +4 -2
  17. data/lib/rack/handler.rb +19 -0
  18. data/lib/rack/handler/cgi.rb +1 -1
  19. data/lib/rack/handler/fastcgi.rb +2 -3
  20. data/lib/rack/handler/lsws.rb +4 -1
  21. data/lib/rack/handler/mongrel.rb +8 -5
  22. data/lib/rack/handler/scgi.rb +4 -4
  23. data/lib/rack/handler/webrick.rb +2 -4
  24. data/lib/rack/lint.rb +44 -15
  25. data/lib/rack/logger.rb +20 -0
  26. data/lib/rack/mime.rb +3 -1
  27. data/lib/rack/mock.rb +30 -4
  28. data/lib/rack/nulllogger.rb +18 -0
  29. data/lib/rack/reloader.rb +4 -1
  30. data/lib/rack/request.rb +40 -15
  31. data/lib/rack/response.rb +5 -39
  32. data/lib/rack/runtime.rb +27 -0
  33. data/lib/rack/sendfile.rb +142 -0
  34. data/lib/rack/server.rb +212 -0
  35. data/lib/rack/session/abstract/id.rb +3 -5
  36. data/lib/rack/session/cookie.rb +3 -4
  37. data/lib/rack/session/memcache.rb +53 -43
  38. data/lib/rack/session/pool.rb +1 -1
  39. data/lib/rack/urlmap.rb +9 -8
  40. data/lib/rack/utils.rb +230 -11
  41. data/rack.gemspec +33 -49
  42. data/test/spec_rack_cascade.rb +3 -5
  43. data/test/spec_rack_cgi.rb +3 -3
  44. data/test/spec_rack_commonlogger.rb +39 -10
  45. data/test/spec_rack_config.rb +24 -0
  46. data/test/spec_rack_directory.rb +1 -1
  47. data/test/spec_rack_etag.rb +17 -0
  48. data/test/spec_rack_fastcgi.rb +2 -2
  49. data/test/spec_rack_file.rb +1 -1
  50. data/test/spec_rack_lint.rb +26 -19
  51. data/test/spec_rack_logger.rb +21 -0
  52. data/test/spec_rack_mock.rb +87 -1
  53. data/test/spec_rack_mongrel.rb +4 -4
  54. data/test/spec_rack_nulllogger.rb +13 -0
  55. data/test/spec_rack_request.rb +47 -6
  56. data/test/spec_rack_response.rb +3 -0
  57. data/test/spec_rack_runtime.rb +35 -0
  58. data/test/spec_rack_sendfile.rb +86 -0
  59. data/test/spec_rack_session_cookie.rb +1 -10
  60. data/test/spec_rack_session_memcache.rb +53 -20
  61. data/test/spec_rack_urlmap.rb +30 -0
  62. data/test/spec_rack_utils.rb +171 -6
  63. data/test/spec_rack_webrick.rb +4 -4
  64. data/test/spec_rackup.rb +154 -0
  65. metadata +37 -79
  66. data/Rakefile +0 -164
  67. data/lib/rack/auth/openid.rb +0 -480
  68. data/test/cgi/lighttpd.conf +0 -20
  69. data/test/cgi/test +0 -9
  70. data/test/cgi/test.fcgi +0 -8
  71. data/test/cgi/test.ru +0 -7
  72. data/test/multipart/binary +0 -0
  73. data/test/multipart/empty +0 -10
  74. data/test/multipart/ie +0 -6
  75. data/test/multipart/nested +0 -10
  76. data/test/multipart/none +0 -9
  77. data/test/multipart/semicolon +0 -6
  78. data/test/multipart/text +0 -10
  79. data/test/spec_rack_auth_openid.rb +0 -84
  80. data/test/testrequest.rb +0 -57
  81. data/test/unregistered_handler/rack/handler/unregistered.rb +0 -7
  82. data/test/unregistered_handler/rack/handler/unregistered_long_one.rb +0 -7
@@ -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
- )
@@ -1,9 +0,0 @@
1
- #!/usr/bin/env ruby
2
- # -*- ruby -*-
3
-
4
- $: << File.join(File.dirname(__FILE__), "..", "..", "lib")
5
-
6
- require 'rack'
7
- require '../testrequest'
8
-
9
- Rack::Handler::CGI.run(Rack::Lint.new(TestRequest.new))
@@ -1,8 +0,0 @@
1
- #!/usr/bin/env ruby
2
- # -*- ruby -*-
3
-
4
- $:.unshift '../../lib'
5
- require 'rack'
6
- require '../testrequest'
7
-
8
- Rack::Handler::FastCGI.run(Rack::Lint.new(TestRequest.new))
@@ -1,7 +0,0 @@
1
- #!/usr/bin/env ../../bin/rackup
2
- #\ -E deployment -I ../../lib
3
- # -*- ruby -*-
4
-
5
- require '../testrequest'
6
-
7
- run TestRequest.new
Binary file
@@ -1,10 +0,0 @@
1
- --AaB03x
2
- Content-Disposition: form-data; name="submit-name"
3
-
4
- Larry
5
- --AaB03x
6
- Content-Disposition: form-data; name="files"; filename="file1.txt"
7
- Content-Type: text/plain
8
-
9
-
10
- --AaB03x--
@@ -1,6 +0,0 @@
1
- --AaB03x
2
- Content-Disposition: form-data; name="files"; filename="C:\Documents and Settings\Administrator\Desktop\file1.txt"
3
- Content-Type: text/plain
4
-
5
- contents
6
- --AaB03x--
@@ -1,10 +0,0 @@
1
- --AaB03x
2
- Content-Disposition: form-data; name="foo[submit-name]"
3
-
4
- Larry
5
- --AaB03x
6
- Content-Disposition: form-data; name="foo[files]"; filename="file1.txt"
7
- Content-Type: text/plain
8
-
9
- contents
10
- --AaB03x--
@@ -1,9 +0,0 @@
1
- --AaB03x
2
- Content-Disposition: form-data; name="submit-name"
3
-
4
- Larry
5
- --AaB03x
6
- Content-Disposition: form-data; name="files"; filename=""
7
-
8
-
9
- --AaB03x--
@@ -1,6 +0,0 @@
1
- --AaB03x
2
- Content-Disposition: form-data; name="files"; filename="fi;le1.txt"
3
- Content-Type: text/plain
4
-
5
- contents
6
- --AaB03x--
@@ -1,10 +0,0 @@
1
- --AaB03x
2
- Content-Disposition: form-data; name="submit-name"
3
-
4
- Larry
5
- --AaB03x
6
- Content-Disposition: form-data; name="files"; filename="file1.txt"
7
- Content-Type: text/plain
8
-
9
- contents
10
- --AaB03x--
@@ -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
@@ -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
@@ -1,7 +0,0 @@
1
- module Rack
2
- module Handler
3
- # this class doesn't do anything, we're just seeing if we get it.
4
- class Unregistered
5
- end
6
- end
7
- end
@@ -1,7 +0,0 @@
1
- module Rack
2
- module Handler
3
- # this class doesn't do anything, we're just seeing if we get it.
4
- class UnregisteredLongOne
5
- end
6
- end
7
- end