You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by Dmitry Beransky <db...@ucsd.edu> on 2000/07/05 21:51:07 UTC
Apache::ASP and HEAD
Hi,
I remember seen the answer to this some time ago (I may have even asked
this myself), but I couldn't find it in the archives. Can anyone remind me
why Apache::ASP includes a message body in reply to a HEAD request?
Thanks a lot
Dmitry
---
Dmitry Beransky
System Analyst
University of California, San Diego
Multimedia Interactive Learning Lab (http://mill.ucsd.edu)
Re: Apache::ASP and HEAD
Posted by Paul Lindner <pl...@redhat.com>.
On Wed, Jul 05, 2000 at 12:51:07PM -0700, Dmitry Beransky wrote:
> Hi,
>
> I remember seen the answer to this some time ago (I may have even asked
> this myself), but I couldn't find it in the archives. Can anyone remind me
> why Apache::ASP includes a message body in reply to a HEAD request?
Probably because it is just running your script. You need to check
the REQUEST_METHOD variable and branch accordingly.
Same goes for the If-Modified header.
I find the resources at http://www.web-caching.com/ a must read for
anyone doing CGI applications.
--
Paul Lindner
plindner@redhat.com
Red Hat Inc.
Re: Apache::ASP and HEAD
Posted by Joshua Chamas <jo...@chamas.com>.
Dmitry Beransky wrote:
>
> Hi,
>
> I remember seen the answer to this some time ago (I may have even asked
> this myself), but I couldn't find it in the archives. Can anyone remind me
> why Apache::ASP includes a message body in reply to a HEAD request?
>
> Thanks a lot
> Dmitry
In addition to Paul's comment, if you wanted to handle HEAD
for all of your scripts in a certain way, you could do
so in Script_OnStart. If you don't have enough info to
make this happen in %ENV or the $Request->ServerVariables API
then you might get it from the Apache->request->method mod_perl
interface.
-- Joshua
_________________________________________________________________
Joshua Chamas Chamas Enterprises Inc.
NodeWorks >> free web link monitoring Huntington Beach, CA USA
http://www.nodeworks.com 1-714-625-4051
Re: Apache::ASP and post-POST redirect
Posted by Joshua Chamas <jo...@chamas.com>.
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?
> >> >
Re: Apache::ASP and post-POST redirect
Posted by Dmitry Beransky <db...@ucsd.edu>.
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 swear this used to work before with filters on. Did something change in
Apache::Filter?
Thanks
Dmitry
PS I'm running Apache/1.3.12 and mod_perl/1.24 (all hand-compiled) on
RedHat 6.2. Apache::ASP v.0.19 (I did try the newest version, it behaved
the same), Apache::Filter v.1.011 and Apache::SSI v.2.13
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?
>> >