Perrin Harkins <[EMAIL PROTECTED]> wrote on 08/14/2006 07:58:01 PM:
> On Mon, 2006-08-14 at 20:13 -0500, Mark Stosberg wrote:
> > I definitely see a different result. I get just a blank page with this 
test:
> > 
> > #!/usr/bin/perl
> > 
> > use CGI;
> > my $q = new CGI;
> > 
> > print $q->header( -status => '404 Not Found' );
> 
> It may be a legitimate 404 even if it a blank page.  Apache normally
> send some HTML along with the 404 status, which you haven't done here,
> hence the different appearance.
> 
> > In my experience it is "too late" to return a true 404 response in 
CGI, 
> > but is possible in mod_perl, I think.
> 
> It should work with either.  The mod_cgi stuff in Apache is supposed to
> parse the headers from your output to determine what status to send.
> See http://mail-archives.apache.org/mod_mbox/perl-modperl/200403.mbox/%
> [EMAIL PROTECTED] for an explanation from Geoff
> Young.  I don't know how non-Apache servers handle this.

(Not addressing you directly, Perrin.)

---- 8< ----

#!/usr/bin/perl

use CGI;

print CGI->header( -status => '404 Not Found' );
print "Hi";

---- 8< ----

HTTP/1.x 404 Not Found
Date: Tue, 15 Aug 2006 11:40:45 GMT
Server: Apache
Keep-Alive: timeout=15, max=100
Connection: Keep-Alive
Transfer-Encoding: chunked
Content-Type: text/html; charset=ISO-8859-1

---- 8< ----

That's a true 404 if I ever saw one.

If you're having problems setting status codes from a CGI script, try 
using an NPH script.  I don't remember the specifics, but I've needed to 
do that in the past; possibly on an older version of Apache.

Todd

---------------------------------------------------------------------
Web Archive:  http://www.mail-archive.com/[email protected]/
              http://marc.theaimsgroup.com/?l=cgiapp&r=1&w=2
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to