make error_message spit out the message text to the user as well as

putting it in the header.
This commit is contained in:
Christopher Schmidt 2008-05-11 23:12:54 +00:00
parent 97cb1fd7fa
commit 322f3d7576

View file

@ -61,7 +61,7 @@ class ApplicationController < ActionController::Base
# phrase from that, we can also put the error message into the status # phrase from that, we can also put the error message into the status
# message. For now, rails won't let us) # message. For now, rails won't let us)
def report_error(message) def report_error(message)
render :nothing => true, :status => :bad_request render :text => message, :status => :bad_request
# Todo: some sort of escaping of problem characters in the message # Todo: some sort of escaping of problem characters in the message
response.headers['Error'] = message response.headers['Error'] = message
end end
@ -72,6 +72,8 @@ private
def get_auth_data def get_auth_data
if request.env.has_key? 'X-HTTP_AUTHORIZATION' # where mod_rewrite might have put it if request.env.has_key? 'X-HTTP_AUTHORIZATION' # where mod_rewrite might have put it
authdata = request.env['X-HTTP_AUTHORIZATION'].to_s.split authdata = request.env['X-HTTP_AUTHORIZATION'].to_s.split
elsif request.env.has_key? 'REDIRECT_X_HTTP_AUTHORIZATION' # mod_fcgi
authdata = request.env['REDIRECT_X_HTTP_AUTHORIZATION'].to_s.split
elsif request.env.has_key? 'HTTP_AUTHORIZATION' # regular location elsif request.env.has_key? 'HTTP_AUTHORIZATION' # regular location
authdata = request.env['HTTP_AUTHORIZATION'].to_s.split authdata = request.env['HTTP_AUTHORIZATION'].to_s.split
end end