RE: missing mtime in request rec?
> -Original Message- > From: darren chamberlain [mailto:[EMAIL PROTECTED]] > Sent: Wednesday, June 27, 2001 8:28 AM > To: '[EMAIL PROTECTED]' > Subject: Re: missing mtime in request rec? [snip] > > Add a "use Apache::File;" to the top of the module. See p 492 of > the Eagle book; mtime is one of the methods added to the Apache > class when you use Apache::File. well, I know that :) I'm not saying that $r->mtime produces a runtime error (which would happen if I didn't use() Apache::File), but that it returns Jan 1, 1970 for anything that isn't handled by the default Apache handler... #!/usr/bin/perl use Apache::File; use Apache::Util qw(ht_time); my $r = shift; $r->send_http_header('text/plain'); print ht_time($r->mtime), "\n"; print ht_time((stat $r->finfo)[9]), "\n"; in my mind, at least, those two calls ought to be the same. if you insert a call to $r->update_mtime all is ok. but, it would seem that if r->mtime is the modification time of the requested file, r->mtime ought to be set when Apache stats the file and inserts the other finfo stuff. but I'll exchange my logic for proof that not setting mtime is intentional :) --Geoff
Re: missing mtime in request rec?
Geoffrey Young <[EMAIL PROTECTED]> said something to this effect on 06/26/2001: > I did some more digging... > > it seems that any request that is served by the default Apache content > handler is ok - only those that are processed by mod_perl (well, anything > that isn't the default) seem to be affected. > > this doesn't seem quite right to me - if Apache can determine r->filename > and stat the file for r->finfo, then it ought to be setting r->mtime, right? > so maybe somewhere in http_request.c/get_path_info there needs to be a fix? > > or maybe I'm missing some history here... Add a "use Apache::File;" to the top of the module. See p 492 of the Eagle book; mtime is one of the methods added to the Apache class when you use Apache::File. (darren) -- Death to all fanatics!
RE: missing mtime in request rec?
I did some more digging... it seems that any request that is served by the default Apache content handler is ok - only those that are processed by mod_perl (well, anything that isn't the default) seem to be affected. this doesn't seem quite right to me - if Apache can determine r->filename and stat the file for r->finfo, then it ought to be setting r->mtime, right? so maybe somewhere in http_request.c/get_path_info there needs to be a fix? or maybe I'm missing some history here... --Geoff -Original Message- From: Geoffrey Young To: '[EMAIL PROTECTED]' Sent: 6/26/01 2:18 PM Subject: missing mtime in request rec? hi all... can somebody check the results of $r->mtime for me? something like PerlCleanupHandler 'sub {warn "*** time***", Apache::Util::ht_time(shift->mtime)};' ought to do the trick. I have yet to see a case today where that reads other than the start of the epoch. some minmial searching through the Apache code seems to indicate that r->mtime is never populated in the request record, but I am most certainly missing something... I was really trying to get $r->set_last_modified() to work as documented, then traced it back to an empty $r->mtime... thanks... --Geoff