On Tue, 6 Nov 2007 14:34:25 +1100
Dave Cheney <[EMAIL PROTECTED]> wrote:

> Hi Kirk,
>       
>       I'm wondering if we're being hit by this issue in our application. We  
> generate a lot of thumbnails on the fly and use send_file to transfer  
> the data back to the browsers.
> 
>       Checking the rails docks for send_file it indicates, that unless you  
> use the option :stream => false, the file will be read into a 4096  
> byte buffer and streamed to the client.
> 
>       
> http://api.rubyonrails.com/classes/ActionController/Streaming.html#M000093
> 
>       Is this a bug in send_file?

You souldn't use send_file at all really, because this streams the full file 
into a StringIO so that mongrel can then send the StringIO outside the rails 
lock, and because rails is inconsistent in how it sends headers and the body.

You should be using either x-sendfile or simply redirect to the real image.  If 
you need to auth the images then check out some of the auth-before-redirect 
modules available for various web servers.

-- 
Zed A. Shaw
- Hate: http://savingtheinternetwithhate.com/
- Good: http://www.zedshaw.com/
- Evil: http://yearofevil.com/
_______________________________________________
Mongrel-users mailing list
Mongrel-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/mongrel-users

Reply via email to