Method: Rack::Directory#check_forbidden

Defined in:
lib/rack/directory.rb

#check_forbidden(path_info) ⇒ Object



97
98
99
100
101
102
103
104
105
# File 'lib/rack/directory.rb', line 97

def check_forbidden(path_info)
  return unless path_info.include? ".."

  body = "Forbidden\n"
  size = body.bytesize
  return [403, { CONTENT_TYPE => "text/plain",
    CONTENT_LENGTH => size.to_s,
    "X-Cascade" => "pass" }, [body]]
end