BNPH-6149: allow to use system curl again, fix some types on auth_scheme values to all be long, don't use curl private function in our wrapper. This may cause missing symbol curl_easy_setopt with visibility turned on, if it does that, please let me know
This commit is contained in:
parent
12bc3828ee
commit
666231f91b
|
@ -1030,7 +1030,7 @@ fi
|
||||||
|
|
||||||
if test "$ac_cv_use_system_curl" = "yes" ; then
|
if test "$ac_cv_use_system_curl" = "yes" ; then
|
||||||
AC_CACHE_CHECK([whether to use system libcurl library], [ac_cv_curl_usable], [
|
AC_CACHE_CHECK([whether to use system libcurl library], [ac_cv_curl_usable], [
|
||||||
AC_CHECK_LIB(curl, Curl_setopt, [ac_cv_curl_usable="yes"], [ac_cv_curl_usable="no"])
|
AC_CHECK_LIB(curl, curl_easy_setopt, [ac_cv_curl_usable="yes"], [ac_cv_curl_usable="no"])
|
||||||
])
|
])
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
|
@ -51,6 +51,7 @@ SWITCH_DECLARE(const char *) switch_curl_easy_strerror(switch_CURLcode errornum
|
||||||
SWITCH_DECLARE(void) switch_curl_init(void);
|
SWITCH_DECLARE(void) switch_curl_init(void);
|
||||||
SWITCH_DECLARE(void) switch_curl_destroy(void);
|
SWITCH_DECLARE(void) switch_curl_destroy(void);
|
||||||
SWITCH_DECLARE(switch_status_t) switch_curl_process_form_post_params(switch_event_t *event, switch_CURL *curl_handle, struct curl_httppost **formpostp);
|
SWITCH_DECLARE(switch_status_t) switch_curl_process_form_post_params(switch_event_t *event, switch_CURL *curl_handle, struct curl_httppost **formpostp);
|
||||||
|
#define switch_curl_easy_setopt curl_easy_setopt
|
||||||
|
|
||||||
SWITCH_END_EXTERN_C
|
SWITCH_END_EXTERN_C
|
||||||
|
|
||||||
|
|
|
@ -86,7 +86,7 @@ typedef struct client_profile_s {
|
||||||
uint32_t enable_ssl_verifyhost;
|
uint32_t enable_ssl_verifyhost;
|
||||||
char *cookie_file;
|
char *cookie_file;
|
||||||
switch_hash_t *vars_map;
|
switch_hash_t *vars_map;
|
||||||
int auth_scheme;
|
long auth_scheme;
|
||||||
int timeout;
|
int timeout;
|
||||||
profile_perms_t perms;
|
profile_perms_t perms;
|
||||||
char *ua;
|
char *ua;
|
||||||
|
@ -1749,7 +1749,7 @@ static switch_status_t do_config(void)
|
||||||
char *cookie_file = NULL;
|
char *cookie_file = NULL;
|
||||||
char *ua = "mod_httapi/1.0";
|
char *ua = "mod_httapi/1.0";
|
||||||
hash_node_t *hash_node;
|
hash_node_t *hash_node;
|
||||||
int auth_scheme = CURLAUTH_BASIC;
|
long auth_scheme = CURLAUTH_BASIC;
|
||||||
need_vars_map = 0;
|
need_vars_map = 0;
|
||||||
vars_map = NULL;
|
vars_map = NULL;
|
||||||
|
|
||||||
|
@ -1791,7 +1791,7 @@ static switch_status_t do_config(void)
|
||||||
} else if (!strcasecmp(val, "GSS-NEGOTIATE")) {
|
} else if (!strcasecmp(val, "GSS-NEGOTIATE")) {
|
||||||
auth_scheme |= CURLAUTH_GSSNEGOTIATE;
|
auth_scheme |= CURLAUTH_GSSNEGOTIATE;
|
||||||
} else if (!strcasecmp(val, "any")) {
|
} else if (!strcasecmp(val, "any")) {
|
||||||
auth_scheme = CURLAUTH_ANY;
|
auth_scheme = (long)CURLAUTH_ANY;
|
||||||
}
|
}
|
||||||
} else if (!strcasecmp(var, "disable-100-continue") && !switch_true(val)) {
|
} else if (!strcasecmp(var, "disable-100-continue") && !switch_true(val)) {
|
||||||
disable100continue = 0;
|
disable100continue = 0;
|
||||||
|
|
|
@ -79,7 +79,7 @@ struct cdr_profile {
|
||||||
int prefix_a;
|
int prefix_a;
|
||||||
int disable100continue;
|
int disable100continue;
|
||||||
int rotate;
|
int rotate;
|
||||||
int auth_scheme;
|
long auth_scheme;
|
||||||
int timeout;
|
int timeout;
|
||||||
switch_memory_pool_t *pool;
|
switch_memory_pool_t *pool;
|
||||||
};
|
};
|
||||||
|
@ -671,7 +671,7 @@ switch_status_t mod_format_cdr_load_profile_xml(switch_xml_t xprofile)
|
||||||
} else if (!strcasecmp(val, "GSS-NEGOTIATE")) {
|
} else if (!strcasecmp(val, "GSS-NEGOTIATE")) {
|
||||||
profile->auth_scheme |= CURLAUTH_GSSNEGOTIATE;
|
profile->auth_scheme |= CURLAUTH_GSSNEGOTIATE;
|
||||||
} else if (!strcasecmp(val, "any")) {
|
} else if (!strcasecmp(val, "any")) {
|
||||||
profile->auth_scheme = CURLAUTH_ANY;
|
profile->auth_scheme = (long)CURLAUTH_ANY;
|
||||||
}
|
}
|
||||||
} else if (!strcasecmp(var, "encode-values") && !zstr(val)) {
|
} else if (!strcasecmp(var, "encode-values") && !zstr(val)) {
|
||||||
profile->encode_values = switch_true(val) ? ENCODING_DEFAULT : ENCODING_NONE;
|
profile->encode_values = switch_true(val) ? ENCODING_DEFAULT : ENCODING_NONE;
|
||||||
|
|
|
@ -69,7 +69,7 @@ static struct {
|
||||||
int prefix_a;
|
int prefix_a;
|
||||||
int disable100continue;
|
int disable100continue;
|
||||||
int rotate;
|
int rotate;
|
||||||
int auth_scheme;
|
long auth_scheme;
|
||||||
switch_memory_pool_t *pool;
|
switch_memory_pool_t *pool;
|
||||||
switch_event_node_t *node;
|
switch_event_node_t *node;
|
||||||
int encode_values;
|
int encode_values;
|
||||||
|
@ -689,7 +689,7 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_json_cdr_load)
|
||||||
} else if (!strcasecmp(val, "GSS-NEGOTIATE")) {
|
} else if (!strcasecmp(val, "GSS-NEGOTIATE")) {
|
||||||
globals.auth_scheme |= CURLAUTH_GSSNEGOTIATE;
|
globals.auth_scheme |= CURLAUTH_GSSNEGOTIATE;
|
||||||
} else if (!strcasecmp(val, "any")) {
|
} else if (!strcasecmp(val, "any")) {
|
||||||
globals.auth_scheme = CURLAUTH_ANY;
|
globals.auth_scheme = (long)CURLAUTH_ANY;
|
||||||
}
|
}
|
||||||
} else if (!strcasecmp(var, "encode-values") && !zstr(val)) {
|
} else if (!strcasecmp(var, "encode-values") && !zstr(val)) {
|
||||||
globals.encode_values = switch_true(val) ? ENCODING_DEFAULT : ENCODING_NONE;
|
globals.encode_values = switch_true(val) ? ENCODING_DEFAULT : ENCODING_NONE;
|
||||||
|
|
|
@ -146,7 +146,7 @@ static JSBool curl_run(JSContext * cx, JSObject * obj, uintN argc, jsval * argv,
|
||||||
if (argc > 5) {
|
if (argc > 5) {
|
||||||
cred = JS_GetStringBytes(JS_ValueToString(cx, argv[5]));
|
cred = JS_GetStringBytes(JS_ValueToString(cx, argv[5]));
|
||||||
if (!zstr(cred)) {
|
if (!zstr(cred)) {
|
||||||
switch_curl_easy_setopt(co->curl_handle, CURLOPT_HTTPAUTH, CURLAUTH_ANY);
|
switch_curl_easy_setopt(co->curl_handle, CURLOPT_HTTPAUTH, (long)CURLAUTH_ANY);
|
||||||
switch_curl_easy_setopt(co->curl_handle, CURLOPT_USERPWD, cred);
|
switch_curl_easy_setopt(co->curl_handle, CURLOPT_USERPWD, cred);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -165,7 +165,7 @@ JS_CURL_FUNCTION_IMPL(Run)
|
||||||
String::Utf8Value str4(info[5]);
|
String::Utf8Value str4(info[5]);
|
||||||
cred = js_safe_str(*str4);
|
cred = js_safe_str(*str4);
|
||||||
if (cred.length() > 0) {
|
if (cred.length() > 0) {
|
||||||
switch_curl_easy_setopt(_curl_handle, CURLOPT_HTTPAUTH, CURLAUTH_ANY);
|
switch_curl_easy_setopt(_curl_handle, CURLOPT_HTTPAUTH, (long)CURLAUTH_ANY);
|
||||||
switch_curl_easy_setopt(_curl_handle, CURLOPT_USERPWD, cred.c_str());
|
switch_curl_easy_setopt(_curl_handle, CURLOPT_USERPWD, cred.c_str());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -66,7 +66,7 @@ static struct {
|
||||||
int prefix_a;
|
int prefix_a;
|
||||||
int disable100continue;
|
int disable100continue;
|
||||||
int rotate;
|
int rotate;
|
||||||
int auth_scheme;
|
long auth_scheme;
|
||||||
int timeout;
|
int timeout;
|
||||||
switch_memory_pool_t *pool;
|
switch_memory_pool_t *pool;
|
||||||
switch_event_node_t *node;
|
switch_event_node_t *node;
|
||||||
|
@ -576,7 +576,7 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_xml_cdr_load)
|
||||||
} else if (!strcasecmp(val, "GSS-NEGOTIATE")) {
|
} else if (!strcasecmp(val, "GSS-NEGOTIATE")) {
|
||||||
globals.auth_scheme |= CURLAUTH_GSSNEGOTIATE;
|
globals.auth_scheme |= CURLAUTH_GSSNEGOTIATE;
|
||||||
} else if (!strcasecmp(val, "any")) {
|
} else if (!strcasecmp(val, "any")) {
|
||||||
globals.auth_scheme = CURLAUTH_ANY;
|
globals.auth_scheme = (long)CURLAUTH_ANY;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -57,7 +57,7 @@ struct xml_binding {
|
||||||
char *cookie_file;
|
char *cookie_file;
|
||||||
switch_hash_t *vars_map;
|
switch_hash_t *vars_map;
|
||||||
int use_dynamic_url;
|
int use_dynamic_url;
|
||||||
int auth_scheme;
|
long auth_scheme;
|
||||||
int timeout;
|
int timeout;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -368,7 +368,7 @@ static switch_status_t do_config(void)
|
||||||
uint32_t enable_ssl_verifyhost = 0;
|
uint32_t enable_ssl_verifyhost = 0;
|
||||||
char *cookie_file = NULL;
|
char *cookie_file = NULL;
|
||||||
hash_node_t *hash_node;
|
hash_node_t *hash_node;
|
||||||
int auth_scheme = CURLAUTH_BASIC;
|
long auth_scheme = CURLAUTH_BASIC;
|
||||||
need_vars_map = 0;
|
need_vars_map = 0;
|
||||||
vars_map = NULL;
|
vars_map = NULL;
|
||||||
|
|
||||||
|
@ -399,7 +399,7 @@ static switch_status_t do_config(void)
|
||||||
} else if (!strcasecmp(val, "GSS-NEGOTIATE")) {
|
} else if (!strcasecmp(val, "GSS-NEGOTIATE")) {
|
||||||
auth_scheme |= CURLAUTH_GSSNEGOTIATE;
|
auth_scheme |= CURLAUTH_GSSNEGOTIATE;
|
||||||
} else if (!strcasecmp(val, "any")) {
|
} else if (!strcasecmp(val, "any")) {
|
||||||
auth_scheme = CURLAUTH_ANY;
|
auth_scheme = (long)CURLAUTH_ANY;
|
||||||
}
|
}
|
||||||
} else if (!strcasecmp(var, "disable-100-continue") && !switch_true(val)) {
|
} else if (!strcasecmp(var, "disable-100-continue") && !switch_true(val)) {
|
||||||
disable100continue = 0;
|
disable100continue = 0;
|
||||||
|
|
|
@ -2,9 +2,6 @@
|
||||||
#include "switch_curl.h"
|
#include "switch_curl.h"
|
||||||
#include <curl/curl.h>
|
#include <curl/curl.h>
|
||||||
|
|
||||||
CURLcode Curl_setopt(switch_CURL *curl, CURLoption option, va_list arg);
|
|
||||||
|
|
||||||
|
|
||||||
SWITCH_DECLARE(switch_CURL *) switch_curl_easy_init(void)
|
SWITCH_DECLARE(switch_CURL *) switch_curl_easy_init(void)
|
||||||
{
|
{
|
||||||
return curl_easy_init();
|
return curl_easy_init();
|
||||||
|
@ -46,18 +43,6 @@ SWITCH_DECLARE(void) switch_curl_slist_free_all(switch_curl_slist_t * list)
|
||||||
curl_slist_free_all((struct curl_slist *) list);
|
curl_slist_free_all((struct curl_slist *) list);
|
||||||
}
|
}
|
||||||
|
|
||||||
SWITCH_DECLARE(switch_CURLcode) switch_curl_easy_setopt(CURL *handle, switch_CURLoption option, ...)
|
|
||||||
{
|
|
||||||
va_list ap;
|
|
||||||
switch_CURLcode code;
|
|
||||||
|
|
||||||
va_start(ap, option);
|
|
||||||
code = Curl_setopt(handle, option, ap);
|
|
||||||
va_end(ap);
|
|
||||||
|
|
||||||
return code;
|
|
||||||
}
|
|
||||||
|
|
||||||
SWITCH_DECLARE(const char *) switch_curl_easy_strerror(switch_CURLcode errornum )
|
SWITCH_DECLARE(const char *) switch_curl_easy_strerror(switch_CURLcode errornum )
|
||||||
{
|
{
|
||||||
return curl_easy_strerror(errornum);
|
return curl_easy_strerror(errornum);
|
||||||
|
|
Loading…
Reference in New Issue