This project is archived and is in readonly mode.
Rails 3.0 beta1 send_file with 0 byte
-
fkocherga
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
- State changed from new to invalid
fkocherga is right. Please check for X-Sendfile support.
-
Robert Glaser
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
- 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").readWith 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
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
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...