From 1a52b246eb245d159a1c331417a4b14923e9bc4e Mon Sep 17 00:00:00 2001 From: Pratik Naik Date: Fri, 22 May 2009 00:26:58 +0200 Subject: Add HTTP Authentication to the new base --- actionpack/lib/action_controller/new_base/base.rb | 7 +++++++ actionpack/lib/action_controller/new_base/conditional_get.rb | 2 +- actionpack/lib/action_controller/new_base/renderer.rb | 2 +- 3 files changed, 9 insertions(+), 2 deletions(-) (limited to 'actionpack/lib/action_controller/new_base') diff --git a/actionpack/lib/action_controller/new_base/base.rb b/actionpack/lib/action_controller/new_base/base.rb index 08ffafb27e..b432060bc1 100644 --- a/actionpack/lib/action_controller/new_base/base.rb +++ b/actionpack/lib/action_controller/new_base/base.rb @@ -30,6 +30,8 @@ module ActionController include ActionController::Verification include ActionController::RequestForgeryProtection include ActionController::Streaming + include ActionController::HttpAuthentication::Basic::ControllerMethods + include ActionController::HttpAuthentication::Digest::ControllerMethods # TODO: Extract into its own module # This should be moved together with other normalizing behavior @@ -89,6 +91,11 @@ module ActionController if options.key?(:action) && options[:action].to_s.index("/") options[:template] = options.delete(:action) end + + if options[:status] + options[:status] = interpret_status(options.delete(:status)).to_i + end + options end diff --git a/actionpack/lib/action_controller/new_base/conditional_get.rb b/actionpack/lib/action_controller/new_base/conditional_get.rb index e1407e671a..116ce34494 100644 --- a/actionpack/lib/action_controller/new_base/conditional_get.rb +++ b/actionpack/lib/action_controller/new_base/conditional_get.rb @@ -57,7 +57,7 @@ module ActionController raise ArgumentError, "too few arguments to head" end options = args.extract_options! - status = interpret_status(args.shift || options.delete(:status) || :ok) + status = args.shift || options.delete(:status) || :ok options.each do |key, value| headers[key.to_s.dasherize.split(/-/).map { |v| v.capitalize }.join("-")] = value.to_s diff --git a/actionpack/lib/action_controller/new_base/renderer.rb b/actionpack/lib/action_controller/new_base/renderer.rb index 2a52eedb59..878859f3e6 100644 --- a/actionpack/lib/action_controller/new_base/renderer.rb +++ b/actionpack/lib/action_controller/new_base/renderer.rb @@ -80,7 +80,7 @@ module ActionController def _process_options(options) status, content_type, location = options.values_at(:status, :content_type, :location) - response.status = status.to_i if status + response.status = status if status response.content_type = content_type if content_type response.headers["Location"] = url_for(location) if location end -- cgit v1.2.3