You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by John ORourke <jo...@o-rourke.org> on 2010/04/21 16:40:39 UTC

Pre-processing the request body

Hi folks,

I have a mod-perl app on the receiving end of a POST from a credit card
company, and they are sending the data as application/x-www-form-urlencoded
but they aren't URL-encoding UTF-8 characters.  When I give that malformed
data to Apache2::Request it refuses to see any POST variables atall.

This company generally don't understand charset/header issues, so instead of
going through some pain, I'd like to re-write the request body and the
Content-Length header.

What is the most modperl-like way to do that?

I'm guessing the sort of filter described here
http://perl.apache.org/docs/2.0/user/handlers/filters.html#All_in_One_Filtermight
be best, but has anyone made a wrapper that allows, for example, regex
search+replace on the request body and header-rewriting?

thanks
John

Re: Pre-processing the request body

Posted by Michael Ludwig <mi...@xing.com>.
Am 21.04.2010 um 18:57 schrieb Jeff McCarrell:
> If you are the type that likes to buy books, let me give a shout out to _ mod_perl 2 User's Guide _ by Stas Bekman and Jim Brandt.

I think it's almost identical to the online version:

http://perl.apache.org/docs/2.0/user/index.html

> I notice Ch 6 of that book: Input and Output filters, with subsections:
>   I/O Filtering Concepts
>   ...
>   Writing well-behaved Filters
>   Filter Examples

http://perl.apache.org/docs/2.0/user/handlers/filters.html

-- 
Michael.Ludwig (#) XING.com


Re: Pre-processing the request body

Posted by Jeff McCarrell <jm...@akamai.com>.
Hey John

If you are the type that likes to buy books, let me give a shout out to _
mod_perl 2 User's Guide _ by Stas Bekman and Jim Brandt.
It has helped me a lot to leverage the power available in mp2.

I notice Ch 6 of that book: Input and Output filters, with subsections:
  I/O Filtering Concepts
  ...
  Writing well-behaved Filters
  Filter Examples
I would guess this book would provide all of the concepts, as well as good
pragmatic advice you need to move forward.

HTH,

-- jeff


On 4/21/10 7:40 AM, "John ORourke" <jo...@o-rourke.org> wrote:

> What is the most modperl-like way to do that?  
> 
> I'm guessing the sort of filter described
> here http://perl.apache.org/docs/2.0/user/handlers/filters.html#All_in_One_Fil
> ter might be best, but has anyone made a wrapper that allows, for example,
> regex search+replace on the request body and header-rewriting?