Forum: Ruby on Rails Apache2 + FastCGI + SSL: File upload fails with HTTPS

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
49c9c24cf7349be02b40f068db3a9f0e?d=identicon&s=25 Zak Mandhro (zakmandhro)
on 2006-03-14 15:30
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
49c9c24cf7349be02b40f068db3a9f0e?d=identicon&s=25 Zak Mandhro (zakmandhro)
on 2006-03-14 15:35
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.
78d45b303250a077fc65fd61e00277ed?d=identicon&s=25 Jon Lim (Guest)
on 2006-03-14 16:54
(Received via mailing list)
I assume you meant 5.04.

Are you using fcgid or fastcgi?

Jon
--
http://www.snowblink.co.uk/
49c9c24cf7349be02b40f068db3a9f0e?d=identicon&s=25 Zak Mandhro (zakmandhro)
on 2006-03-14 18:04
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.
78d45b303250a077fc65fd61e00277ed?d=identicon&s=25 Jon Lim (Guest)
on 2006-03-14 18:32
(Received via mailing list)
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/
49c9c24cf7349be02b40f068db3a9f0e?d=identicon&s=25 Zak Mandhro (zakmandhro)
on 2006-03-15 04:31
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
This topic is locked and can not be replied to.