Hi,

> Hello again,
>
> > * Viljo Marrandi <[EMAIL PROTECTED]> [2002-05-02 08:57]:
> > > How can I make my system so, that my perl handler is not called for
> > > each image, css and script the page has?
>
> [-- snip --]
>
> >     return DECLINED if $r->content_type && $r->content_type !~ m|^text/|i;
>
> I tried that, but no luck - $r->content_type is just plain empty, don't
> know why. Maybe i can somehow debug or track this content_type and figure
> out, why it's empty? First lines in My::Site look like this:
>
> package My::Site;
>
> use strict;
> use <other_modules>;
>
> sub handler {
>    my $r = shift;
>
>    return DECLINED if $r->content_type && $r->content_type !~ m|^html/|i;
>
> ...
>
> In regexp i changed 'text' to 'html', because css's are text/css type.

I thought $r->content_type was used for the server to set the content
type for a response, not discover it from the request. So it should I
think be empty till set.

Something very similar that I've done before is:

return DECLINED if $r->uri =~ m/\.(jpg|gif|css)$/;

But you'll still need to handle the images somehow - e.g. a standard file
handler after My::Site.

dave



Reply via email to