Re: HTTP_NOT_MODIFIED
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: Well, I'm not sure you want to use Apache::exit for the logging purposes. I think that you should generate the header before you print something out... Otherwise what's point? You send something to the browser, it gets flushed and hits the browser, then you tell the browser HTTP_NOT_MODIFIED? Do I miss something? May be this document will be of a better help? http://perl.apache.org/guide/correct_headers.html Anyway, why not to use: print STDERR "some message"; exit(); if you want to stick non-modperl API... (remember that exit is already overloaded in registry scripts) #!/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" HTMLHEADTITLEUntitled Document/TITLE /HEADBODYHello/BODY/HTMLHTTP/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] ___ Stas Bekman mailto:[EMAIL PROTECTED]www.singlesheaven.com/stas Perl,CGI,Apache,Linux,Web,Java,PC at www.singlesheaven.com/stas/TULARC www.apache.org www.perl.com == www.modperl.com || perl.apache.org single o- + single o-+ = singlesheavenhttp://www.singlesheaven.com
HTTP_NOT_MODIFIED
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" HTMLHEADTITLEUntitled Document/TITLE /HEADBODYHello/BODY/HTMLHTTP/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]
Re: HTTP_NOT_MODIFIED
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.) http://perl.apache.org/guide/porting.html#Terminating_requests_and_process 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" HTMLHEADTITLEUntitled Document/TITLE /HEADBODYHello/BODY/HTMLHTTP/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] ___ Stas Bekman mailto:[EMAIL PROTECTED]www.singlesheaven.com/stas Perl,CGI,Apache,Linux,Web,Java,PC at www.singlesheaven.com/stas/TULARC www.apache.org www.perl.com == www.modperl.com || perl.apache.org single o- + single o-+ = singlesheavenhttp://www.singlesheaven.com
Re: HTTP_NOT_MODIFIED
At 12:30 AM 11/24/99 +0200, Stas Bekman wrote: http://perl.apache.org/guide/porting.html#Terminating_requests_and_process Thanks for the reply, Stas. I did read that section of the Guide, but I didn't see what I'm doing wrong to cause the headers to be sent incorrectly, like the example below. Are you saying that I can't call Apache::exit( HTTP_NOT_MODIFIED ) in an Apache::Registry script? 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" HTMLHEADTITLEUntitled Document/TITLE /HEADBODYHello/BODY/HTMLHTTP/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 Bill Moseley mailto:[EMAIL PROTECTED]