Re: File downloads when I try mod_perl redirect




Fn*** wrote:
> Plat: RedHat, Apache1, mod_perl1
>
> I have the following 2 snippets. The first being a sub from a module,
> which redirects. The second being the receiver of the redirect. The
> problem is, when it redirects, it forces the browser to download the
> file, instead of printing the output of script to the screen. When
> this happens, the output is displayed correctly. I also tried sending
> the $r->status(REDIRECT). That didn't do anything but make the
> response slower. Thanks for any input.
>
> #In Redirect module
> sub do_redirect{
> #Take in params
> my ($url, $r) = @_;
> #Get the args from the params
> my $content = $r->method eq "POST" ? $r->content : $r->args;
> #Set the request method to GET
> $r->method("GET");
> $r->method_number(M_GET);
> #Set the typical headers
> $r->headers_in->unset("Content-length");
> $r->content_type("text/html");
> #Add the content to the response
> $r->args($content);
> #Do the redirect
> $r->internal_redirect_handler($url."?".$content);
> }
>
> #Receiver of redirect
> $r = shift;
> $r->content_type("text/plain\n\n");
> $r->print("IN RECEIVER SCRIPT\n\n");
> $r->print("YOUR PARAMS ARE:".$r->args."\n\n");
> $r->print("REQUEST METHOD WAS:".$r->method."\n\n");

.


Quantcast