[Rails] Duplicate headers

Tim Bates tim at bates.id.au
Thu Nov 11 11:57:24 GMT 2004


Hi folks,
I'm using ruby-GD and Rails to dynamically generate and serve images, as 
follows:

require 'GD'

...

   def image
     g = GD::Image.new(100,100)
     g.colorAllocate(255,255,255)
     red = g.colorAllocate(255,0,0)
     g.line(10,10,90,90,red)

     @headers["Content-Type"] = "image/png"
     render_text g.pngStr
   end

This works just beautifully under ordinary CGI. However, FCGI complains 
about having two "Content-Type" headers. There is only one in the output 
if run under CGI, so Apache must strip out the duplicate, but under FCGI 
it crashes and returns 500 Infernal Server Error instead. Why is the 
(presumably) text/html header not getting replaced?

Tim.

-- 
Tim Bates
tim at bates.id.au


More information about the Rails mailing list