Hello,

I'm asking this question again in a simpler form this time.

Can Apache::exit() be used in an Apache::Registry script?  (My script is
run mod_perl and mod_cgi so I'm trying not to make it contain too much
mod_perl-specific code.)

I'm trying to send a 304 error, but also log a 304 error in the access_log
by calling Apache::exit( HTTP_NOT_MODIFIED ).  But this results in headers
not being properly sent.  Here's a test script:

#!/usr/local/bin/perl5.005 -wT

use Apache;  # for Apache::exit()
use Apache::Constants qw/OK HTTP_NOT_MODIFIED/;

use CGI;

print CGI::header(-status => '304 Same old document'),
      CGI::start_html(),
      'Hello',
      CGI::end_html();

      Apache::exit( HTTP_NOT_MODIFIED );

Calling exit( OK ) works fine, except a 200 is written to the access_log file.
Calling exit( HTTP_NOT_MODIFIED ) writes a 304 to the access_log file, but
returns headers:

HTTP/1.1 304 (Not Modified) Same old document
Connection: close
Date: Tue, 23 Nov 1999 21:12:44 GMT
Server: Apache/1.3.9 (Unix) mod_perl/1.21
Content-Type: text/html
Client-Date: Tue, 23 Nov 1999 21:12:39 GMT
Client-Peer: 169.229.32.30:49322
Title: Untitled Document

<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<HTML><HEAD><TITLE>Untitled Document</TITLE>
</HEAD><BODY>Hello</BODY></HTML>HTTP/1.1 304 Same old document
Date: Tue, 23 Nov 1999 21:12:44 GMT
Server: Apache/1.3.9 (Unix) mod_perl/1.21
Connection: close
X-Pad: avoid browser bug


My httpd.conf:
   <Files test>
        Options +ExecCGI
        SetHandler perl-script
        PerlHandler Apache::Registry
        PerlSendHeader on
    </Files>


Bill Moseley
mailto:[EMAIL PROTECTED]

Reply via email to