diff options
Diffstat (limited to 'res/res_config_curl.c')
-rw-r--r-- | res/res_config_curl.c | 56 |
1 files changed, 24 insertions, 32 deletions
diff --git a/res/res_config_curl.c b/res/res_config_curl.c index 0ff6694dc..f80998e36 100644 --- a/res/res_config_curl.c +++ b/res/res_config_curl.c @@ -65,7 +65,6 @@ static struct ast_variable *realtime_curl(const char *url, const char *unused, v char *stringp, *pair, *key; int i; struct ast_variable *var = NULL, *prev = NULL; - const int EncodeSpecialChars = 1; if (!ast_custom_function_find("CURL")) { ast_log(LOG_ERROR, "func_curl.so must be loaded in order to use res_config_curl.so!!\n"); @@ -84,8 +83,8 @@ static struct ast_variable *realtime_curl(const char *url, const char *unused, v for (i = 0; (newparam = va_arg(ap, const char *)); i++) { newval = va_arg(ap, const char *); - ast_uri_encode(newparam, buf1, sizeof(buf1), EncodeSpecialChars); - ast_uri_encode(newval, buf2, sizeof(buf2), EncodeSpecialChars); + ast_uri_encode(newparam, buf1, sizeof(buf1), ast_uri_http); + ast_uri_encode(newval, buf2, sizeof(buf2), ast_uri_http); ast_str_append(&query, 0, "%s%s=%s", i > 0 ? "&" : "", buf1, buf2); } va_end(ap); @@ -101,9 +100,9 @@ static struct ast_variable *realtime_curl(const char *url, const char *unused, v stringp = ast_str_buffer(buffer); while ((pair = strsep(&stringp, "&"))) { key = strsep(&pair, "="); - ast_uri_decode(key); + ast_uri_decode(key, ast_uri_http); if (pair) { - ast_uri_decode(pair); + ast_uri_decode(pair, ast_uri_http); } if (!ast_strlen_zero(key)) { @@ -137,7 +136,6 @@ static struct ast_config *realtime_multi_curl(const char *url, const char *unuse const char *newparam, *newval; char *stringp, *line, *pair, *key, *initfield = NULL; int i; - const int EncodeSpecialChars = 1; struct ast_variable *var = NULL; struct ast_config *cfg = NULL; struct ast_category *cat = NULL; @@ -165,8 +163,8 @@ static struct ast_config *realtime_multi_curl(const char *url, const char *unuse if ((op = strchr(initfield, ' '))) *op = '\0'; } - ast_uri_encode(newparam, buf1, sizeof(buf1), EncodeSpecialChars); - ast_uri_encode(newval, buf2, sizeof(buf2), EncodeSpecialChars); + ast_uri_encode(newparam, buf1, sizeof(buf1), ast_uri_http); + ast_uri_encode(newval, buf2, sizeof(buf2), ast_uri_http); ast_str_append(&query, 0, "%s%s=%s", i > 0 ? "&" : "", buf1, buf2); } va_end(ap); @@ -193,9 +191,9 @@ static struct ast_config *realtime_multi_curl(const char *url, const char *unuse while ((pair = strsep(&line, "&"))) { key = strsep(&pair, "="); - ast_uri_decode(key); + ast_uri_decode(key, ast_uri_http); if (pair) { - ast_uri_decode(pair); + ast_uri_decode(pair, ast_uri_http); } if (!strcasecmp(key, initfield) && pair) { @@ -235,7 +233,6 @@ static int update_curl(const char *url, const char *unused, const char *keyfield const char *newparam, *newval; char *stringp; int i, rowcount = -1; - const int EncodeSpecialChars = 1; if (!ast_custom_function_find("CURL")) { ast_log(LOG_ERROR, "func_curl.so must be loaded in order to use res_config_curl.so!!\n"); @@ -250,14 +247,14 @@ static int update_curl(const char *url, const char *unused, const char *keyfield return -1; } - ast_uri_encode(keyfield, buf1, sizeof(buf1), EncodeSpecialChars); - ast_uri_encode(lookup, buf2, sizeof(buf2), EncodeSpecialChars); + ast_uri_encode(keyfield, buf1, sizeof(buf1), ast_uri_http); + ast_uri_encode(lookup, buf2, sizeof(buf2), ast_uri_http); ast_str_set(&query, 0, "${CURL(%s/update?%s=%s,", url, buf1, buf2); for (i = 0; (newparam = va_arg(ap, const char *)); i++) { newval = va_arg(ap, const char *); - ast_uri_encode(newparam, buf1, sizeof(buf1), EncodeSpecialChars); - ast_uri_encode(newval, buf2, sizeof(buf2), EncodeSpecialChars); + ast_uri_encode(newparam, buf1, sizeof(buf1), ast_uri_http); + ast_uri_encode(newval, buf2, sizeof(buf2), ast_uri_http); ast_str_append(&query, 0, "%s%s=%s", i > 0 ? "&" : "", buf1, buf2); } va_end(ap); @@ -286,7 +283,6 @@ static int update2_curl(const char *url, const char *unused, va_list ap) const char *newparam, *newval; char *stringp; int rowcount = -1, lookup = 1, first = 1; - const int EncodeSpecialChars = 1; if (!ast_custom_function_find("CURL")) { ast_log(LOG_ERROR, "func_curl.so must be loaded in order to use res_config_curl.so!!\n"); @@ -315,8 +311,8 @@ static int update2_curl(const char *url, const char *unused, va_list ap) } } newval = va_arg(ap, const char *); - ast_uri_encode(newparam, buf1, sizeof(buf1), EncodeSpecialChars); - ast_uri_encode(newval, buf2, sizeof(buf2), EncodeSpecialChars); + ast_uri_encode(newparam, buf1, sizeof(buf1), ast_uri_http); + ast_uri_encode(newval, buf2, sizeof(buf2), ast_uri_http); ast_str_append(&query, 0, "%s%s=%s", first ? "" : "&", buf1, buf2); first = 0; } @@ -363,7 +359,6 @@ static int store_curl(const char *url, const char *unused, va_list ap) const char *newparam, *newval; char *stringp; int i, rowcount = -1; - const int EncodeSpecialChars = 1; if (!ast_custom_function_find("CURL")) { ast_log(LOG_ERROR, "func_curl.so must be loaded in order to use res_config_curl.so!!\n"); @@ -382,8 +377,8 @@ static int store_curl(const char *url, const char *unused, va_list ap) for (i = 0; (newparam = va_arg(ap, const char *)); i++) { newval = va_arg(ap, const char *); - ast_uri_encode(newparam, buf1, sizeof(buf1), EncodeSpecialChars); - ast_uri_encode(newval, buf2, sizeof(buf2), EncodeSpecialChars); + ast_uri_encode(newparam, buf1, sizeof(buf1), ast_uri_http); + ast_uri_encode(newval, buf2, sizeof(buf2), ast_uri_http); ast_str_append(&query, 0, "%s%s=%s", i > 0 ? "&" : "", buf1, buf2); } va_end(ap); @@ -426,7 +421,6 @@ static int destroy_curl(const char *url, const char *unused, const char *keyfiel const char *newparam, *newval; char *stringp; int i, rowcount = -1; - const int EncodeSpecialChars = 1; if (!ast_custom_function_find("CURL")) { ast_log(LOG_ERROR, "func_curl.so must be loaded in order to use res_config_curl.so!!\n"); @@ -441,14 +435,14 @@ static int destroy_curl(const char *url, const char *unused, const char *keyfiel return -1; } - ast_uri_encode(keyfield, buf1, sizeof(buf1), EncodeSpecialChars); - ast_uri_encode(lookup, buf2, sizeof(buf2), EncodeSpecialChars); + ast_uri_encode(keyfield, buf1, sizeof(buf1), ast_uri_http); + ast_uri_encode(lookup, buf2, sizeof(buf2), ast_uri_http); ast_str_set(&query, 0, "${CURL(%s/destroy,%s=%s&", url, buf1, buf2); for (i = 0; (newparam = va_arg(ap, const char *)); i++) { newval = va_arg(ap, const char *); - ast_uri_encode(newparam, buf1, sizeof(buf1), EncodeSpecialChars); - ast_uri_encode(newval, buf2, sizeof(buf2), EncodeSpecialChars); + ast_uri_encode(newparam, buf1, sizeof(buf1), ast_uri_http); + ast_uri_encode(newval, buf2, sizeof(buf2), ast_uri_http); ast_str_append(&query, 0, "%s%s=%s", i > 0 ? "&" : "", buf1, buf2); } va_end(ap); @@ -475,7 +469,6 @@ static int require_curl(const char *url, const char *unused, va_list ap) struct ast_str *query, *buffer; char *elm, field[256]; int type, size; - const int EncodeSpecialChars = 1; if (!ast_custom_function_find("CURL")) { ast_log(LOG_ERROR, "func_curl.so must be loaded in order to use res_config_curl.so!!\n"); @@ -495,7 +488,7 @@ static int require_curl(const char *url, const char *unused, va_list ap) while ((elm = va_arg(ap, char *))) { type = va_arg(ap, require_type); size = va_arg(ap, int); - ast_uri_encode(elm, field, sizeof(field), EncodeSpecialChars); + ast_uri_encode(elm, field, sizeof(field), ast_uri_http); ast_str_append(&query, 0, "%s=%s%%3A%d", field, type == RQ_CHAR ? "char" : type == RQ_INTEGER1 ? "integer1" : @@ -525,7 +518,6 @@ static struct ast_config *config_curl(const char *url, const char *unused, const struct ast_str *query, *buffer; char buf1[200]; char *stringp, *line, *pair, *key; - const int EncodeSpecialChars = 1; int last_cat_metric = -1, cat_metric = -1; struct ast_category *cat = NULL; char *cur_cat = ""; @@ -545,7 +537,7 @@ static struct ast_config *config_curl(const char *url, const char *unused, const return NULL; } - ast_uri_encode(file, buf1, sizeof(buf1), EncodeSpecialChars); + ast_uri_encode(file, buf1, sizeof(buf1), ast_uri_http); ast_str_set(&query, 0, "${CURL(%s/static?file=%s)}", url, buf1); /* Do the CURL query */ @@ -562,9 +554,9 @@ static struct ast_config *config_curl(const char *url, const char *unused, const while ((pair = strsep(&line, "&"))) { key = strsep(&pair, "="); - ast_uri_decode(key); + ast_uri_decode(key, ast_uri_http); if (pair) { - ast_uri_decode(pair); + ast_uri_decode(pair, ast_uri_http); } if (!strcasecmp(key, "category")) { |