|
|
@ -582,6 +582,10 @@ static int acf_curl_helper(struct ast_channel *chan, const char *cmd, char *info
|
|
|
|
*buf = '\0';
|
|
|
|
*buf = '\0';
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!str) {
|
|
|
|
|
|
|
|
return -1;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (ast_strlen_zero(info)) {
|
|
|
|
if (ast_strlen_zero(info)) {
|
|
|
|
ast_log(LOG_WARNING, "CURL requires an argument (URL)\n");
|
|
|
|
ast_log(LOG_WARNING, "CURL requires an argument (URL)\n");
|
|
|
|
ast_free(str);
|
|
|
|
ast_free(str);
|
|
|
@ -651,21 +655,22 @@ static int acf_curl_helper(struct ast_channel *chan, const char *cmd, char *info
|
|
|
|
int rowcount = 0;
|
|
|
|
int rowcount = 0;
|
|
|
|
while (fields && values && (piece = strsep(&remainder, "&"))) {
|
|
|
|
while (fields && values && (piece = strsep(&remainder, "&"))) {
|
|
|
|
char *name = strsep(&piece, "=");
|
|
|
|
char *name = strsep(&piece, "=");
|
|
|
|
if (!piece) {
|
|
|
|
|
|
|
|
piece = "";
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Do this before the decode, because if something has encoded
|
|
|
|
/* Do this before the decode, because if something has encoded
|
|
|
|
* a literal plus-sign, we don't want to translate that to a
|
|
|
|
* a literal plus-sign, we don't want to translate that to a
|
|
|
|
* space. */
|
|
|
|
* space. */
|
|
|
|
if (hashcompat == HASHCOMPAT_LEGACY) {
|
|
|
|
if (hashcompat == HASHCOMPAT_LEGACY) {
|
|
|
|
ast_uri_decode(piece, ast_uri_http_legacy);
|
|
|
|
if (piece) {
|
|
|
|
|
|
|
|
ast_uri_decode(piece, ast_uri_http_legacy);
|
|
|
|
|
|
|
|
}
|
|
|
|
ast_uri_decode(name, ast_uri_http_legacy);
|
|
|
|
ast_uri_decode(name, ast_uri_http_legacy);
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
ast_uri_decode(piece, ast_uri_http);
|
|
|
|
if (piece) {
|
|
|
|
|
|
|
|
ast_uri_decode(piece, ast_uri_http);
|
|
|
|
|
|
|
|
}
|
|
|
|
ast_uri_decode(name, ast_uri_http);
|
|
|
|
ast_uri_decode(name, ast_uri_http);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
ast_str_append(&fields, 0, "%s%s", rowcount ? "," : "", name);
|
|
|
|
ast_str_append(&fields, 0, "%s%s", rowcount ? "," : "", name);
|
|
|
|
ast_str_append(&values, 0, "%s%s", rowcount ? "," : "", piece);
|
|
|
|
ast_str_append(&values, 0, "%s%s", rowcount ? "," : "", S_OR(piece, ""));
|
|
|
|
rowcount++;
|
|
|
|
rowcount++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
pbx_builtin_setvar_helper(chan, "~ODBCFIELDS~", ast_str_buffer(fields));
|
|
|
|
pbx_builtin_setvar_helper(chan, "~ODBCFIELDS~", ast_str_buffer(fields));
|
|
|
|