curl / Mailing Lists / curl-library / Single Mail

curl-library

curl_formadd and empty content?

From: Christian Schmitz <filemakerlists_at_monkeybreadsoftware.de>
Date: Fri, 26 Jan 2018 13:37:29 +0100

Hi,

Does someone know how to pass empty text to curl_formadd for content of a field?

As far as I see, empty fields are skipped.

So passing "x" as content, shows field with x.
But passing "" as content, skips field.

I see that code uses strlen() and I see in formdata.c this:

       if(!clen)
         clen = -1;

So if clen = 0, than it sets to -1, but curl_mime_data than does use strlen again.

Maybe instead of

       if(!clen)
         clen = -1;

use

if(!clen)
{
        if (post->contents && *post->contents)
        {
                  clen = -1;
        }
}

So it only uses -1 for CURL_ZERO_TERMINATED, when contents is not pointing to NULL char.
What do you guys think?

Sincerely
Christian

-- 
Read our blog about news on our plugins:
http://www.mbsplugins.de/
-------------------------------------------------------------------
Unsubscribe: https://cool.haxx.se/list/listinfo/curl-library
Etiquette:   https://curl.haxx.se/mail/etiquette.html
Received on 2018-01-26