Mod_ruby CGI file upload fails because of TypeError?


#1

hi guys,

i have written an ruby script handling fileupload using the regular
Ruby CGI class.


if tmpfile.kind_of?(Tempfile)
print “creating via FileUtils !!”
FileUtils.cp tmpfile.local_path.untaint, filename.untaint
print “i was copied !!”
else
File.open( filename.untaint, “wb”){ |file|
file << tmpfile.read
}
end

when executing the script i get the following strange error (copied
from apaches error.log)

/usr/lib/ruby/1.8/delegate.rb:90: warning: already initialized constant
Delegater
/usr/lib/ruby/1.8/delegate.rb:91: warning: already initialized constant
SimpleDelegater
[Thu Jan 05 22:31:52 2006] [error] mod_ruby: error in ruby
[Thu Jan 05 22:31:52 2006] [error] mod_ruby:
/usr/lib/ruby/1.8/tempfile.rb:12: superclass mismatch for class
Tempfile (TypeError)
[Thu Jan 05 22:31:52 2006] [error] mod_ruby: from
/usr/lib/ruby/1.8/auto-reload.rb:77:in load' [Thu Jan 05 22:31:52 2006] [error] mod_ruby: from /usr/lib/ruby/1.8/auto-reload.rb:77:inrequire’
[Thu Jan 05 22:31:52 2006] [error] mod_ruby: from
/usr/lib/ruby/1.8/cgi.rb:986:in read_multipart' [Thu Jan 05 22:31:52 2006] [error] mod_ruby: from /usr/lib/ruby/1.8/cgi.rb:983:inloop’
[Thu Jan 05 22:31:52 2006] [error] mod_ruby: from
/usr/lib/ruby/1.8/cgi.rb:983:in read_multipart' [Thu Jan 05 22:31:52 2006] [error] mod_ruby: from /usr/lib/ruby/1.8/cgi.rb:1103:ininitialize_query’
[Thu Jan 05 22:31:52 2006] [error] mod_ruby: from
/usr/lib/ruby/1.8/cgi.rb:2269:in initialize' [Thu Jan 05 22:31:52 2006] [error] mod_ruby: from /var/www/ab/import.rbx:5:innew’
[Thu Jan 05 22:31:52 2006] [error] mod_ruby: from
/var/www/ab/import.rbx:5
[Thu Jan 05 22:31:52 2006] [error] mod_ruby: from
/usr/lib/ruby/1.8/apache/ruby-run.rb:53:in load' [Thu Jan 05 22:31:52 2006] [error] mod_ruby: from /usr/lib/ruby/1.8/apache/ruby-run.rb:53:inhandler’

I am using Apache/2.0.54, mod_ruby and Ruby 1.8.2 (2005-04-11) on
Debian Sarge.

can anyone help me out what happens ?

many regards,

lars