]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MINOR: mux-fcgi: Don't compare the filter name in its parsing callback
authorChristopher Faulet <cfaulet@haproxy.com>
Wed, 18 Sep 2019 09:18:33 +0000 (11:18 +0200)
committerChristopher Faulet <cfaulet@haproxy.com>
Wed, 18 Sep 2019 09:20:55 +0000 (11:20 +0200)
The function parse_fcgi_flt() is called when the keyword "fcgi-app" is found on
a filter line. We don't need to compare it again in the function.

This patch fixes the issue #284. No backport needed.

src/fcgi-app.c

index aeda8216b073647af0cdedac5def4d04f0e55324..1c1573c2525e08e3260cc1104b3fad9429d754db 100644 (file)
@@ -525,18 +525,17 @@ parse_fcgi_flt(char **args, int *cur_arg, struct proxy *px,
        int pos = *cur_arg;
 
        /* Get the fcgi-app name*/
-       if (!strcmp(args[pos], "fcgi-app")) {
-               if (!*args[pos + 1]) {
-                       memprintf(err, "%s : expects a <name> argument", args[pos]);
-                       goto err;
-               }
-               name = strdup(args[pos + 1]);
-               if (!name) {
-                       memprintf(err, "%s '%s' : out of memory", args[pos], args[pos + 1]);
-                       goto err;
-               }
-               pos += 2;
+       if (!*args[pos + 1]) {
+               memprintf(err, "%s : expects a <name> argument", args[pos]);
+               goto err;
+       }
+       name = strdup(args[pos + 1]);
+       if (!name) {
+               memprintf(err, "%s '%s' : out of memory", args[pos], args[pos + 1]);
+               goto err;
        }
+       pos += 2;
+
        /* Check if an fcgi-app filter with the same name already exists */
        list_for_each_entry_safe(f, back, &px->filter_configs, list) {
                if (f->id != fcgi_flt_id)
@@ -575,7 +574,6 @@ parse_fcgi_flt(char **args, int *cur_arg, struct proxy *px,
        return 0;
   err:
        free(name);
-       //free(fcgi_conf);
        return -1;
 }