perl-modperl mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Joshua Chamas <jos...@chamas.com>
Subject Re: Apache::ASP and post-POST redirect
Date Fri, 07 Jul 2000 16:46:16 GMT
Dmitry Beransky wrote:
> 
> Uh, I found what it was!
> 
> After receiving Joshua's email, I experimented some more and while trying
> to get the simplest possible configuration disabled the 'Filter' flag
> (which I had turned on because I used Apache::SSI in conjunction with
> ASP).   And this did the trick.  As soon as filtering was gone, redirects
> started working again.
> 
> Hmm, I don't think I ever mentioned that ASP post-POST redirects just all
> of a sudden stopped working for me.  A browser would send a POST request
> and never get anything back.  The logs showed that the request was
> processed to the point of $Response->Redirect, but nothing would ever come
> out from the other side.  The server was simply closing the connection
> without sending any data back to the client.  I did find a hack that made
> redirects work by replacing ASP's Redirect with the following lines:
> 
>         Apache->print("HTTP/1.0 301 Moved Permanantly\n");
>         Apache->print("Location: http://www.ucsd.edu\n");
>         Apache->print("\n");
>         $Response->Redirect('http://mill.ucsd.edu/index.html');
> 
> (where the last line was simply used to force apache to close the
> connection) This worked as expected.
> 

I bet its an ASP->Apache::Filter issue, because in general
there has been quite a lot with of issues coordinating
between filtered modules on the headers.

Note that in recent versions of Apache::ASP, I have started
to return the 302 status for redirects from the handler 
which might be affecting this behavior.

Also the new $Server->Transfer() feature might make this
issue go away for you too, as it is an internal redirect.

Until I can look at what's causing this, you might want to
just override the *Apache::ASP::Response::Redirect sub 
in your global.asa or so, so you don't have to directly
hacking Apache::ASP

sub Apache::ASP::Response::Redirect {
	my($self, $location) = @_;
         Apache->print("HTTP/1.0 301 Moved Permanantly\n");
         Apache->print("Location: $location\n");
         Apache->print("\n");
        $self->End();
}

--Joshua

> At 08:26 AM 7/7/00, Joshua Chamas wrote:
> 
> >I imagine that if you just do:
> >
> >  $Response->Clear();
> >  $Response->Redirect();
> >
> >you will get what you are going for.  A POST should
> >not follow a redirect.  A redirect at the top of your
> >scripts should likely not need the clear, which is
> >how I tend to use it.  Note with the latest release
> >there is also a $Server->Transfer() which is faster
> >than a redirect, and maybe useful for your needs.
> >
> >[...]
> >
> >>
> >>Dmitry Beransky wrote:
> >> > [...]
> >> > In a mod_perl module, if I want to return a redirect after processing a
> >> > POST, I need to make sure to reset the method to 'GET' and content length
> >> > to 0.  How does Apache::ASP handle this case or, rather, how do I handle
> >> > after POST redirects in ASP?
> >> >

Mime
View raw message