On Fri, 3 Dec 1999, Jason Simms wrote:
> I am having a _really_ strange problem with return() under mod_perl. It
> seems that any time I attempt to do a return REDIRECT after I have accessed
> any passed parameters, the redirect will fail. However, if I do the
> redirect without accessing any passed parameters (either via POST or GET),
> the redirect works fine. I have debugged and debugged, and what I have
> found is that if I create a hash of the passed parameters using $r->content,
> $r->args, or even looping through with CGI::param, and then try and
> redirect, it will fail. The hash does indeed get created (I can loop
> through and output the values fine), but the browser will "hang" right when
> it tries to execute the return REDIRECT. If I do not create the hash, the
> redirect works perfectly. Perhaps some examples would help...:
per
http://perl.apache.org/guide/snippets.html#Reading_POST_Data_then_Redirect:
Reading POST Data, then Redirecting or doing something else
If you read POST data, then redirect, you need to do this before the
redirect or apache will hang:
$r->method_number(M_GET);
$r->method('GET');
$r->headers_in->unset('Content-length');
$r->header_out('Location' => $ENV{SCRIPT_NAME});
$r->status(REDIRECT);
$r->send_http_header;
After the first time you read POST data, you need the code above to
prevent somebody else from trying to read post data that's already
been read.
hth,
ky