libcurlで0バイト(空)をPOSTするときの注意点

前の記事で触れたが空のPOSTをするときは明示的に0バイトだということを書かなかればならない

curl_easy_setopt(curl, CURLOPT_POSTFIELDSIZE, 0);

If you want to do a zero-byte POST, you need to set CURLOPT_POSTFIELDSIZE explicitly to zero, as simply setting CURLOPT_POSTFIELDS to NULL or "" just effectively disables the sending of the specified string. libcurl will instead assume that you'll send the POST data using the read callback!

CURLOPT_POSTFIELDS