curl-library
Re: Differences between the buffer-oriented curl_fromadd() parameters
Date: Wed, 2 Oct 2002 11:10:02 +0200 (CEST)
Hi Daniel!
Thanks again for your quick and informative reply!
On Wed, 2 Oct 2002, Daniel Stenberg wrote:
> On Tue, 1 Oct 2002, Holger Rauch wrote:
> > What I'm actually trying to do is that I want to upload a buffer using HTTP
> > POST request. Basically, the buffer is similar to what's provided in the
> > example section of the man page:
> >
> > char htmlbuffer[] = "<HTML>test buffer</HTML>";
> >
> > but it's longer and contains XML instead of HTML data.
>
> If all you want to do is make a normal POST, then curl_formadd() is not the
> way to go. This is only used for multipart (RFC1867) formposts.
Sorry, but I wasn't precise enough. I also need to add additional form
parameters, such as
curl_formadd( &post, &last,
CURLFORM_COPYNAME, "_sessionId",
CURLFORM_COPYCONTENTS, sessionid,
CURLFORM_END );
and
curl_formadd( &post, &last,
CURLFORM_COPYNAME, "_sessionKey",
CURLFORM_COPYCONTENTS, sessionkey,
CURLFORM_END );
So I think it is a multipart form.
> [...] But if the
> part is a "file upload" part, it also has a file name. So, to make a part of
> look like a file upload part to the receiver, all those three data need to
> exist in the part.
Thanks. I got it now :-)
> The COPYNAME and PTRNAME set the name of the part. COPYCONTENTS and
> PTRCONTENTS set contents. FILECONTENT is a special one that lets you name a
> file instead of content data, and libcurl will get the contents from that
> named file instead.
This one as well :-) One question though: Does FILECONTENT also set the
file name?
> [...]
> They'll both create identical formparts. The only difference is how libcurl
> will refer to the data. The COPY* ones make libcurl copy the data and keep
> track of it itself, while the PTR* ones make libcurl use the buffer you point
> to.
Thanks. Sorted out as well.
> [...]
> But that is already the general idea behind the naming of these options!
> *NAME set the name of the part, *CONTENTS set the contents part. The other
> options are mainly there to build file-upload parts, as they need file name
> too for example.
Now I (finally) got it :-)
Just one suggestion: I think if most of what's been written in the replies
by Chris and you went into the curl_formadd() man page the idea behind
curl_formadd() in conjunction with its usage would be much clearer. Are
there any plans for updating the curl_formadd() man page in this
respect? Another good place would probably be the tutorial.
When I want to add anything to either the tutorial or the
curl_formadd() man page, am I supposed to work on the HTML version or the
original man page source?
Thanks in advance for any info!
Kind regards,
Holger
-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
Received on 2002-10-02