cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: Upload Form Data From Buffer

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Sun, 9 Jun 2002 21:29:20 +0200 (MET DST)

On Fri, 7 Jun 2002, Combes, Chris M. wrote:

> I've been working on a new "formadd" option to libcurl which allows the
> user to upload data similar to CURLFORM_FILE, but uses an existing buffer
> as the data source.

I think it is a sane and sound addition. I do have some opinions on some
minor details though:

> curl_status = curl_formadd(&post, &last,
> CURLFORM_COPYNAME, "record",
> CURLFORM_BUFFER, "data",
> CURLFORM_BUFFERPTR, record_buffer,
> CURLFORM_BUFFERLENGTH, size,
> CURLFORM_END);
>
> CURLFORM_BUFFER indicates that we want to add data from a buffer, and
> triggers the addition of the "filename" attribute set to "data".

Couldn't we use the already existing CURLFORM_FILENAME for the file name?

> CURLFORM_BUFFERPTR points to the existing buffer.
>
> CURLFORM_BUFFERLENGTH is the size of the buffer.

As these ones would indicate a "file part" buffer, I'd prefer if they had
names that somehow gave this impression a bit easier. Perhaps
CURLFORM_PTRFILEBUFFER and CURLFORM_FILEBUFFERLENGTH?

> I ran several tests using ascii and image data with positive results.

Goodie. I wish we had a libcurl test suite we could add something like that
to... :-/

> This is the first contribution I've made to an open source project so I
> will need to read up on how to incorporate the changes via SourceForge.

No need to do that just now, actually (even though getting to know how is
never bad of course). It'll be good enough if you just can provide us with
the output from 'diff -ru orig-curl-tree your-modified-curl-tree'. That's
what most of us call "a patch". ;-)

-- 
    Daniel Stenberg -- curl groks URLs -- http://curl.haxx.se/
_______________________________________________________________
Don't miss the 2002 Sprint PCS Application Developer's Conference
August 25-28 in Las Vegas - http://devcon.sprintpcs.com/adp/index.cfm?source=osdntextlink
Received on 2002-06-09