curl / Mailing Lists / curl-library / Single Mail


Re: Improving form post API

From: Andrew Lambert <>
Date: Mon, 26 Jun 2017 00:00:02 -0700

On 6/21/2017 4:12 PM, Daniel Stenberg wrote:> How do you think we should
provide a "file" in the first place? I can
> probably see us having a curl_form_set_file() function for that, to be
> used instead of _data() for a part. Then we could allow multiple such
> function calls to add more files in the same part. Files are data as
> well, sure, but they do have some more metadata that might make sense to
> provide in a separate function call.

One idea that comes to mind would be for curl_form_set_data() to treat
file: urls as file parts and everything else as string parts. I can
imagine scenarios where this would fail or produce unexpected results,

> Hm, I was trying to make this API without using varargs arguments. I
> think I
> rather try separate functions.

This is my chief concern. Just about any API that doesn't make use of
varargs will get my stamp of approval. Aside from the problem I've
mentioned with variadic functions in my binding, I think the current API
is trying to do too much in a single function call and that using
varargs is as much a symptom as a cause.

Andrew Lambert
Received on 2017-06-26