Skip to content
This repository
Browse code

update bundled version of rack before 2.3 final

  • Loading branch information...
commit 572e0aac802334d2029e67eb1e87356d890f4255 1 parent 8970f8a
Joshua Peek authored March 10, 2009
1  actionpack/lib/action_controller/vendor/rack-1.0/rack.rb
@@ -31,6 +31,7 @@ def self.release
31 31
   autoload :CommonLogger, "rack/commonlogger"
32 32
   autoload :ConditionalGet, "rack/conditionalget"
33 33
   autoload :ContentLength, "rack/content_length"
  34
+  autoload :ContentType, "rack/content_type"
34 35
   autoload :File, "rack/file"
35 36
   autoload :Deflater, "rack/deflater"
36 37
   autoload :Directory, "rack/directory"
4  actionpack/lib/action_controller/vendor/rack-1.0/rack/auth/abstract/handler.rb
@@ -8,8 +8,8 @@ class AbstractHandler
8 8
 
9 9
       attr_accessor :realm
10 10
 
11  
-      def initialize(app, &authenticator)
12  
-        @app, @authenticator = app, authenticator
  11
+      def initialize(app, realm=nil, &authenticator)
  12
+        @app, @realm, @authenticator = app, realm, authenticator
13 13
       end
14 14
 
15 15
 
2  actionpack/lib/action_controller/vendor/rack-1.0/rack/auth/digest/md5.rb
@@ -21,7 +21,7 @@ class MD5 < AbstractHandler
21 21
 
22 22
         attr_writer :passwords_hashed
23 23
 
24  
-        def initialize(app)
  24
+        def initialize(*args)
25 25
           super
26 26
           @passwords_hashed = nil
27 27
         end
2  actionpack/lib/action_controller/vendor/rack-1.0/rack/auth/digest/request.rb
@@ -8,7 +8,7 @@ module Digest
8 8
       class Request < Auth::AbstractRequest
9 9
 
10 10
         def method
11  
-          @env['REQUEST_METHOD']
  11
+          @env['rack.methodoverride.original_method'] || @env['REQUEST_METHOD']
12 12
         end
13 13
 
14 14
         def digest?
6  actionpack/lib/action_controller/vendor/rack-1.0/rack/builder.rb
@@ -34,11 +34,7 @@ def self.app(&block)
34 34
     end
35 35
 
36 36
     def use(middleware, *args, &block)
37  
-      @ins << if block_given?
38  
-        lambda { |app| middleware.new(app, *args, &block) }
39  
-      else
40  
-        lambda { |app| middleware.new(app, *args) }
41  
-      end
  37
+      @ins << lambda { |app| middleware.new(app, *args, &block) }
42 38
     end
43 39
 
44 40
     def run(app)
23  actionpack/lib/action_controller/vendor/rack-1.0/rack/content_type.rb
... ...
@@ -0,0 +1,23 @@
  1
+require 'rack/utils'
  2
+
  3
+module Rack
  4
+
  5
+  # Sets the Content-Type header on responses which don't have one.
  6
+  #
  7
+  # Builder Usage:
  8
+  #   use Rack::ContentType, "text/plain"
  9
+  #
  10
+  # When no content type argument is provided, "text/html" is assumed.
  11
+  class ContentType
  12
+    def initialize(app, content_type = "text/html")
  13
+      @app, @content_type = app, content_type
  14
+    end
  15
+
  16
+    def call(env)
  17
+      status, headers, body = @app.call(env)
  18
+      headers = Utils::HeaderHash.new(headers)
  19
+      headers['Content-Type'] ||= @content_type
  20
+      [status, headers.to_hash, body]
  21
+    end
  22
+  end
  23
+end
2  actionpack/lib/action_controller/vendor/rack-1.0/rack/directory.rb
@@ -89,6 +89,8 @@ def list_directory
89 89
         type = stat.directory? ? 'directory' : Mime.mime_type(ext)
90 90
         size = stat.directory? ? '-' : filesize_format(size)
91 91
         mtime = stat.mtime.httpdate
  92
+        url << '/'  if stat.directory?
  93
+        basename << '/'  if stat.directory?
92 94
 
93 95
         @files << [ url, basename, size, type, mtime ]
94 96
       end
7  actionpack/lib/action_controller/vendor/rack-1.0/rack/handler/webrick.rb
@@ -35,7 +35,12 @@ def service(req, res)
35 35
         env["HTTP_VERSION"] ||= env["SERVER_PROTOCOL"]
36 36
         env["QUERY_STRING"] ||= ""
37 37
         env["REQUEST_PATH"] ||= "/"
38  
-        env.delete "PATH_INFO"  if env["PATH_INFO"] == ""
  38
+        if env["PATH_INFO"] == ""
  39
+          env.delete "PATH_INFO"
  40
+        else
  41
+          path, n = req.request_uri.path, env["SCRIPT_NAME"].length
  42
+          env["PATH_INFO"] = path[n, path.length-n]
  43
+        end
39 44
 
40 45
         status, headers, body = @app.call(env)
41 46
         begin
4  actionpack/lib/action_controller/vendor/rack-1.0/rack/lint.rb
@@ -88,7 +88,9 @@ def check_env(env)
88 88
       ##                      within the application. This may be an
89 89
       ##                      empty string, if the request URL targets
90 90
       ##                      the application root and does not have a
91  
-      ##                      trailing slash.
  91
+      ##                      trailing slash. This information should be
  92
+      ##                      decoded by the server if it comes from a
  93
+      ##                      URL.
92 94
 
93 95
       ## <tt>QUERY_STRING</tt>:: The portion of the request URL that
94 96
       ##                         follows the <tt>?</tt>, if any. May be
2  actionpack/lib/action_controller/vendor/rack-1.0/rack/response.rb
@@ -16,6 +16,8 @@ module Rack
16 16
   # Your application's +call+ should end returning Response#finish.
17 17
 
18 18
   class Response
  19
+    attr_accessor :length
  20
+
19 21
     def initialize(body=[], status=200, header={}, &block)
20 22
       @status = status
21 23
       @header = Utils::HeaderHash.new({"Content-Type" => "text/html"}.

0 notes on commit 572e0aa

Please sign in to comment.
Something went wrong with that request. Please try again.