curl / Mailing Lists / curl-library / Single Mail

curl-library

Re: Improving form post API

From: Andrew Lambert <andrew_at_boredomsoft.org>
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,
though.

> 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.

Regards,
Andrew Lambert
-------------------------------------------------------------------
Unsubscribe: https://cool.haxx.se/list/listinfo/curl-library
Etiquette: https://curl.haxx.se/mail/etiquette.html
Received on 2017-06-26