FastCGI and Ruby (not Rails!)

apps

#1

Ok, I’ve just set up a test domain and enabled FastCGI from the panel. I’ve confirmed that FastCGI is running my dispatch.fcgi, but I’ve run into a problem I can’t solve.

My log file reads:[Thu Apr 30 17:25:13 2009] [error] [client 65.116.251.178] FastCGI: comm with (dynamic) server "/home/greyfade/test.example.org/dispatch.fcgi" aborted: (first read) idle timeout (60 sec) [Thu Apr 30 17:25:13 2009] [error] [client 65.116.251.178] FastCGI: incomplete headers (0 bytes) received from server "/home/greyfade/test.example.org/dispatch.fcgi" The script in question is pretty simple:

[code]#!/usr/bin/ruby
require ‘fcgi’

FCGI.each_cgi {|cgi|
puts cgi.header(“text/html”)
puts "

"
puts "testing"
puts “

}
[/code]
But it never sends headers. Running the script at the command-line just freezes, and any input causes the script to quit and hang somewhere inside the each method. Even this simple example doesn’t work:

[code]#!/usr/bin/ruby
require ‘fcgi’

FCGI.each {|req|
req.out.print "Content-Type: text/plain\r\n\r\n"
req.out.print “test\r\n”
}
[/code]
On the rare instances I can get it to work on another server, copying the file to DH still results in the same problem I’ve been having.

Is FCGI a broken pile of feces, or am I really doing something wrong, as DH support suggests?