Zak Mandhro
2006-Mar-14 14:30 UTC
[Rails] Apache2 + FastCGI + SSL: File upload fails with HTTPS
All, I have run into a road block with my RoR project. The app works fine without SSL but when I try to upload a file with the site running in HTTPS, cgi.rb throws an EOFError: [13/Mar/2006:23:05:48 :: 22982] Dispatcher failed to catch: bad content body (EOFError) /usr/lib/ruby/1.8/cgi.rb:981:in `read_multipart? /usr/lib/ruby/gems/1.8/gems/actionpack-1.11.2/lib/action_controller/cgi_ext/raw_post_data_fix.rb:20:in `initialize_query? /usr/lib/ruby/1.8/cgi.rb:2270:in `initialize? (eval):16:in `initialize? /usr/lib/ruby/1.8/fcgi.rb:600:in `each_cgi? /usr/lib/ruby/1.8/fcgi.rb:597:in `each_cgi? /usr/lib/ruby/gems/1.8/gems/rails-1.0.0/lib/fcgi_handler.rb:52:in `process!? /usr/lib/ruby/gems/1.8/gems/rails-1.0.0/lib/fcgi_handler.rb:22:in `process!? /var/www/familygrove/public/dispatch.fcgi:26 almost killed by this error My environment is Ubuntu 6.04, Ruby 1.8.2 and Rails 1.0.0. Here''s the HEAD from cgi.rb read_multipart function: def read_multipart(boundary, content_length) params = Hash.new([]) boundary = "--" + boundary buf = "" bufsize = 10 * 1024 # start multipart/form-data stdinput.binmode if defined? stdinput.binmode boundary_size = boundary.size + EOL.size content_length -= boundary_size status = stdinput.read(boundary_size) if nil == status raise EOFError, "no content body" elsif boundary + EOL != status raise EOFError, "bad content body" end Are there any known issues with HTTPS upload and the above code block? Anyone know of a workaround? Thanks, - Zak -- Posted via http://www.ruby-forum.com/.
Zak Mandhro
2006-Mar-14 14:35 UTC
[Rails] Re: Apache2 + FastCGI + SSL: File upload fails with HTTPS
I saw some posts regarding a similar sounding problem with IE file uploads. I just wanted to add that this problem occurs in IE 6.x as well as Firefox 1.5. -- Posted via http://www.ruby-forum.com/.
Jon Lim
2006-Mar-14 15:51 UTC
[Rails] Apache2 + FastCGI + SSL: File upload fails with HTTPS
I assume you meant 5.04. Are you using fcgid or fastcgi? Jon -- http://www.snowblink.co.uk/
Zak Mandhro
2006-Mar-14 17:04 UTC
[Rails] Re: Apache2 + FastCGI + SSL: File upload fails with HTTPS
Thanks for the reply. Jon Lim wrote:> I assume you meant 5.04.Version 6.04 - Dapper Drake (to be released for production in April)> Are you using fcgid or fastcgi?fcgid. I got it through apt-get. I added fcgid handler in .htaccess. fcgid seems to work just fine, I can run all use cases, with or without SSL. File upload is the only thing that fails, that''s only with SSL on. -- Posted via http://www.ruby-forum.com/.
Jon Lim
2006-Mar-14 17:31 UTC
[Rails] Re: Apache2 + FastCGI + SSL: File upload fails with HTTPS
Hi Zak, I had a similar problem with fcgid on 5.04. I had to switch back to fastcgi because I did not have time to troubleshoot it at that point. I too would be interested to see any alternatives/work arounds, especially as I would like to go to Dapper too when it is has been released. Regards, Jon -- http://www.snowblink.co.uk/
Zak Mandhro
2006-Mar-15 03:31 UTC
[Rails] Re: Re: Apache2 + FastCGI + SSL: File upload fails with HTTP
Jon Lim wrote:> I had a similar problem with fcgid on 5.04. I had to switch back to > fastcgi because I did not have time to troubleshoot it at that point.Thanks Jon. Seems like Dapper has the same issue. I confirmed that the problem is with fcgid, and not cgi.rb. I tried SSL with the default CGI handler, slowness aside, file upload works just fine. Are you using FastCGI with Apache 1.x? What is the easiest way to install FastCGI with Apache2 without using fcgid, is there an apt package? Can you point me in the right direction? Thanks a bunch! - Zak -- Posted via http://www.ruby-forum.com/.