update bundled version of rack before 2.3 final
This commit is contained in:
parent
8970f8ace5
commit
572e0aac80
@ -31,6 +31,7 @@ def self.release
|
||||
autoload :CommonLogger, "rack/commonlogger"
|
||||
autoload :ConditionalGet, "rack/conditionalget"
|
||||
autoload :ContentLength, "rack/content_length"
|
||||
autoload :ContentType, "rack/content_type"
|
||||
autoload :File, "rack/file"
|
||||
autoload :Deflater, "rack/deflater"
|
||||
autoload :Directory, "rack/directory"
|
||||
|
@ -8,8 +8,8 @@ class AbstractHandler
|
||||
|
||||
attr_accessor :realm
|
||||
|
||||
def initialize(app, &authenticator)
|
||||
@app, @authenticator = app, authenticator
|
||||
def initialize(app, realm=nil, &authenticator)
|
||||
@app, @realm, @authenticator = app, realm, authenticator
|
||||
end
|
||||
|
||||
|
||||
|
@ -21,7 +21,7 @@ class MD5 < AbstractHandler
|
||||
|
||||
attr_writer :passwords_hashed
|
||||
|
||||
def initialize(app)
|
||||
def initialize(*args)
|
||||
super
|
||||
@passwords_hashed = nil
|
||||
end
|
||||
|
@ -8,7 +8,7 @@ module Digest
|
||||
class Request < Auth::AbstractRequest
|
||||
|
||||
def method
|
||||
@env['REQUEST_METHOD']
|
||||
@env['rack.methodoverride.original_method'] || @env['REQUEST_METHOD']
|
||||
end
|
||||
|
||||
def digest?
|
||||
|
@ -34,11 +34,7 @@ def self.app(&block)
|
||||
end
|
||||
|
||||
def use(middleware, *args, &block)
|
||||
@ins << if block_given?
|
||||
lambda { |app| middleware.new(app, *args, &block) }
|
||||
else
|
||||
lambda { |app| middleware.new(app, *args) }
|
||||
end
|
||||
@ins << lambda { |app| middleware.new(app, *args, &block) }
|
||||
end
|
||||
|
||||
def run(app)
|
||||
|
23
actionpack/lib/action_controller/vendor/rack-1.0/rack/content_type.rb
vendored
Normal file
23
actionpack/lib/action_controller/vendor/rack-1.0/rack/content_type.rb
vendored
Normal file
@ -0,0 +1,23 @@
|
||||
require 'rack/utils'
|
||||
|
||||
module Rack
|
||||
|
||||
# Sets the Content-Type header on responses which don't have one.
|
||||
#
|
||||
# Builder Usage:
|
||||
# use Rack::ContentType, "text/plain"
|
||||
#
|
||||
# When no content type argument is provided, "text/html" is assumed.
|
||||
class ContentType
|
||||
def initialize(app, content_type = "text/html")
|
||||
@app, @content_type = app, content_type
|
||||
end
|
||||
|
||||
def call(env)
|
||||
status, headers, body = @app.call(env)
|
||||
headers = Utils::HeaderHash.new(headers)
|
||||
headers['Content-Type'] ||= @content_type
|
||||
[status, headers.to_hash, body]
|
||||
end
|
||||
end
|
||||
end
|
@ -89,6 +89,8 @@ def list_directory
|
||||
type = stat.directory? ? 'directory' : Mime.mime_type(ext)
|
||||
size = stat.directory? ? '-' : filesize_format(size)
|
||||
mtime = stat.mtime.httpdate
|
||||
url << '/' if stat.directory?
|
||||
basename << '/' if stat.directory?
|
||||
|
||||
@files << [ url, basename, size, type, mtime ]
|
||||
end
|
||||
|
@ -35,7 +35,12 @@ def service(req, res)
|
||||
env["HTTP_VERSION"] ||= env["SERVER_PROTOCOL"]
|
||||
env["QUERY_STRING"] ||= ""
|
||||
env["REQUEST_PATH"] ||= "/"
|
||||
env.delete "PATH_INFO" if env["PATH_INFO"] == ""
|
||||
if env["PATH_INFO"] == ""
|
||||
env.delete "PATH_INFO"
|
||||
else
|
||||
path, n = req.request_uri.path, env["SCRIPT_NAME"].length
|
||||
env["PATH_INFO"] = path[n, path.length-n]
|
||||
end
|
||||
|
||||
status, headers, body = @app.call(env)
|
||||
begin
|
||||
|
@ -88,7 +88,9 @@ def check_env(env)
|
||||
## within the application. This may be an
|
||||
## empty string, if the request URL targets
|
||||
## the application root and does not have a
|
||||
## trailing slash.
|
||||
## trailing slash. This information should be
|
||||
## decoded by the server if it comes from a
|
||||
## URL.
|
||||
|
||||
## <tt>QUERY_STRING</tt>:: The portion of the request URL that
|
||||
## follows the <tt>?</tt>, if any. May be
|
||||
|
@ -16,6 +16,8 @@ module Rack
|
||||
# Your application's +call+ should end returning Response#finish.
|
||||
|
||||
class Response
|
||||
attr_accessor :length
|
||||
|
||||
def initialize(body=[], status=200, header={}, &block)
|
||||
@status = status
|
||||
@header = Utils::HeaderHash.new({"Content-Type" => "text/html"}.
|
||||
|
Loading…
Reference in New Issue
Block a user