On Fri, 23 Apr 2021, Milen Nikolov via curl-library wrote:
I'm using libcurl in C++ and I have to make a post request to a server, containing a string in the body section. Another -condition is that I have to specify the content-type as octet-stream. I've set the header, authentication and so on, but there is one problem: the curl function (CURLOPT_POSTFIELDS) takes as argument a c-string. In my string there are also NUL characters, which have to be sent. When I try sending the request the body is truncated at the first NUL chararcter.
Set CURLOPT_POSTFIELDSIZE to the size of the data and it will not do strlen() to figure out the size.
I also just filed https://github.com/curl/curl/pull/6943 to clarify this better.
-- / daniel.haxx.se | Commercial curl support up to 24x7 is available! | Private help, bug fixes, support, ports, new features | https://www.wolfssl.com/contact/ ------------------------------------------------------------------- Unsubscribe: https://cool.haxx.se/list/listinfo/curl-library Etiquette: https://curl.se/mail/etiquette.html