Nick Tonkin wrote:
Hi Ric,

This has been a nightmare trying to debug, but I think I've found where
the cause is in my module.

In my Access handler I have some code designed to skip Access handling for
images (let the html pages take care of that). The code calls
$r->lookup_uri to check on the content type of the file being requested,
which, according to the mod_perl cookbook, forces the subrequest back
through the Access and Auth stages (recipe 3.15, pp. 114-116).


if ($r->lookup_uri($r->uri)->content_type =~ /image/) { return Apache::DECLINED; }


that seems like a lot of processing in this particular case - I'd be more tempted to use that for _other_ URIs rather than the current URI. isn't it just easier to not configure your access handler for image directories? though I suppose that you have a reason for doing it like you are :)


as an aside, if you're using mod_perl 1.0 and feeling adventuresome, you can actually call mod_mime's MIME checker routine on demand, then check $r->content_type on the current request. see recipe 8.9 in the cookbook, or the code

http://www.modperlcookbook.org/code/ch08/Cookbook/MIMEMagic.pm

:)

oh, and I suppose that you could always use the

File::MMagic->new->checktype_filename($r->filename)

bit instead of the full lookup as well and still come out ahead.

--Geoff



Reply via email to