Re: can not set param

2002-01-29 Thread Rasoul Hajikhani

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



Re: can not set param

2002-01-29 Thread Geoffrey Young



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 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







Re: can not set param

2002-01-29 Thread Rasoul Hajikhani

Robert Landrum 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);
> 
> I'm guessing that the original reference isn't being preserved.
> 
> Try
> 
> my $save = shift;
> my $r = Apache::Request->new($save);
>

Makes no difference... Still param or args does not set the query string
parameters.
 
> Just as a side note, I never dump these two together...  I always
> keep a seperate $r and $apr, but that's just me.
> 
> Rob
> 
> --
> When I used a Mac, they laughed because I had no command prompt. When
> I used Linux, they laughed because I had no GUI.



Re: can not set param

2002-01-29 Thread clayton cottingham

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.
> 
> Also, $r->parsed_uri->scheme does not return anything back.
> 
> Thanks in advance.
> -r


why not use $r->args  ??
 my %args = $r->args;
then just have to call your queries like
 $args{Members_id_ext}