libcURL POST items
I'm using libcurl to access an HTTPS "page" (the output is binary which the app understands rather than a page as such). The app also sends binary data to the page (a PHP script) via post. This all works fine (using curl_formadd with CURLFORM_PTRCONTENTS and CONTENTSLENGTH), except when the binary data to be transmitted contains NULL bytes. Even with the length specified, CURL is treating these as string delimiters. Is there a way to override this? since I can't even change all 0x00 to 0xFF or any similar substitution as any 8bit value is valid for some of the bytes. I realise that inserting escape values etc. would be an option, but am keen to avoid this for efficiency reasons.
Thanks in advance,
How do you call curl_formadd() (could we see the relevant code...?) Also, is the length you're passing to cURL correct (double check it)?
Sorry, for delay. That's the code, the Data and Length variables are definately set correctly. I've also tried using PTRCONTENTS, but no different. I've now resorted to passing a second request which is an array of "unsigned char" indices (+1 to allow first byte to be NULL) for NULL bytes, and then setting them to 0x01. This works, but limits this request to being 255 bytes long (since making the array into shorts or above would in itself create NULL bytes).
curl_formadd(&lPOST, &lPOSTLast, CURLFORM_COPYNAME, "Request", CURLFORM_COPYCONTENTS, lCurrentRequest->Data,
CURLFORM_CONTENTSLENGTH, lCurrentRequest->Length, CURLFORM_END);