diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/activation.c | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/src/activation.c b/src/activation.c index 2b329ce..d3d7e74 100644 --- a/src/activation.c +++ b/src/activation.c @@ -1188,7 +1188,11 @@ idevice_activation_error_t idevice_activation_send_request(idevice_activation_re } CURL* handle = curl_easy_init(); +#if LIBCURL_VERSION_NUM >= 0x073800 + curl_mime* mime = NULL; +#else struct curl_httppost* form = NULL; +#endif struct curl_slist* slist = NULL; if (!handle) { @@ -1213,7 +1217,12 @@ idevice_activation_error_t idevice_activation_send_request(idevice_activation_re plist_t value_node = NULL; if (request->content_type == IDEVICE_ACTIVATION_CONTENT_TYPE_MULTIPART_FORMDATA) { +#if LIBCURL_VERSION_NUM >= 0x073800 + mime = curl_mime_init(handle); + curl_mimepart *part; +#else struct curl_httppost* last = NULL; +#endif do { plist_dict_next_item(request->fields, iter, &key, &value_node); if (key != NULL) { @@ -1227,14 +1236,24 @@ idevice_activation_error_t idevice_activation_send_request(idevice_activation_re plist_strip_xml(&svalue); } +#if LIBCURL_VERSION_NUM >= 0x073800 + part = curl_mime_addpart(mime); + curl_mime_name(part, key); + curl_mime_data(part, svalue, CURL_ZERO_TERMINATED); +#else curl_formadd(&form, &last, CURLFORM_COPYNAME, key, CURLFORM_COPYCONTENTS, svalue, CURLFORM_END); +#endif free(svalue); svalue = NULL; } } } while(value_node != NULL); +#if LIBCURL_VERSION_NUM >= 0x073800 + curl_easy_setopt(handle, CURLOPT_MIMEPOST, mime); +#else curl_easy_setopt(handle, CURLOPT_HTTPPOST, form); +#endif } else if (request->content_type == IDEVICE_ACTIVATION_CONTENT_TYPE_URL_ENCODED) { char* postdata = (char*) malloc(sizeof(char)); @@ -1325,8 +1344,13 @@ idevice_activation_error_t idevice_activation_send_request(idevice_activation_re cleanup: free(iter); +#if LIBCURL_VERSION_NUM >= 0x073800 + if (mime) + curl_mime_free(mime); +#else if (form) curl_formfree(form); +#endif if (slist) curl_slist_free_all(slist); if (handle) |
