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 hosts: #{request.env["action_dispatch.blocked_hosts"].join(", ")}")
end

def response(format, body)

def response(format, body)
  [RESPONSE_STATUS,
   { Rack::CONTENT_TYPE => "#{format}; charset=#{Response.default_charset}",
     Rack::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(hosts: request.env["action_dispatch.blocked_hosts"])
  template.render(template: "rescues/blocked_host", layout: "rescues/layout")
end