perl-modperl mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Geoffrey Young <ge...@modperlcookbook.org>
Subject Re: external redirect after internal redirect not working
Date Wed, 22 Mar 2006 20:14:53 GMT


Tom Schindl wrote:
> This means the when the documentation holds information about situation
> where one has to use $r->status(), I would propose that in should add
> the use case of filters.
> 
> This has nothing TODO with your problem I only wanted to point out that
> not all cases where setting $r->status manually are documented there.

you really should never alter $r->status, as apache uses it for internal
bookeeping...

except for registry scripts :)  for registry scripts $r->status is a hack
way of telling registry to 'return REDIRECT' since registry itself can't
trust the value of the cgi script's return code (since it's an emulation
layer).  beneath the hood, however, registry discards the $r->status setting
and sets it back to whatever it was before registry ran:

    # handlers shouldn't set $r->status but return it, so we reset the
    # status after running it
    my $old_status = $self->{REQ}->status;
    my $rc = $self->run;
    my $new_status = $self->{REQ}->status($old_status);
    return ($rc == Apache2::Const::OK && $old_status != $new_status)
        ? $new_status
        : $rc;

Mime
View raw message