Here's another patch that I'm a little less sure about. Currently, if you submit a multipart form that has more than 1 part with a given name, only the last part is included in the request object (the others are overwritten). I've run into a few applications that expect such a submission to be treated as an array (for example, multiple files uploaded this way is part of the HTML5 'spec'). The following patch enables that behavior.
--- lib/modules/Protocols.pmod/HTTP.pmod/Server.pmod/Request.pike.orig 2011-10-07 01:32:42.000000000 -0400 +++ lib/modules/Protocols.pmod/HTTP.pmod/Server.pmod/Request.pike 2011-10-12 21:38:23.000000000 -0400 @@ -388,18 +387,9 @@
foreach(messg->body_parts, object part) { if(part->disp_params->filename) { + if(variables[part->disp_params->name] && !arrayp(variables[part->disp_params->name])) + variables[part->disp_params->name] = ({ variables[part->disp_params->name] }); + if(variables[part->disp_params->name] && arrayp(variables[part->disp_params->name])) + variables[part->disp_params->name] += ({part->getdata()}); + else variables[part->disp_params->name]=part->getdata(); + + if(variables[part->disp_params->name+".filename"] && !arrayp(variables[part->disp_params->name+".filename"])) + variables[part->disp_params->name+".filename"] = ({ variables[part->disp_params->name+".filename"] }); + if(variables[part->disp_params->name+".filename"] && arrayp(variables[part->disp_params->name+".filename"])) + variables[part->disp_params->name+".filename"] += ({part->disp_params->filename}); + else + variables[part->disp_params->name+".filename"]= part->disp_params->filename; - variables[part->disp_params->name]=part->getdata(); - variables[part->disp_params->name+".filename"]= - part->disp_params->filename; } else variables[part->disp_params->name] = part->getdata(); }
pike-devel@lists.lysator.liu.se