Hi list,
There is a problem with Pike 7.4 and disp_params variable in MIME.Message. The following code from Caudium doesn't work with Pike 7.4. I tried to copy 7.2's MIME.pmod to Pike 7.4 MIME/module.pmod and then it was working.
The difference between two MIME version is that when it works I have part->disp_params=([ /* 1 element */ "name":"1" ]), part->getdata="Upload to attachments", part->headers=([ /* 1 element */ "content-disposition":"form-data; name="1"" ])
and when it doesn't work, this mapping is empty.
FYI, Here is the code (from protocols/http.pike and protocols/http2.pike):
case "multipart/form-data": // perror("Multipart/form-data post detected\n"); object messg = MIME.Message(data, request_headers); write("data=%O, request_headers=%O\n", data, request_headers); foreach(messg->body_parts||({}), object part) { write("part->disp_params=%O, part->getdata=%O, part->headers=%O\n", part->disp_params, part->getdata(), part->headers); if(part->disp_params->filename) { variables[part->disp_params->name]=part->getdata(); string fname=part->disp_params->filename; if( part->headers["content-disposition"] ) { array fntmp=part->headers["content-disposition"]/";"; if( sizeof(fntmp) >= 3 && search(fntmp[2],"=") != -1 ) { fname=((fntmp[2]/"=")[1]); fname=fname[1..(sizeof(fname)-2)]; }
} variables[part->disp_params->name+".filename"]=fname;
if(!misc->files) misc->files = ({ part->disp_params->name }); else misc->files += ({ part->disp_params->name }); } else { if(variables[part->disp_params->name]) variables[part->disp_params->name] += "\0" + part->getdata(); else variables[part->disp_params->name] = part->getdata(); } } break;
Thanks for your help.