looking for fix to content-length = 1 byte with x_sendfile

I am trying to use sendfile to send files and am using the :x_sendfile => true option. I am experiencing problem that the content length of any file is truncated to 1 byte. The problem appears to be well documented - there is even a fix described here - http://dev.rubyonrails.org/ticket/7643. I migrated my app to Rails 2.1 and still the problem exists.

As a (stopgap) solution you can add this code (to an initializer, lib, environment.rb):

# Does not allow for manually set Content-Length to be overriden (adds

= instead of =)

class ActionController::AbstractResponse   private   def set_content_length!     self.headers["Content-Length"] ||= body.size unless body.respond_to?(:call)   end end

This will use any pre-existing Content-Length first if there is one. reid