summaryrefslogtreecommitdiff
path: root/lib/metropolis/common/ro.rb
blob: c6015df2667692e63b4eae7ade472d8baaa4fc9a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# -*- encoding: binary -*-
module Metropolis::Common::RO
  include Metropolis::Constants

  def call(env)
    if %r{\A/(.*)\z} =~ env[PATH_INFO]
      key = unescape($1)
      case env[REQUEST_METHOD]
      when "GET"
        get(key, env)
      when "HEAD"
        head(key, env)
      else
        r(403)
      end
    else # OPTIONS
      r(405)
    end
  end
end