Rhandom has asked for the wisdom of the Perl Monks concerning the following question:

This is probably more of an Apache question - but...

Is there a way inside of a cgi to force Apache to send a 1.0 response rather than a 1.1 reponse. I know that you can add "force-response-1.0" for different browser matches inside the Apache conf files, but I would like to use 1.1 the majority of the time and just use 1.0 on a particular step of a cgi.

Any ideas (Yes I have tried googling and searching perlmonks but haven't found the answer).

my @a=qw(random brilliant braindead); print $a[rand(@a)];

Replies are listed 'Best First'.
Re: Force 1.0 response on Apache
by Kanji (Parson) on Mar 15, 2002 at 18:20 UTC

    If you turn your CGI into one of the no-parsed-header (usually done by naming it with a nph- prefix), then Apache will expect it to return a full set of HTTP headers (protocol and all), which CGI.pm will quite happily generate for you.

        --k.


      Didn't even think of doing it that way. One caveat is this won't work if $ENV{SERVER_PROTOCOL}is set.
      Below is from CGI.pm 2.752
      # Maybe future compatibility. Maybe not. my $protocol = $ENV{SERVER_PROTOCOL} || 'HTTP/1.0';


      -Lee

      "To be civilized is to deny one's nature."
Re: Force 1.0 response on Apache
by shotgunefx (Parson) on Mar 15, 2002 at 18:29 UTC
    I don't think you are going to be abe to do it for just one step of a script, unless the url is unique and predictable at the step. Untested but I believe should work for apache 1.3+ for an entire script.
    SetEnvIf Request_URI "path/to/yourscript.pl$" force-response-1.0


    -Lee

    "To be civilized is to deny one's nature."