Ticket #9747: send_accept_charset_header_with_basic_auth.2.diff
| File send_accept_charset_header_with_basic_auth.2.diff, 1.7 kB (added by norbert, 1 year ago) |
|---|
-
actionpack/test/controller/http_authentication_test.rb
old new 2 2 3 3 class HttpBasicAuthenticationTest < Test::Unit::TestCase 4 4 include ActionController::HttpAuthentication::Basic 5 6 cattr_accessor :default_charset 7 @@default_charset = 'utf-8' 5 8 6 9 class DummyController 7 10 attr_accessor :headers, :renders, :request 11 12 cattr_accessor :default_charset 13 @@default_charset = 'utf-8' 8 14 9 15 def initialize 10 16 @headers, @renders = {}, [] … … 43 49 44 50 def test_authentication_request 45 51 authentication_request(@controller, "Megaglobalapp") 52 assert_equal @controller.class.default_charset, @controller.headers["Accept-Charset"] 46 53 assert_equal 'Basic realm="Megaglobalapp"', @controller.headers["WWW-Authenticate"] 47 54 assert_equal :unauthorized, @controller.renders.first[:status] 48 55 end -
actionpack/lib/action_controller/http_authentication.rb
old new 120 120 end 121 121 122 122 def authentication_request(controller, realm) 123 controller.headers["Accept-Charset"] = self.class.default_charset 123 124 controller.headers["WWW-Authenticate"] = %(Basic realm="#{realm.gsub(/"/, "")}") 124 125 controller.send! :render, :text => "HTTP Basic: Access denied.\n", :status => :unauthorized 125 126 return false