Mongrel buffers response using streamIO = big problem

I am running a rails app behind Apache2 + Mongrel, and I have a
situation in which I want to use send_file() for downloading of very
large files. However, since mongrel apparently buffers the response
using streamIO before sending it to the client, then clearly send_file
is not a practical means. And it is this situation in which you are to
use the X-Sendfile header instead, to have Apache serve the file
statically. This works fine, if it weren’t for an additional
requirement that my rails app needs to know when the download
finishes.

However using the X-Sendfile header, I won’t have any way to know when
the download finishes (AFAIK). So does anyone know either:

  1. A way to be able to detect when the download finishes using the X-
    Sendfile approach, or
  2. A way to get mongrel to not buffer the response using StreamIO, so
    that I can use the send_file approach (which, I’m assuming, will allow
    me to detect when the download finishes, although I haven’t looked
    into this yet).

Any ideas would be greatly appreciated.

Thanks,

Amir

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs