Mod_ruby HEAD message

Is it possible (and sensible) to change cgi.out to handle HEAD messages
with the following;

def out(options = “text/html”)

options = { “type” => options } if options.kind_of?(String)
content = yield

if options.has_key?(“charset”)
require “nkf”
case options[“charset”]
when /iso-2022-jp/ni
content = NKF::nkf(‘-j’, content)
options[“language”] = “ja” unless options.has_key?(“language”)
when /euc-jp/ni
content = NKF::nkf(‘-e’, content)
options[“language”] = “ja” unless options.has_key?(“language”)
when /shift_jis/ni
content = NKF::nkf(‘-s’, content)
options[“language”] = “ja” unless options.has_key?(“language”)
end
end

options[“length”] = content.length.to_s
output = stdoutput
output.binmode if defined? output.binmode
output.print header(options)

exit (Apache::OK) if defined?(MOD_RUBY) && Apache.request.headeronly?
<<
output.print content unless “HEAD” == env_table[‘REQUEST_METHOD’]
end

Rob

I think taht it is not good.

cgi.out(){}
do_something()

If exit() in CGI#out() then not exec do_something().

···

On Wed, Dec 04, 2002 at 06:49:45PM +0900, Rob Blackbourn wrote:

exit (Apache::OK) if defined?(MOD_RUBY) && Apache.request.headeronly?


Wakou Aoyama wakou@ruby-lang.org