cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: formadd question

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Mon, 29 Oct 2001 14:22:51 +0100 (MET)

On Mon, 29 Oct 2001, Andrés García wrote:

> I have been playing with the new formadd function, doing something like:
>
>     forms[0].option=CURLFORM_FILE;
>     forms[0].value=strdup("postit3.c");
>     forms[1].option=CURLFORM_FILE;
>     forms[1].value=strdup("postit2.c");
>     forms[2].option=CURLFORM_END;
>
>     curl_formadd(&formpost, &lastptr, CURLFORM_COPYNAME, "Ficheros",
>             CURLFORM_ARRAY, forms, CURLFORM_END);
>
> I was expecting both files to be sent to the CGI script, yet  with
> version 7.9.1-pre5 only the first one is sent.
>
> Am I doing something wrong or is this a bug?

This is a bug. I don't know if I ruined this when I got the latest code from
Georg Huettenegger or if it never worked, but when I applied a fix as
follows, it seems to work as assumed:

http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/curl/curl/lib/formdata.c.diff?r1=1.25&r2=1.26

> On the other hand, in the formadd man page it says:
>
>       forms[2].value  = CURLFORM_END;
>       /* no option needed for the end marker */
>
> Shouldn't that be: forms[2].option=CURLFORM_END; ?

It certainly should!

Thanks for your report Andrés!

-- 
    Daniel Stenberg -- curl groks URLs -- http://curl.haxx.se/
Received on 2001-10-29