httpd-apreq-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Zbynek Jun <zbynek....@junix.cz>
Subject Re: post body parsing
Date Thu, 21 Jul 2011 12:14:58 GMT

On 20.7.2011 23:24, Torsten Förtsch wrote:
> On Wednesday, 20 July 2011 17:14:38 Zbynek Jun wrote:
>> post body:
>> a=&a&b=x&b=&b&a=x&c=x
>>
>> ideal case:
>> 'a' =>  [ '', '', 'x' ], 'b' =>  [ 'x', '', ''], 'c' =>  [ 'x']
>
> I'd say the ideal case would be a list:
>
>    'a', '', 'a', undef, 'b', 'x', 'b', undef, 'a', 'x', 'c', 'x'
>
> Anything else drops information. "a=" is not necessarily the same as
> simply "a" and "a=1&b=2&a=3" is not necessarily the same as
> "a=1&a=3&b=2".

Yes right. Difference between a= and a is sweet on the top :)

Anyway post body parser in libapreq2 is broken at least on my config. Is 
it known problem/bug ? I could not find anything relevant in mailinglist 
archive.

Maybe this is the reason why RT is using args_method   => "CGI" instead 
of "mod_perl". Apache1.x with Apache::Request module works flawlessly.


> You can read the request body via the Apache2::RequestRec object if
> Apache2::RequestIO is loaded.
>

Thank you for hint. Now i have robust and correct parser implemented in 
perl, but also have concerns about performance and smooth integration 
with other perl modules.

postbody:
&&&a&b=&a=4&a=1&t=&d&d&d=&d&b=x&b=&b&d=x&&c=v

Mason %ARGS via libapreq2:
{
  'a' => [ '4', '1' ],
  'd&b' => 'x',
  'd&d&d' => '',
  '&&&a&b' => '',
  'b&d' => 'x',
  'b' => '',
  't' => '',
  '&c' => 'v'
};

Parsed via Apache2::RequestIO:
{
  'c' => 'v',
  'a' => [ undef, '4', '1' ],
  'b' => [ '', 'x', '', undef ],
  'd' => [ undef, undef, '', undef, 'x' ],
  't' => ''
};



Zbynek



Mime
View raw message