Skip to content

Commit

Permalink
Only serve static files on GET and HEAD.
Browse files Browse the repository at this point in the history
  • Loading branch information
tyler committed Oct 5, 2011
1 parent bd3dcda commit 3d2e3cf
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions lib/rack/static.rb
Expand Up @@ -40,10 +40,14 @@ def initialize(app, options={})
def call(env)
path = env["PATH_INFO"]

unless @urls.kind_of? Hash
can_serve = @urls.any? { |url| path.index(url) == 0 }
if ['GET', 'HEAD'].include?(env["REQUEST_METHOD"])
unless @urls.kind_of? Hash
can_serve = @urls.any? { |url| path.index(url) == 0 }
else
can_serve = @urls.key? path
end
else
can_serve = @urls.key? path
can_sere = false
end

if can_serve
Expand Down

0 comments on commit 3d2e3cf

Please sign in to comment.