class ActionDispatch::HostAuthorization::DefaultResponseApp

:nodoc:

def available_logger(request)

def available_logger(request)
  request.logger || ActionView::Base.logger
end

def call(env)

def call(env)
  request = Request.new(env)
  format = request.xhr? ? "text/plain" : "text/html"
  log_error(request)
  response(format, response_body(request))
end

def log_error(request)

def log_error(request)
  logger = available_logger(request)
  return unless logger
  logger.error("[#{self.class.name}] Blocked host: #{request.host}")
end

def response(format, body)

def response(format, body)
  [RESPONSE_STATUS,
   { "Content-Type" => "#{format}; charset=#{Response.default_charset}",
     "Content-Length" => body.bytesize.to_s },
   [body]]
end

def response_body(request)

def response_body(request)
  return "" unless request.get_header("action_dispatch.show_detailed_exceptions")
  template = DebugView.new(host: request.host)
  template.render(template: "rescues/blocked_host", layout: "rescues/layout")
end