I have found a little problem with output of non-printable characters when --libcurl option is used.
For example, we are trying to post contents of binfile.bin file with non-printable characters inside:
~> cat binfile.bin
~> curl --libcurl ~/result.c --request POST --data-binary "@binfile.bin" http://tut.by
some cURL output
~> cat result.c
// skip a few lines
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "\02");
As you can see, the content of binfile.bin file was not copied correctly to the generated C source file.
The problem occurs because snprintf function reserves space for the additional terminating null character. The fix is provided in 9414a9e commit.
--libcurl: problem with output of non-printable characters was fixed
tool_setopt: fix c_escape truncated octal
Thanks, that was a bug. Your fix landed in 2eb4f5e. If your binary data has null bytes truncation will still occur in the source generation when --libcurl because we treat the postdata as a string. I'll open an issue to address that soon.