That looks ok to me.  Is there a ResponseHandler as well for the
gallery, or just the AccessHandler?

The symptoms you're describing seem like OK is getting returned when no
content has been printed.  Do you know if headers are even getting sent
with these requests?

adam


-----Original Message-----
From: foobar [mailto:[EMAIL PROTECTED] 
Sent: Monday, April 02, 2007 11:00 AM
To: modperl@perl.apache.org
Subject: Re: mod_perl2 handler headache




Perrin Harkins-3 wrote:
> 
> On 4/2/07, foobar <[EMAIL PROTECTED]> wrote:
>> I'm not sure if this is a configuration problem or a design fault. I
can
>> see
>> that both handlers are called but why my image file length is zero
bytes
>> is
>> beyond me.
> 
> Sounds like a problem in the access handler code.  Can you show it to
us?
> 
> - Perrin
> 
> 

Sure, I'm pretty new to this so it may well be the case I have done
something really stupid here. If it helps, this was working before I
moved
the site to a named virtual host... anyway, here is the handler:

sub handler {
    my $r = shift;
    my $uri = $r->uri;

    my $gallery_root = $MySite::Global::GALLERY_ROOT;
    my $thumbdir     = $MySite::Global::GALLERY_THUMB_DIR;
    my $publicdir    = $MySite::Global::GALLERY_PUBLIC_DIR;
    my $privatedir   = $MySite::Global::GALLERY_PRIVATE_DIR;

    # if user is requesting public images or thumbs its all good :)
    if ($uri =~ /^$gallery_root\/($publicdir|$thumbdir)\//) {
        warn "Access OK"; # we're definitely getting here according to
the
logs
        return OK;
    }


    # othewrwise we need to check they are allowed to view the gallery
    # they requested
    return FORBIDDEN unless $r->pnotes('member');

    if ($uri =~ /^$gallery_root\/$privatedir\/(.+)/) {

        my ($date, $gallery_id,$imagefile) = split ('/', $1, 3);

        if (! $date || ! $gallery_id || ! $imagefile) {
            return FORBIDDEN;
        }

        # if users account type is good to view this gallery return OK
        return OK if
$r->pnotes('member')->can_view_gallery($gallery_id);
    }

    # catch everything else
    return FORBIDDEN;
}

-- 
View this message in context:
http://www.nabble.com/mod_perl2-handler-headache-tf3506042.html#a9792465
Sent from the mod_perl - General mailing list archive at Nabble.com.

Reply via email to