Permalink
Browse files

Leave HEAD method logic to Rack::Head

Conflicts:

	lib/sinatra/base.rb
  • Loading branch information...
1 parent 5f90f31 commit 75fe6c578401af44ad964f96ee8650c41427e74c @rkh rkh committed Apr 27, 2011
Showing with 4 additions and 4 deletions.
  1. +4 −4 lib/sinatra/base.rb
View
@@ -653,11 +653,10 @@ def call!(env) # :nodoc:
status, header, body = @response.finish
- # Never produce a body on HEAD requests. Do retain the Content-Length
- # unless it's "0", in which case we assume it was calculated erroneously
- # for a manual HEAD response and remove it entirely.
+ # 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'
- body = []
header.delete('Content-Length') if header['Content-Length'] == '0'
end
@@ -1271,6 +1270,7 @@ def build(*args, &bk)
builder.use Rack::MethodOverride if method_override?
builder.use ShowExceptions if show_exceptions?
builder.use Rack::CommonLogger if logging?
+ builder.use Rack::Head
setup_sessions builder
middleware.each { |c,a,b| builder.use(c, *a, &b) }
builder.run new!(*args, &bk)

0 comments on commit 75fe6c5

Please sign in to comment.