From: Martin Boese Date: 2008-05-10T01:34:46+09:00 Subject: Re: Using Derrick Pallas' ruby fcgi dispatcher No clue, but I suggest you to add some: > $stderr.puts "TEST X: #{cgi.params.inspect}" ...all over that dispatcher script to see where the problem starts (it will log to lighttpd's error log). I also had many problems with fcgi and lighttpd mainly because it was setting different environment variables than other webserver (webrick). To fix this I first modify the environment table before I continue and so far I have no problems: > class CGI > class << self > def fix_env(ec) > if (ec['PATH_INFO'].nil? || ec['PATH_INFO'] == '') then > pi = ec['REQUEST_URI'] > pi = pi[0..(pi.index('?')-1)] if pi.include?('?') > ec['PATH_INFO'] = pi > end > > if (ec['QUERY_STRING'].nil? || ec['QUERY_STRING'] == '') then > ec['QUERY_STRING'] = ec['REQUEST_URI'].include?('?') ? > ec['REQUEST_URI'].scan(/.?\?(.*)/)[0][0] : > "" > end > ec > end > end > end ... and in the dispatcher you do: > FCGI.each_cgi do |cgi| > CGI::fix_env(cgi.env_table) Maybe that helps... Martin On Friday 09 May 2008 12:03:19 Kai Krakow wrote: > I am trying to use the following dispatcher in lighttpd: > http://derrick.pallas.us/ruby-cgi/ > > Code looks fine, and first request looks fine. But subsequent requests > to the dispatcher via the webbrowser do not deliver the query > parameters in cgi.params - it's just empty. I have to restart lighttpd > oder wait for the dispatcher to die to get correct results again. > > Is there something wrong with the dispatcher? Or with my code. Here's > a snippet of my code which is called thru the dispatcher: > > --------------------- > #!/usr/bin/env ruby > > puts cgi.header > > require 'yaml' > require 'rubygems' > require 'active_record' > require 'action_mailer' > > ... > > puts cgi.params.inspect # <-- debug, it's empty on second request > params = cgi.params.select { |q,| %w{system keyword udh smstext > absender time client}.include? q } > params = Hash[*params.flatten] > --------------------- > > Third last line shows the problem... > > Any clues? > > Regards, > Kai