Re: File downloads when I try mod_perl redirect
- From: monkeyden@xxxxxxxxx
- Date: 29 Aug 2005 07:24:52 -0700
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");
.
- References:
- File downloads when I try mod_perl redirect
- From: Fn***
- File downloads when I try mod_perl redirect
- Prev by Date: Re: system ("cd ..")
- Next by Date: @INC
- Previous by thread: File downloads when I try mod_perl redirect
- Next by thread: alarm and pcap::loop
- Index(es):