mardi 31 août 2021

how to set boundary in multipart/form-data libcurl c++

I'm trying to send my data with content type multipart/form-data. Can Anyone help me how to set the boundary in multipart/form-data? . The desired output I'm looking for is " > Content-Type: multipart/form-data; boundary=------------------------f9e3897d86cb784a". My current output content type is "> Content-Type: multipart/form-data".

´´´

curl_easy_setopt(curl, CURLOPT_URL, url.c_str());
std::string header = std::string(cmdData.begin(), cmdData.begin() + HeaderSize);
SYSLOG_INFO << "header = " << header << std::endl;
std::string headerAuth = "SCPv2: " + header;
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, headerAuth.c_str());
headers = curl_slist_append(headers, "Content-Type: multipart/form-data");
curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers);

´´´




Aucun commentaire:

Enregistrer un commentaire