httpd-apreq-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Joe Schaefer <...@sunstarsys.com>
Subject Re: Adding parameters to a request
Date Wed, 20 Jun 2001 19:00:15 GMT
"Rob Bloodgood" <robb@empire2.com> writes:

> OK, I've reviewed the code, looked at the docs, but I'm getting nowhere.
> 
> In my AuthenHandler, I run the following snippet:
> 
> 	# validation successful
> 	$apr->subprocess_env(REMOTE_PASSWORD => $pass);
>       my $args = $apr->args || '';
> 	$apr->args( $args . ( length $args ? '&' : '' ) . "pid=$pid" )
>            unless $args =~ /pid=\d+/;
> 	return OK;
> 
> The intent is to add the parameter 'pid=99' or whatever to the request if it
> is not already present.
> 
> It feels clunky and forced to me... is there a better way to do this?  As
> indicated by the variable, I'm using Apache::Request, for the sole purpose
> of having easier access to the parameters.  Except that it turns out
> Apache::Request's param() method does NOT support *setting* parameters, only
> *getting* them. <sigh>

Sure it does-

  $apr->param(pid => $pid);

will set the parameter, as will

  $apr->param(pid => [$pid]);

they do slightly different things when there's already a pid in
the param table.  It's a bug if that is not what happens.

I would guess that you need to call Apache::Request->instance
instead of Apache::Request->new in your Mason code. The instance
method allows you to work with the same Apache::Request data 
across different phases of the request; new() doesn't.

I think what is happening is that you are making Apache::Request
parse the upload data in the AuthenHandler phase, which evacuates
all data from the pov of the content handler.  Either don't use
Apache::Request in your AuthenHandler, or use Apache::Request->instance 
in your Mason script.

HTH
-- 
Joe Schaefer


Mime
View raw message