HTTP クライアント プログラムを作成しました。その中で、別のプロセスからデータを取得し、それをリクエストの POST フィールドに追加します。しかし、libcurl はコンテンツ タイプを として使用しますapplication/x-www-form-urlencoded
。しかし、コンテンツタイプを に変更したいのですが、コンテンツの長さ、エージェントなどの他のフィールドを手動で変更する必要なく、それbinary
だけを変更するにはどうすればよいですか?content-type
curl_global_init(CURL_GLOBAL_ALL);
curl = curl_easy_init();
curl_easy_setopt(curl, CURLOPT_URL, shell_machine); //shell_machine is xxx.xx.xx.xx:8080/xxx
curl_easy_setopt(curl, CURLOPT_POSTFIELDS, buf); // buf is my post data
curl_easy_setopt(curl, CURLOPT_POSTFIELDSIZE, post_size); // size of my post data
curl_easy_setopt(curl, CURLOPT_USERAGENT, "libcurl-agent/1.0");
res = curl_easy_perform(curl);