#!/usr/bin/ruby require 'cgi' require 'fcgi' def print_env(title,env) str = "#{title}:
\n
\n";
  env.each { |k,v| str<<"#{k}=#{v}\n" }
  str<< "

\n" end count = 0 FCGI.each_cgi do |cgi| count += 1 content = "FastCGI echo

FastCGI echo

\n" content<< sprintf("Request number %d, Process ID: %d

\n", count, Process.pid) content<< print_env("Request environment", cgi.env_table) content<< print_env("Initial environment", ENV) cgi.out{content} end