Andrew Maltsev wrote:
Here is the situation. There is sort of web service (Ariba buyer for
those who cares) that posts plain unencoded XML using POST method to a
mod_perl 1.x application.

Somewhere at the very top the application does

use CGI;
my $cgi=CGI->new();

and then passes this $cgi reference around. Assuming that this CANNOT BE
CHANGED, i.e. we get called sometime in the middle and have no control
over what's above us, is there a way to get the XML message posted to us?

$r->content returns '' as it was already called once by CGI. CGI does
not save the content anywhere -- it parses it instead. And while
parsing, it assumes that arguments can be separated by both ';' and '&'.
So that if we join arguments back we either convert all ';'s into '&'s
or vice versa.

Any ideas?

So far I can only see customizing CGI.pm to make it save original
POST'ed content.

If Geoff's module doesn't work for you, you could do the following:


Slurp STDIN before you call CGI->new() into an IO::String object, and then either re-open STDIN as that IO::String object or try to tell CGI::new to use that IO instead of STDIN (you can even pass the slurped data as a string, though it's probably not the most efficient way). Starting from perl 5.8 you can also use in-memory filehandles which act similarly. See perldoc -f open for more info on that cool new feature.

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


-- Reporting bugs: http://perl.apache.org/bugs/ Mail list info: http://perl.apache.org/maillist/modperl.html



Reply via email to