You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by Gareth Kirwan <gb...@thermeoneurope.com> on 2003/03/04 17:43:42 UTC

internal_redirect and returns

I have a login system based on Apache::AuthCookie.

The handler for a location is set like this:

  AuthType Thermeon::AuthHandler
  AuthName Thermeon
  SetHandler perl-script
  PerlHandler Thermeon::AuthHandler->login

login isn't defined in Thermeon::AuthHandler - so the call passes up the ISA
to Apache::AuthCookie->login, as expected.

login does some funky stuff, calling auth subroutines ... eventually it
will, under some circumstances, do this:
    return $auth_type->login_form;

This might be entirely familiar to everyone - but I thought I'd explain what
I understand is going on so that if you've never seen it before you don't
have to look it up,
or if I've got it wrong you can correct me :D

Now - my system isn't done yet.
It might still want to do some other stuff - under other circumstances.
Most of it's stuff is ok - but I get problems when I want to do an internal
redirect to another page.

I use this subroutine:

sub let_through {
        my ($self, $r, $p) = @_;
        $r->set_handlers( PerlAuthzHandler => [\&OK] );
        $r->set_handlers( PerlAuthenHandler => [\&OK] );
        $p && $r->internal_redirect( $p );
        return OK;
        }

And under some circumstances might call:
    return $self->let_through( $r, $login_page );
for instance.

When this happen I find that the page shows ( $login_page ), but the browser
continues to show loading.
I check the error log and find:
    message type 0x50 arrived from server while idle

If I request the $login_page directly through it's url - it works fine, no
error message and no browser continued loading.

The page that's being loaded does contain an iframe.
The iframe is also subject to the same auth handler - but a line catches it
with an exception and calls $self->let_through( $r ).

The error meass age ( message type 0x50 arrived from server while idle )
shows in the error log after this - if that helps.

Any ideas ?
Thanks

Gareth Kirwan
Programming & Development,
Thermeon Europe Ltd,
gbjk@thermeoneurope.com
Tel: +44 (0) 1293 864 303
Thermeon Europe e-Card: gbjk



-- 
This message has been scanned for viruses and
dangerous content by Thermeon Europe using MailScanner, 
and is believed to be clean.


RE: internal_redirect and returns

Posted by Gareth Kirwan <gb...@thermeoneurope.com>.
Geoff,
	The reason I was using an internal redirect was that I wanted to maintain
the request for the following page.
	The internal_redirect is being called in several circumstances - From
PerlAuthenHandler, PerlAuthzHandler and a PerlHandler for login().

	1) Is there any other way of redirecting to a different page and
maintaining the request.
	2) Should I seeing what I'm getting ?

	Cheers

	Gareth

> -----Original Message-----
> From: Geoffrey Young [mailto:geoff@modperlcookbook.org]
> Sent: 05 March 2003 13:57
> To: gbjk@thermeoneurope.com
> Cc: modperl@perl.apache.org
> Subject: Re: internal_redirect and returns
>
>
> [snip]
> > I use this subroutine:
> >
> > sub let_through {
> >         my ($self, $r, $p) = @_;
> >         $r->set_handlers( PerlAuthzHandler => [\&OK] );
> >         $r->set_handlers( PerlAuthenHandler => [\&OK] );
> >         $p && $r->internal_redirect( $p );
> >         return OK;
> >         }
> >
> > And under some circumstances might call:
> >     return $self->let_through( $r, $login_page );
> > for instance.
> >
> > When this happen I find that the page shows ( $login_page
> ), but the browser
> > continues to show loading.
> > I check the error log and find:
> >     message type 0x50 arrived from server while idle
>
> IIRC, you can only call internal_redirect from a content
> handler.  from your
> code I suspect that you're not doing that, since it would be
> too late to
> unset the auth phases.
>
> HTH
>
> --Geoff
>
>
>



Re: internal_redirect and returns

Posted by Geoffrey Young <ge...@modperlcookbook.org>.
[snip]
> I use this subroutine:
> 
> sub let_through {
>         my ($self, $r, $p) = @_;
>         $r->set_handlers( PerlAuthzHandler => [\&OK] );
>         $r->set_handlers( PerlAuthenHandler => [\&OK] );
>         $p && $r->internal_redirect( $p );
>         return OK;
>         }
> 
> And under some circumstances might call:
>     return $self->let_through( $r, $login_page );
> for instance.
> 
> When this happen I find that the page shows ( $login_page ), but the browser
> continues to show loading.
> I check the error log and find:
>     message type 0x50 arrived from server while idle

IIRC, you can only call internal_redirect from a content handler.  from your 
code I suspect that you're not doing that, since it would be too late to 
unset the auth phases.

HTH

--Geoff