perl-modperl mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Octavian Rasnita" <>
Subject Returning 304 Not Modified
Date Wed, 12 Apr 2006 17:20:18 GMT

I am working on a program that should return
HTTP/1.1 304 Not Modified

if the page meets the conditions specified in the browser's request.

(And I might need to return other status codes in the future).

I have made a perl module that does:

my $status = $params->{r}->meets_conditions();

if ($status) {
$params->{r}->custom_response($status, "Pagina nu a fost modificata");

The problems are as follows:

1. The main script returns the Apache::Const constant at the end, and not
the module, and if it returns Apache2::Const::OK as usually, after this
code, the status sent is 200 OK, and not 304 Not Modified.

2. I have tried to put in the main script:

return Apache2::Const::HTTP_NOT_MODIFIED;

After doing this, something strange happends. When the request meets the
conditions, and the 304 status should be printed, it is printed as it
should, and this is OK. If the request doesn't meet the conditions, the
program prints the status 200 OK, and I am wondering why, since the program
returns Apache2::Const::HTTP_NOT_MODIFIED. Also, $status is 0, so that block

$params->{r}->custom_response($status, "Pagina nu a fost modificata");

... is not executed either.

If this code is executed, but the program returns Apache::Const::OK, then it
returns 200 OK, so it seems that block of code has no value.
It seems that I just need returning


without doing anything else, and the program will print the right status
(200 or 304).

Is this true?

Thank you very much.


View raw message