On Thu, Jul 22, 2010 at 02:43:51PM -0700, Hassan Schroeder wrote:
> On Thu, Jul 22, 2010 at 2:21 PM, Tom Trebisky <[email protected]> wrote:
> 
> > Both discussions above label this as a problem with rails 2.3.8, which I
> > think is erroneous (it looks like mongrel 1.1.5 is the culprit, buy I may
> > be missing the point). ?In any event I am seeing the problem with rails
> > 2.3.5 and mongrel 1.1.5
> >
> > Indeed, when I run my app via script/server then telnet to port 3000, I do
> > get the proper Content-Type header, so this bug is specific to mongrel.
> 
> `script/server` will run mongrel if it's present -- the problem seems to
> be with the mongrel_rails cluster stuff, rather than mongrel itself.
> 
> Maybe a good time to switch to Passenger  :-)

I'll google on passenger in just a minute.

I have my problem fixed now.  What I did was to hack on the file
/usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel/cgi.rb

I added some code to the send_cookies() method, following the lead of
one of the fellows posting in the forums I mentioned,
(note the commented out reference to the uninitialized "options" array
that was, I think, the source of the problem)

---

    def send_cookies(to)
      # convert the cookies based on the myriad of possible ways to set a cookie
      if @head['cookie']
        cookie = @head['cookie']
        case cookie
        when Array
          cookie.each {|c| to['Set-Cookie'] = c.to_s }
        when Hash
          cookie.each_value {|c| to['Set-Cookie'] = c.to_s}
        # TJT code added to fix nasty bug
        when String
          cookies = cookie.split.map { |a| a[-1..-1]==';'?a[0..-2]:a }
          cookies.each do |c|
            if c.split('=').length == 2
              to['Set-Cookie'] = c
            else
              to['Set-Cookie'] = c+'='
            end
          end
        else
          to['Set-Cookie'] = cookie.to_s
        # TJT end of code added
        #else
        #  to['Set-Cookie'] = options['cookie'].to_s
        end

        @head.delete('cookie')
      end

      # @output_cookies seems to never be used, but we'll process it just in 
case
      @output_cookies.each {|c| to['Set-Cookie'] = c.to_s } if @output_cookies
    end


At this point I am happy (and maybe a little wiser) and on to other things

-----

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to