cURL / Mailing Lists / curl-library / Single Mail

curl-library

Differences between the buffer-oriented curl_fromadd() parameters

From: Holger Rauch <Holger.Rauch_at_heitec.de>
Date: Tue, 1 Oct 2002 14:59:13 +0200 (CEST)

Hi!

Even after having read the curl_formadd() man page, the difference between

- CURLFORM_BUFFER
- CURLFORM_BUFFERPTR
- CURLFORM_COPYCONTENTS
- CURLFORM_PTRCONTENTS

is not clear to me. I realize that when using CURLFORM_BUFFERPTR, I must
make sure that the data is available until curl_easy_cleanup() has
performed its job. For CURLFORM_PTRCONTENTS, it's only mentioned that an
optional length parameter may be specified, but I don't see the difference
to CURLFORM_COPYCONTENTS, for example. Does the following command (taken
from the example in the man page) upload two buffers (data AND
record)? ("record" doesn't seem to specified in the example, so I don't
know what it is.)

curl_formadd(&post, &last,
                   CURLFORM_COPYNAME, "name",
                   CURLFORM_BUFFER, "data",
                   CURLFORM_BUFFERPTR, record,
                   CURLFORM_BUFFERLENGTH, record_length,
                   CURLFORM_END);

Is this equivalent to (provided that "record" is omitted)

curl_formadd(&post, &last,
             CURLFORM_COPYNAME, "name",
             CURLFORM_PTRCONTENTS, "data",
             CURLFORM_END);

or

curl_formadd(&post, &last,
             CURLFORM_COPYNAME, "name",
             CURLFORM_COPYCONTENTS, "data",
             CURLFORM_END);

or

curl_formadd(&post, &last,
             CURLFORM_COPYNAME, "name",
             CURLFORM_BUFFERPTR, "data",
             CURLFORM_END);

Get the point I'm trying to make?

Could anybody please enlighten me when to use which of these options?

Thanks in advance for any info!

Kind regards,

        Holger

-------------------------------------------------------
This sf.net email is sponsored by: DEDICATED SERVERS only $89!
Linux or FreeBSD, FREE setup, FAST network. Get your own server
today at http://www.ServePath.com/indexfm.htm
Received on 2002-10-01