ゆんです。
fastcgi.rb(http://fenris.codedogs.ca/~eli/fastcgi.html)と
cgi.rbを一緒に動かすためにquick hackしてみました。
とりあえずはちゃんと動いてるようです。
multiformとかcookieもちゃんと動くのかはまだ試してません。
(たぶんだいじょーぶなよーな気はしますが)。
require 'fastcgi'
require 'cgi'
class << CGI
def remove_params
if (const_defined?(:CGI_PARAMS))
remove_const(:CGI_PARAMS)
remove_const(:CGI_COOKIES)
end
end
end
class FCGI < CGI
def initialize(request, *val)
CGI.remove_params
@request = request
super(*val)
end
def env_table
@request.env
end
def stdinput
@request.in
end
def stdoutput
@request.out
end
end
server = FastCGI::TCP.new('localhost', 9000)
begin
server.each_request do |request|
cgi = FCGI.new(request, 'html3')
cgi.out {
cgi.html {
cgi.body {
'test' + cgi['a'].to_s
}
}
}
request.finish
end
ensure
server.close
end
--
ゆん(岡田 潤)
yun / be-in.org
http://www.be-in.org/~yun/