class Rack::ShowStatus

def call(env)

def call(env)
  status, headers, body = @app.call(env)
  headers = Utils::HeaderHash[headers]
  empty = headers[CONTENT_LENGTH].to_i <= 0
  # client or server error, or explicit message
  if (status.to_i >= 400 && empty) || env[RACK_SHOWSTATUS_DETAIL]
    # This double assignment is to prevent an "unused variable" warning.
    # Yes, it is dumb, but I don't like Ruby yelling at me.
    req = req = Rack::Request.new(env)
    message = Rack::Utils::HTTP_STATUS_CODES[status.to_i] || status.to_s
    # This double assignment is to prevent an "unused variable" warning.
    # Yes, it is dumb, but I don't like Ruby yelling at me.
    detail = detail = env[RACK_SHOWSTATUS_DETAIL] || message
    body = @template.result(binding)
    size = body.bytesize
    [status, headers.merge(CONTENT_TYPE => "text/html", CONTENT_LENGTH => size.to_s), [body]]
  else
    [status, headers, body]
  end
end

def h(obj) # :nodoc:

:nodoc:
def h(obj)                  # :nodoc:
  case obj
  when String
    Utils.escape_html(obj)
  else
    Utils.escape_html(obj.inspect)
  end
end

def initialize(app)

def initialize(app)
  @app = app
  @template = ERB.new(TEMPLATE)
end