From db2d587eecb3592d093531a59a5829e40ac3a7e0 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Wed, 4 Jan 2012 18:05:09 -0600 Subject: [PATCH] push in curl_formadd wrapper --- src/include/switch_curl.h | 2 +- src/switch_curl.c | 17 +++++++++++++++-- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/src/include/switch_curl.h b/src/include/switch_curl.h index 17c4bd6ce1..b7e578648a 100644 --- a/src/include/switch_curl.h +++ b/src/include/switch_curl.h @@ -49,7 +49,7 @@ SWITCH_DECLARE(switch_CURLcode) switch_curl_easy_setopt(CURL *handle, switch_CUR SWITCH_DECLARE(const char *) switch_curl_easy_strerror(switch_CURLcode errornum ); SWITCH_DECLARE(void) switch_curl_init(void); SWITCH_DECLARE(void) switch_curl_destroy(void); - +SWITCH_DECLARE(CURLFORMcode) switch_curl_formadd(struct curl_httppost **formpost, struct curl_httppost **lastptr, ...); #endif diff --git a/src/switch_curl.c b/src/switch_curl.c index cd44a3c633..6b0baac2f7 100644 --- a/src/switch_curl.c +++ b/src/switch_curl.c @@ -28,8 +28,6 @@ SWITCH_DECLARE(switch_CURLcode) switch_curl_easy_getinfo(switch_CURL *curl, swit return code; } - - SWITCH_DECLARE(void) switch_curl_easy_cleanup(switch_CURL *handle) { curl_easy_cleanup((CURL *)handle); @@ -75,3 +73,18 @@ SWITCH_DECLARE(void) switch_curl_destroy(void) curl_global_cleanup(); } +/* kind of ugly but there is no better portable way to wrap this function =(::: */ +#include "../../../../libs/curl/lib/formdata.c" + +SWITCH_DECLARE(CURLFORMcode) switch_curl_formadd(struct curl_httppost **httppost, + struct curl_httppost **last_post, + ...) +{ + va_list arg; + CURLFORMcode result; + va_start(arg, last_post); + result = FormAdd(httppost, last_post, arg); + va_end(arg); + return result; +} +