Re: Apache::ASP and post-POST redirect
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?
Re: Apache::ASP and post-POST redirect
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
-Original Message- From: Joshua Chamas [mailto:[EMAIL PROTECTED]] Sent: Friday, July 07, 2000 12:46 PM To: Dmitry Beransky Cc: [EMAIL PROTECTED]; Ken Williams Subject: Re: Apache::ASP and post-POST redirect 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. I haven't really been following this thread, since I don't use asp, but Apache::Filter (1.09?) introduced a new mechanism for sending the headers. basically, it waits to see the first print to STDOUT from the last filter before calling $r-send_http_headers(), whereas previously it was sending headers right at the call to $r-filter_input by the last filter. I don't see how this would make a difference to anyone (except to the positive), though, but I thought I'd bring it up just in case... HTH --Geoff
Re: Apache::ASP and post-POST redirect
Dmitry Beransky wrote: 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: I don't know a thing about Apache::Redirect, but I've had this same problem before: a handler returning REDIRECT after reading POST data would freeze the apache process (it got stuck trying to read the data again). The work-around I used is to set $r-header_in("Content-length", 0) just after reading the POST data. Then, if some cleanup function in apache tries to read it again, it finds that there is none to read. -- Roger Espel Llima, [EMAIL PROTECTED] http://www.iagora.com/~espel/index.html