You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by dorian <do...@foobarsystems.com> on 2004/04/06 22:44:12 UTC

modifying request content

is there any way currently to take the content of a request (say,
from a POST or PUT), modify it an arbitrary way, then somehow put
it back into the request object to make it available to handlers
further down the chain?

thanks in advance

.dorian

-- 
Report problems: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html
List etiquette: http://perl.apache.org/maillist/email-etiquette.html


Re: modifying request content

Posted by Stas Bekman <st...@stason.org>.
Tom Schindl wrote:
> As far as I know not but you could pass information using $r->pnotes(), 
> maybe you could also use
> 
> my $apr = Apache::Request->instance($r);
> 
> In all modules in the chain and use $apr->param() to set/reset different 
> things.

libapreq2 will provide such a service (reusable request data), by any 
component that uses libapreq2, which is a C library, currently having only the 
Perl glue, but more glues are expected in the future (php, tcl, etc.)

> Tom
> 
> dorian wrote:
> 
>> is there any way currently to take the content of a request (say,
>> from a POST or PUT), modify it an arbitrary way, then somehow put
>> it back into the request object to make it available to handlers
>> further down the chain?
>>
>> thanks in advance
>>
>> .dorian
>>
> 
> 


-- 
__________________________________________________________________
Stas Bekman            JAm_pH ------> Just Another mod_perl Hacker
http://stason.org/     mod_perl Guide ---> http://perl.apache.org
mailto:stas@stason.org http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com

-- 
Report problems: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html
List etiquette: http://perl.apache.org/maillist/email-etiquette.html


Re: modifying request content

Posted by dorian <do...@foobarsystems.com>.
> > i'm actually really early on in this project, and could switch over to
> > apache/mod_perl 2 without much fuss and use an input filter.
> 
> That would probably be best if it truly has to be transparent and you
> need to modify content and not just args.

yes, as long as i can trap the entire request body before ferrying
it on to the next handler. the only examples i've seen have been
per-chunk/bucket. the idea was basically to take the content of a
specific POST, reformat it and turn it into a PUT to be handled by
an entirely separate module, that may or may not know about where
to go looking for the content.

thanks for the insight

.d

-- 
Report problems: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html
List etiquette: http://perl.apache.org/maillist/email-etiquette.html


Re: modifying request content

Posted by Perrin Harkins <pe...@elem.com>.
On Wed, 2004-04-07 at 13:04, dorian wrote:
> On Wed, Apr 07, 2004 at 05:08:51PM +0200, Tom Schindl wrote:
> > As far as I know not but you could pass information using $r->pnotes(), 
> > maybe you could also use
> > 
> > my $apr = Apache::Request->instance($r);
> > 
> > In all modules in the chain and use $apr->param() to set/reset different 
> > things.
> 
> yeah, i saw that technique in the cookbook, but i was hoping for
> some way to supplant the modified content back into the request
> object, so that other modules didn't have to be aware.

You can modify $r->args() and others will see it transparently, but you
can't modify $r->content() because it is read from the client.  You
would need to make the other pieces aware that they should read it from
pnotes or call some method you create.

> i'm actually really early on in this project, and could switch over to
> apache/mod_perl 2 without much fuss and use an input filter.

That would probably be best if it truly has to be transparent and you
need to modify content and not just args.

- Perrin


-- 
Report problems: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html
List etiquette: http://perl.apache.org/maillist/email-etiquette.html


Re: modifying request content

Posted by dorian <do...@foobarsystems.com>.
On Wed, Apr 07, 2004 at 05:08:51PM +0200, Tom Schindl wrote:
> As far as I know not but you could pass information using $r->pnotes(), 
> maybe you could also use
> 
> my $apr = Apache::Request->instance($r);
> 
> In all modules in the chain and use $apr->param() to set/reset different 
> things.

yeah, i saw that technique in the cookbook, but i was hoping for
some way to supplant the modified content back into the request
object, so that other modules didn't have to be aware. i'm actually
really early on in this prject, and could switch over to apache/mod_perl
2 without much fuss and use an input filter. it would be slightly
more convenient to use the apache/mod_perl 1.x series but not
critical, hence the post.

cheers

.d

-- 
Report problems: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html
List etiquette: http://perl.apache.org/maillist/email-etiquette.html


Re: modifying request content

Posted by Tom Schindl <to...@gmx.at>.
As far as I know not but you could pass information using $r->pnotes(), 
maybe you could also use

my $apr = Apache::Request->instance($r);

In all modules in the chain and use $apr->param() to set/reset different 
things.

Tom

dorian wrote:
> is there any way currently to take the content of a request (say,
> from a POST or PUT), modify it an arbitrary way, then somehow put
> it back into the request object to make it available to handlers
> further down the chain?
> 
> thanks in advance
> 
> .dorian
> 


-- 
Report problems: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html
List etiquette: http://perl.apache.org/maillist/email-etiquette.html