[prev in list] [next in list] [prev in thread] [next in thread]
List: apache-modperl
Subject: Re: can not set param
From: Rasoul Hajikhani <rasoul () rhythm ! com>
Date: 2002-01-30 1:10:53
[Download RAW message or body]
Geoffrey Young wrote:
>
> Rasoul Hajikhani wrote:
>
> > Folks,
> > The apache::Request docs indicate that param can be used to set the
> > query string. However,
> > it fails when I do something like this:
> >
> > my $r = Apache::Request->new(shift);
> > ...
> > my $host = $r->hostname;
> > my $uri = $r->uri;
> > my $params = $r->parsed_uri->query;
> > # does not seem to work!?
> > my $scheme = $r->parsed_uri->scheme || 'https';
> > $r->param('previous_uri' => "$scheme://$host$uri");
> > $r->param('q_string' => $params) if ($params);
> > $r->header_out(Location => "http://$host/login");
> > $r->status(REDIRECT);
> > $r->send_http_header;
> > return OK;
> >
> > Can someone tell me why this is failing? I can not get previous_uri or
> > q_string in my login module.
>
> the way you are thinking about it is fundamentally wrong - $r is the
> _current_ request object, so setting $r->param sets query string
> arguments for the current request only.
>
> you need to look into the Apache::URI module, which can be used to
> create
unless ($c->{userId} && $c->{user})
{
my $p_uri = $r->parsed_uri;
my $string = "previous_uri=" . $r->uri .
($r->args() ? "?" . $r->args() : undef);
$p_uri->query($string);
return FORBIDDEN;
}
This still fails to resolve the problem. Unless ofcourse I am not using
the right method.
-r
properly formed URI strings.
>
> >
> > Also, $r->parsed_uri->scheme does not return anything back.
>
> it won't - to create a self-referential URI use Apache::URI->parse($r)
>
> HTH
>
> --Geoff
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic