]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
Properly delimit post data in res_config_curl.
authorSean Bright <sean@malleable.com>
Mon, 25 Mar 2013 12:35:13 +0000 (12:35 +0000)
committerSean Bright <sean@malleable.com>
Mon, 25 Mar 2013 12:35:13 +0000 (12:35 +0000)
git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.8@383667 65c4cc65-6c06-0410-ace0-fbb531ad65f3

res/res_config_curl.c

index 8ab35cd595daaa5bd5f5ca7c0bb02d98e608e2f8..a97fb1466f531f249b020ca44d39464a1412f956 100644 (file)
@@ -469,7 +469,7 @@ 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;
+       int type, size, i = 0;
        const int EncodeSpecialChars = 1;
 
        if (!ast_custom_function_find("CURL")) {
@@ -491,7 +491,9 @@ static int require_curl(const char *url, const char *unused, va_list ap)
                type = va_arg(ap, require_type);
                size = va_arg(ap, int);
                ast_uri_encode(elm, field, sizeof(field), EncodeSpecialChars);
-               ast_str_append(&query, 0, "%s=%s%%3A%d", field,
+               ast_str_append(&query, 0, "%s%s=%s%%3A%d",
+                       i > 0 ? "&" : "",
+                       field,
                        type == RQ_CHAR ? "char" :
                        type == RQ_INTEGER1 ? "integer1" :
                        type == RQ_UINTEGER1 ? "uinteger1" :
@@ -507,6 +509,7 @@ static int require_curl(const char *url, const char *unused, va_list ap)
                        type == RQ_DATETIME ? "datetime" :
                        type == RQ_FLOAT ? "float" :
                        "unknown", size);
+               i++;
        }
 
        ast_str_append(&query, 0, ")}");