Hi, i'm trying to avoid the "304 Not Modified" status when testing my
updated handlers in localhost. From documentation, i read that phase
PerlHeaderParserHandler is the most adequate to launch handlers when
in Directories scopes to manage HTTP response headers.

My apache directive
--------------------------------------------------------
FileETag None
PerlOptions +ParseHeaders

<Directory /home/blogs/camandules.info>
PerlHeaderParserHandler Blogum::BlogumHeaders::nocache
<Files *.js>
PerlHeaderParserHandler Blogum::BlogumHeaders::cache
</Files>
<Files *.gif>
PerlHeaderParserHandler Blogum::BlogumHeaders::cache
</Files>
<Files *.jpg>
PerlHeaderParserHandler Blogum::BlogumHeaders::cache
</Files>
...
</Directory>
--------------------------------------------------------



And my handler
--------------------------------------------------------
package Blogum::BlogumHeaders;

use Apache2::RequestRec();
use Apache2::RequestIO();
use Apache2::RequestUtil();
use Apache2::ServerUtil();
use Apache2::ServerRec();
use Apache2::Process();
use Apache2::Response();
use APR::Table();
# perhaps too modules?
use Apache2::Const -compile => qw(DECLINED);
use strict;
no strict 'refs';
no strict 'subs';

sub nocache {
        my ($r) = @_;
warn 'STATUS '.$apache->status();
        $r->err_headers_out->add('Pragma' => "no-cache");
        $r->err_headers_out->add('Cache-control' => "max-age=0");
        $r->err_headers_out->add('Cache-control' => "no-cache");
        $r->err_headers_out->add('Cache-control' => "must-revalidate");
        $r->err_headers_out->add('Expires' => "-1");
        return Apache2::Const::DECLINED;
        }
sub cache {
        my ($r) = @_;
        $r->err_headers_out->add('Pragma' => "public");
        $r->err_headers_out->add('Cache-control' => "public");
        return Apache2::Const::DECLINED;
        }
1;
--------------------------------------------------------


Following HTTP headers negotiation with firefox extension "live http
headers", and the warning of my module, i only get warnings in GET
requests with a status of "200" (in logs there is the 200 number as
expected).
The problem is that when i get the "304" status i get no warning, that
therefore means that the handler is not being executed.

In consequence, how can i avoid this status of 304 with modperl? I
don't know why the server is responding with this status (it
shouldn't), but despite this it seems that it cannot be solves with
modperl.




An example of one HTTP headers negotiation:
--------------------------------------------------------
http://localhost/camandules.info/
GET /camandules.info/ HTTP/1.1
Host: localhost
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.12)
Gecko/20051010 Firefox/1.0.7 (Ubuntu package 1.0.7)
Accept: 
text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5
Accept-Language: en-us,en;q=0.5
Accept-Encoding: gzip,deflate
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive: 300
Connection: keep-alive
Cookie: blogum=blogum#1959913555115135510915259521; blogum_counter_sesion=1
If-Modified-Since: Tue, 05 Jul 2005 06:25:08 GMT
If-None-Match: "1bcbb8-ca-25467900"


HTTP/1.x 304 Not Modified
Date: Sun, 13 Nov 2005 19:00:52 GMT
Server: mod-xslt/1.3.8 Apache/2.0.55 (Unix)
mod_apreq2-20050712/2.1.3-dev mod_perl/2.0.1 Perl/v5.8.7
Connection: Keep-Alive
Keep-Alive: timeout=15, max=100
Etag: "1bcbb8-ca-25467900"
Expires: -1
Cache-Control: max-age=0, no-cache, must-revalidate
--------------------------------------------------------

Note: ETAG is still generated although apache directive "FileETag
None" is included



Now forcing the total reload with shift+reload button
--------------------------------------------------------
http://localhost/camandules.info/
GET /camandules.info/ HTTP/1.1
Host: localhost
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.12)
Gecko/20051010 Firefox/1.0.7 (Ubuntu package 1.0.7)
Accept: 
text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5
Accept-Language: en-us,en;q=0.5
Accept-Encoding: gzip,deflate
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive: 300
Connection: keep-alive
Cookie: blogum=blogum#1959913555115135510915259521;
blogum_counter_pages=main#; blogum_counter_sesion=1
Pragma: no-cache
Cache-Control: no-cache


HTTP/1.x 200 OK
Date: Sun, 13 Nov 2005 19:03:36 GMT
Server: mod-xslt/1.3.8 Apache/2.0.55 (Unix)
mod_apreq2-20050712/2.1.3-dev mod_perl/2.0.1 Perl/v5.8.7
Pragma: no-cache
Cache-Control: max-age=0, no-cache, must-revalidate
Expires: -1
Last-Modified: Tue, 05 Jul 2005 06:25:08 GMT
Etag: "1bcbb8-ca-25467900"
Accept-Ranges: bytes
Content-Type: text/html; charset=ISO-8859-1
Vary: Accept-Encoding
Content-Encoding: gzip
Content-Length: 7355
Keep-Alive: timeout=15, max=100
Connection: Keep-Alive
--------------------------------------------------------

Note: Etag values should be different as content has changed, but it is not:
Etag: "1bcbb8-ca-25467900"
Etag: "1bcbb8-ca-25467900"




I don't know if it is a problem with modperl or with apache, but i
need to solve it before the update to the working server. Do you have
any suggestion of what i can test?
Is it something about mp2 or should i resend this to apache mailing list?
Thanks.


Server:
mod-xslt/1.3.8
Apache/2.0.55 (Unix)
mod_apreq2-20050712/2.1.3-dev
mod_perl/2.0.1
Perl/v5.8.7

Reply via email to