Todd Ross wrote:
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.
To clarify what I meant: I was originally surprised to find that I
couldn't easily return the "normal" 404 page-- the customized one
already configured with Apache with the ErrDoc (sp?) directive.
Neither redirecting to it or returning simply "404" work for that.
As you demonstrate, you can return a /true/ 404 response, it's just that
you have to do some extra work to actually display the same page that
Apache would display. It's not a big deal, though...it should just be
loading a template. It's /realizing/ that's what needs to be done that
took me so long. :)
Mark
---------------------------------------------------------------------
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]