From 5689e681e9ec5824de6bc2b667b5bee3920bf91f Mon Sep 17 00:00:00 2001 From: Joshua Peek Date: Tue, 10 Feb 2009 13:18:13 -0600 Subject: Update vendored rack --- actionpack/lib/action_controller/vendor/rack-1.0/rack.rb | 3 ++- .../vendor/rack-1.0/rack/auth/abstract/handler.rb | 13 +++++++++++-- .../lib/action_controller/vendor/rack-1.0/rack/file.rb | 2 ++ .../lib/action_controller/vendor/rack-1.0/rack/lint.rb | 12 ++++++++++++ .../lib/action_controller/vendor/rack-1.0/rack/utils.rb | 11 +++++------ 5 files changed, 32 insertions(+), 9 deletions(-) (limited to 'actionpack') diff --git a/actionpack/lib/action_controller/vendor/rack-1.0/rack.rb b/actionpack/lib/action_controller/vendor/rack-1.0/rack.rb index d2e36b1333..c64bfe4f4d 100644 --- a/actionpack/lib/action_controller/vendor/rack-1.0/rack.rb +++ b/actionpack/lib/action_controller/vendor/rack-1.0/rack.rb @@ -3,7 +3,8 @@ # Rack is freely distributable under the terms of an MIT-style license. # See COPYING or http://www.opensource.org/licenses/mit-license.php. -$:.unshift(File.expand_path(File.dirname(__FILE__))) +$: << File.expand_path(File.dirname(__FILE__)) + # The Rack main module, serving as a namespace for all core Rack # modules and classes. diff --git a/actionpack/lib/action_controller/vendor/rack-1.0/rack/auth/abstract/handler.rb b/actionpack/lib/action_controller/vendor/rack-1.0/rack/auth/abstract/handler.rb index b213eac6f4..8489c9b9c4 100644 --- a/actionpack/lib/action_controller/vendor/rack-1.0/rack/auth/abstract/handler.rb +++ b/actionpack/lib/action_controller/vendor/rack-1.0/rack/auth/abstract/handler.rb @@ -16,11 +16,20 @@ module Rack private def unauthorized(www_authenticate = challenge) - return [ 401, { 'WWW-Authenticate' => www_authenticate.to_s }, [] ] + return [ 401, + { 'Content-Type' => 'text/plain', + 'Content-Length' => '0', + 'WWW-Authenticate' => www_authenticate.to_s }, + [] + ] end def bad_request - [ 400, {}, [] ] + return [ 400, + { 'Content-Type' => 'text/plain', + 'Content-Length' => '0' }, + [] + ] end end diff --git a/actionpack/lib/action_controller/vendor/rack-1.0/rack/file.rb b/actionpack/lib/action_controller/vendor/rack-1.0/rack/file.rb index 44f76297b8..7869227a36 100644 --- a/actionpack/lib/action_controller/vendor/rack-1.0/rack/file.rb +++ b/actionpack/lib/action_controller/vendor/rack-1.0/rack/file.rb @@ -13,6 +13,8 @@ module Rack attr_accessor :root attr_accessor :path + alias :to_path :path + def initialize(root) @root = root end diff --git a/actionpack/lib/action_controller/vendor/rack-1.0/rack/lint.rb b/actionpack/lib/action_controller/vendor/rack-1.0/rack/lint.rb index 53e54955b7..7eb05437f0 100644 --- a/actionpack/lib/action_controller/vendor/rack-1.0/rack/lint.rb +++ b/actionpack/lib/action_controller/vendor/rack-1.0/rack/lint.rb @@ -442,6 +442,18 @@ module Rack ## If the Body responds to #close, it will be called after iteration. # XXX howto: assert("Body has not been closed") { @closed } + + ## + ## If the Body responds to #to_path, it must return a String + ## identifying the location of a file whose contents are identical + ## to that produced by calling #each. + + if @body.respond_to?(:to_path) + assert("The file identified by body.to_path does not exist") { + ::File.exist? @body.to_path + } + end + ## ## The Body commonly is an Array of Strings, the application ## instance itself, or a File-like object. diff --git a/actionpack/lib/action_controller/vendor/rack-1.0/rack/utils.rb b/actionpack/lib/action_controller/vendor/rack-1.0/rack/utils.rb index 5afeba7108..d13a5dfad0 100644 --- a/actionpack/lib/action_controller/vendor/rack-1.0/rack/utils.rb +++ b/actionpack/lib/action_controller/vendor/rack-1.0/rack/utils.rb @@ -50,12 +50,11 @@ module Rack return if k.empty? if after == "" - if cur = params[k] - if cur.is_a?(Array) - params[k] << v - else - params[k] = [cur, v] - end + cur = params[k] + if cur.is_a?(Array) + params[k] << v + elsif cur && name == $1 + params[k] = [cur, v] else params[k] = v end -- cgit v1.2.3