cURL / Mailing Lists / curl-library / Single Mail


RE: formdata.c fix for file upload

From: Dylan Salisbury <>
Date: Thu, 31 Mar 2005 23:34:01 -0800

Stepping through this code, I realized that a FORM_FILE element in the list
is in fact always followed by FORM_DATA, so I suppose this fix to
Curl_FormReader is for a data condition that the rest of libcurl never calls
it with.



The recent fix to accommodate posts of zero-byte files (and files of other
particular sizes) applied in v1.82 of curl seems to have a bug.
Specifically Curl_FormReader assumes that after readfromfile returns zero,
the next item in the form is non-file data, but it could be another file or
the end of the form. Here's a patch against v1.86 that seems to deal with
the issue better:


I haven't tested this particular patch yet (I've tested a similar patch
against an old version) -- I'm posting it now in case anyone notices right
away that it doesn't completely solve the problem or has something else
wrong with it.


Thanks in advance for any comments,



Received on 2005-04-01