[Catalyst-dev] Bug in multipart/form-data encoded forms with blank variables

Ton Voon ton.voon at altinity.com
Tue Mar 27 15:52:28 GMT 2007


Hi!

I'm resending this with a new patch file since HTTP-Body has been  
updated recently.

I've come across a bug in Catalyst's handling of POST variables that  
are blank. We use this for some textfields in our forms which can be  
empty. The form is multipart/form-data encoded. The browser appears  
to be sending the data back correctly, but Catalyst is not listing  
the empty parameter. If I change the encoding to application/x-www- 
form-urlencoded, it works as expected.

Please find a patch to Catalyst's test suite to catch this bug.

I believe the issue is in HTTP::Body::MultiPart::handler. I think it  
is due to the early return in the "skip parts without content" logic.  
I've refactored the handler routine so that it treats parts with  
filename differently from standard parameters.

Please find a patch to HTTP::Body, against 0.8. I've included patches  
to the test suite to expect text2 back with an empty value. I've also  
included an edge case if filename is "0".

Please can you consider this for future inclusion. Thanks.

Ton

http://www.altinity.com
T: +44 (0)870 787 9243
F: +44 (0)845 280 1725
Skype: tonvoon

-------------- next part --------------
A non-text attachment was scrubbed...
Name: HTTP-Body.empty_parameters.patch
Type: application/octet-stream
Size: 12626 bytes
Desc: not available
Url : http://lists.scsys.co.uk/pipermail/catalyst-dev/attachments/20070327/37a0c5b2/HTTP-Body.empty_parameters.obj
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Catalyst-Runtime.blank_parameters.patch
Type: application/octet-stream
Size: 854 bytes
Desc: not available
Url : http://lists.scsys.co.uk/pipermail/catalyst-dev/attachments/20070327/37a0c5b2/Catalyst-Runtime.blank_parameters.obj
-------------- next part --------------



More information about the Catalyst-dev mailing list