Skip to content

Commit

Permalink
Removed corner case with HEAD method and Content-Length
Browse files Browse the repository at this point in the history
  • Loading branch information
nusco authored and rkh committed Apr 27, 2011
1 parent 75fe6c5 commit 5d13fab
Showing 1 changed file with 1 addition and 10 deletions.
11 changes: 1 addition & 10 deletions lib/sinatra/base.rb
Expand Up @@ -651,16 +651,7 @@ def call!(env) # :nodoc:
end
end

status, header, body = @response.finish

# On HEAD requests, if the Content-Length is "0", assume
# it was calculated erroneously for a manual HEAD response
# and remove it entirely.
if @env['REQUEST_METHOD'] == 'HEAD'
header.delete('Content-Length') if header['Content-Length'] == '0'
end

[status, header, body]
@response.finish
end

# Access settings defined with Base.set.
Expand Down

0 comments on commit 5d13fab

Please sign in to comment.