Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Leave HEAD method logic to Rack::Head

Conflicts:

	lib/sinatra/base.rb
  • Loading branch information...
commit 75fe6c578401af44ad964f96ee8650c41427e74c 1 parent 5f90f31
@rkh rkh authored
Showing with 4 additions and 4 deletions.
  1. +4 −4 lib/sinatra/base.rb
View
8 lib/sinatra/base.rb
@@ -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)
Please sign in to comment.
Something went wrong with that request. Please try again.