This project is archived and is in readonly mode.
Rails 3.0 beta1 send_file with 0 byte
Reported by Amar Daxini | February 26th, 2010 @ 07:56 AM
when i am sending any file file is sent to client but size of file size is 0 byte.
Comments and changes to this ticket
-
fkocherga February 28th, 2010 @ 12:29 AM
It appears that Rails begins to rely on 'X-Sendfile' support by the server, you may try to use such kind of server or modify your config.ru file: http://gist.github.com/317072
-
José Valim March 3rd, 2010 @ 08:55 AM
- State changed from new to invalid
fkocherga is right. Please check for X-Sendfile support.
-
Robert Glaser June 25th, 2010 @ 12:47 PM
If you uncomment the line
config.action_dispatch.x_sendfile_header = "X-Sendfile"
in production.rb, send_file will deliver the file normally without passing it to the webserver.
-
mafolz August 2nd, 2010 @ 12:35 PM
- Importance changed from to Low
could it be that the following line 76 from actionpack/lib/action_controller/metal/streaming.rb make the problem?
self.response_body = File.open(path, "rb")
the response_body should include the binary data or? so they should be a .read behind the File.open
self.response_body = File.open(path, "rb").read
With this fix, send_file works for me with rails3.beta4 and the passenger version 2.2.15.
could the zero byte file be a result from serialising the filehandler? -
mail2fish August 13th, 2010 @ 05:10 AM
I have met this problem with rails 3 git and passenger 2.2.15.
Then I comment config.action_dispatch.x_sendfile_header = "X-Sendfile" in production.rb
The send_file is fine.
-
Johan January 19th, 2011 @ 03:06 PM
I had the same problem on rails 3
Thanks to mail2fish, comment config.action_dispatch.x_sendfile_header = "X-Sendfile" in production.rb and now all works fine...
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile »
<h2 style="font-size: 14px">Tickets have moved to Github</h2>
The new ticket tracker is available at <a href="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>