Re: cgi.rb: option to omit HTTP header emission

From: Jos Backus <jos@...>
Date: 2004-05-17 03:40:48 UTC
List: ruby-core #2886
On Fri, May 07, 2004 at 02:27:50AM +0900, Jos Backus wrote:
> I'm trying to use cgi.rb to write HTML-only output. This patch adds a
> "noheader" option to CGI.out which forces it to omit the HTTP header. I didn't
> see an easy way to do this differently (my current hack uses StringIO).
> 
> Index: lib/cgi.rb
> ===================================================================
> RCS file: /src/ruby/lib/cgi.rb,v
> retrieving revision 1.74
> diff -u -r1.74 cgi.rb
> --- lib/cgi.rb  18 Apr 2004 23:19:46 -0000      1.74
> +++ lib/cgi.rb  6 May 2004 17:22:08 -0000
> @@ -722,7 +722,7 @@
>      options["length"] = content.length.to_s
>      output = stdoutput
>      output.binmode if defined? output.binmode
> -    output.print header(options)
> +    output.print header(options) unless options.has_key?("noheader")
>      output.print content unless "HEAD" == env_table['REQUEST_METHOD']
>    end

What needs to be done for this patch to become part of the official cgi.rb? If
it is not acceptable in its current form, what can I do to improve it so it
is? I have mailed Wakou Aoyama but not received a response so far.

Regards,
-- 
Jos Backus                       _/  _/_/_/      Sunnyvale, CA
                                _/  _/   _/
                               _/  _/_/_/
                          _/  _/  _/    _/
jos at catnook.com        _/_/   _/_/_/          require 'std/disclaimer'

In This Thread