Phoenix.pm: mod_perl internal redirect question

intertwingled intertwingled at qwest.net
Wed Jan 8 10:51:31 CST 2003


Wow.  Phoenix.pm still exists! =)


At 08:40 AM 1/8/03 -0700, you wrote:
>Hi all!
>
>This is a question for all you mod_perl experts out there.  I am 
>attempting to do an internal redirect in mod_perl, preserving any POST 
>request parameters that might be kicking around.  I couldn't get the 
>example code I found here:
>
>http://www.esc.auckland.ac.nz/Docs/mod_perl/snippets.html#Redirect_a_POST_r
equest_forward
>
>to work.  It appeared to do the redirect, but wouldn't pass any of the 
>POST parameters.  To complicate matters, I'm using Apache::Request 
>(which is a subclass of Apache) instead of the default Apache object.  I 
>did finally get the redirect to work, but only by building up my own 
>query string and appending it to the URL being redirected to.  This 
>works fine, but I'd really like to know why the other code doesn't work. 
>  The commented out code is the code in question.  The only other change 
>is to remove the appending of the parameters.  Any ideas are appreciated.
>
># redirect #############################################################
>
>sub redirect
>{
>   use Apache::Constants qw(M_GET);
>
>   my $self = shift;
>
>   my %tag_parameter = @_;
>
>   my @parameters;
>
>   foreach my $parameter ($self->request->param)
>   {
>
>     push
>     (
>       @parameters,
>       uri_escape($parameter) .  '=' .
>         uri_escape($self->request->param($parameter))
>     );
>
>   }
>
>   my $parameters = join('&', @parameters);
>
># Don't know why this doesn't work.  Appending parameters to URL below 
>does. ???
>
>#  my $content = $self->request->content;
>#  $self->request->method('GET');
>#  $self->request->method_number(M_GET);
>#  $self->request->headers_in->unset("Content-length");
>#  $self->request->args($parameters);
>#  my $content = $self->request->content;
>
>   $self->
>     request->
>       internal_redirect
>       (
>         $self->normalize_absolute_path("/pcms/$tag_parameter{'url'}") .
>           "?$parameters"
>       );
>
>} # END: redirect
>
>
>

--
even the safest course is fraught with peril




More information about the Phoenix-pm mailing list