I am attempting to send a 404 not found message from an Embperl script. Here
is the code I am trying to use in its simplest form. This is test.html. Note
that it contains no HTML.

[-
  $req_rec->status('404');
  $req_rec->header_out('Content-Length' => undef);
  exit;
-]

Normally, a 404 looks from Apache looks like this:

GET /monkey.html HTTP/1.0

HTTP/1.1 404 Not Found
Date: Thu, 10 Feb 2000 20:43:34 GMT
Server: Apache/1.3.9 (Unix) mod_perl/1.21
Connection: close
Content-Type: text/html

<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<HTML><HEAD>
<TITLE>404 Not Found</TITLE>
</HEAD><BODY>
<H1>Not Found</H1>
The requested URL /monkey.html was not found on this server.<P>
<HR>
<ADDRESS>Apache/1.3.9 Server at sauron.mindsinc.com Port 8386</ADDRESS>
</BODY></HTML>
Connection closed by foreign host.

I left the "Connection closed ..." so we could see where exactly the
documents end.

Here is the output from test.html:

GET /mtn-dev/resources/test.html HTTP/1.0

HTTP/1.1 404 Not Found
Date: Thu, 10 Feb 2000 20:40:17 GMT
Server: Apache/1.3.9 (Unix) mod_perl/1.21
Content-Length: 2
Connection: close
Content-Type: text/html


Connection closed by foreign host.

Oh! So close! But the Content-Length makes the client think that there is
something worth displaying. Both NS and IE show a blank page. What I'd
rather see is the server's error page.

The question: How do I keep Embperl from adding the content length to the
headers when I want to send an error message?

Alan Gutierrez - [EMAIL PROTECTED]

Reply via email to