GByteArray *response_body= NULL;
CURLcode err;
int curl_ret_code = 0;
+ curl_mime *mime = NULL;
curl = curl_easy_init();
retvm_if(!curl, -EIO, "Failed to init curl");
curl_ret_code = curl_easy_setopt(curl, CURLOPT_HTTPGET, 1);
retvm_if(CURLE_OK != curl_ret_code, -EIO, "Failed to curl_easy_setopt with CURLOPT_HTTPGET : ret_code[%d]", curl_ret_code);
} else if (type == FMWUP_HTTP_POST) {
- curl_ret_code = curl_easy_setopt(curl, CURLOPT_HTTPPOST, 1);
- retvm_if(CURLE_OK != curl_ret_code, -EIO, "Failed to curl_easy_setopt with CURLOPT_HTTPPOST : ret_code[%d]", curl_ret_code);
+ mime = curl_mime_init(curl);
+ retvm_if(!mime, -EIO, "curl_mime_init: Failed to init mime");
+
+ curl_ret_code = curl_easy_setopt(curl, CURLOPT_MIMEPOST, mime);
+ if (curl_ret_code != CURLE_OK) {
+ curl_mime_free(mime);
+ _E("Failed to curl_easy_setopt with CURLOPT_MIMEPOST : ret_code[%d]", curl_ret_code);
+ return -EIO;
+ }
} else {
return -1;
}
__curl_set_response(curl, response_header, response_body, res_header, res_body, NULL);
END:
+ if (mime)
+ curl_mime_free(mime);
if (response_header)
g_byte_array_free(response_header, TRUE);
if (response_body)