Pre-processing the request body

--001636c934c58e43540484c02dbe
Content-Type: text/plain; charset=ISO-8859-1

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#A ll_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

--001636c934c58e43540484c02dbe
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable

Hi folks,<div><br></div><div>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 applica=
tion/x-www-form-urlencoded but they aren't URL-encoding UTF-8 character=
s. =A0When I give that malformed data to Apache2::Request it refuses to see=
any POST variables atall.</div>
<div><br></div><div>This company generally don't understand charset/hea=
der issues, so instead of going through some pain, I'd like to re-write=
the request body and the Content-Length header.</div><div><br></div><div>
What is the most modperl-like way to do that? =A0</div><div><br></div><div>=
I'm guessing the sort of filter described here=A0<a href=3D"http://perl=
..apache.org/docs/2.0/user/handlers/filters.html#All_in_One_ Filter">http://p=
erl.apache.org/docs/2.0/user/handlers/filters.html#All_in_On e_Filter</a> mi=
ght be best, but has anyone made a wrapper that allows, for example, regex =
search+replace on the request body and header-rewriting?</div>
<div><br></div><div>thanks</div><div>John</div><div><br></div>

--001636c934c58e43540484c02dbe--
John ORourke [ Mi, 21 April 2010 16:40 ] [ ID #2039657 ]

Re: Pre-processing the request body

> This message is in MIME format. Since your mail reader does not understand
this format, some or all of this message may not be legible.

--B_3354688623_22144428
Content-type: text/plain;
charset="ISO-8859-1"
Content-transfer-encoding: quoted-printable

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" <john-modperl [at] o-rourke.org> wrote:

> What is the most modperl-like way to do that? =A0
>
> I'm guessing the sort of filter described
> here=A0http://perl.apache.org/docs/2.0/user/handlers/filters .html#All_in_On=
e_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?


--B_3354688623_22144428
Content-type: text/html;
charset="ISO-8859-1"
Content-transfer-encoding: quoted-printable

<HTML>
<HEAD>
<TITLE>Re: Pre-processing the request body</TITLE>
</HEAD>
<BODY>
<FONT FACE=3D"Calibri, Verdana, Helvetica, Arial"><SPAN STYLE=3D'font-size:11pt=
'>Hey John<BR>
<BR>
If you are the type that likes to buy books, let me give a shout out to _ m=
od_perl 2 User's Guide _ by Stas Bekman and Jim Brandt.<BR>
It has helped me a lot to leverage the power available in mp2.<BR>
<BR>
I notice Ch 6 of that book: Input and Output filters, with subsections:<BR>
  I/O Filtering Concepts<BR>
  ...<BR>
  Writing well-behaved Filters<BR>
  Filter Examples<BR>
I would guess this book would provide all of the concepts, as well as good =
pragmatic advice you need to move forward.<BR>
<BR>
HTH,<BR>
<BR>
-- jeff<BR>
<BR>
<BR>
On 4/21/10 7:40 AM, "John ORourke" <<a href=3D"john-modperl [at] o-ro=
urke.org">john-modperl [at] o-rourke.org</a>> wrote:<BR>
<BR>
</SPAN></FONT><BLOCKQUOTE><FONT FACE=3D"Calibri, Verdana, Helvetica, Arial"><=
SPAN STYLE=3D'font-size:11pt'>What is the most modperl-like way to do that? =A0<=
BR>
<BR>
I'm guessing the sort of filter described here=A0<FONT COLOR=3D"#0000FF"><U><a =
href=3D"http://perl.apache.org/docs/2.0/user/handlers/filter s.html#All_in_One_=
Filter">http://perl.apache.org/docs/2.0/user/handlers/filter s.html#All_in_On=
e_Filter</a></U></FONT> might be best, but has anyone made a wrapper that al=
lows, for example, regex search+replace on the request body and header-rewri=
ting?<BR>
</SPAN></FONT></BLOCKQUOTE>
</BODY>
</HTML>


--B_3354688623_22144428--
Jeff McCarrell [ Mi, 21 April 2010 18:57 ] [ ID #2039666 ]

Re: Pre-processing the request body

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
Michael Ludwig [ Mi, 21 April 2010 19:47 ] [ ID #2039667 ]
Webserver » gmane.comp.apache.mod-perl » Pre-processing the request body

Vorheriges Thema: best practie for open and close connection database
Nächstes Thema: How to handle long running requests without locking an apache worker