curl / Mailing Lists / curl-library / Single Mail

curl-library

Re: Form data

From: Patrick Monnerat via curl-library <curl-library_at_cool.haxx.se>
Date: Thu, 21 Sep 2017 01:35:34 +0100

On 09/20/2017 04:16 PM, Demi Obenour via curl-library wrote:

Hi Demi,
First, you should read this mailing list's etiquette
(https://curl.haxx.se/mail/etiquette.html) before posting like you did.
In particular 2.4 and 2.7.

> Would it be possible to not require NUL-termination? Ensuring
> NUL-termination is often awkward in FFI scenarios.
I presume you wanted to reply to
https://curl.haxx.se/mail/lib-2017-09/0099.html, right ? If so, here is
the explanation:

- Form/mime data will be unaffected, as it may contain binary bytes.
- Form API field names will not be allowed to contain zero-valued bytes
anymore, but name lengths can still be specified.
- Mime API field names will be required to be nul-terminated.

This scheme offers a reasonable compatibility level for the deprecated
form API, and is simpler and more natural for C language character
strings in the new mime API.
If not THE purpose of foreign language bindings, taking care of passing
parameters to libcurl functions is one of their most important role. In
addition, a lot of these languages natively offer easy means to get the
address of an equivalent nul-terminated string (C++ c_str(), ILE/RPG
options(*string), Java/JNI GetStringUTFChars(), PHP Z_STRVAL_P(), Python
PyString_AsString(), etc.).

-------------------------------------------------------------------
Unsubscribe: https://cool.haxx.se/list/listinfo/curl-library
Etiquette: https://curl.haxx.se/mail/etiquette.html
Received on 2017-09-21