]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
[MINOR] config: support a comma-separated list of store data types in stick-table
authorWilly Tarreau <w@1wt.eu>
Sat, 19 Jun 2010 05:12:36 +0000 (07:12 +0200)
committerWilly Tarreau <w@1wt.eu>
Tue, 10 Aug 2010 16:04:13 +0000 (18:04 +0200)
Sometimes we need to store many data types in stick-tables. Let's support a
comma-separated list instead of repeating "store" with each keyword.

src/cfgparse.c

index 871310b66b2cda70fd1b5bd0fbe9b831638ab230..69ab56606539020b0b6c3688a6814d9f86581cb9 100644 (file)
@@ -2276,19 +2276,29 @@ int cfg_parse_listen(const char *file, int linenum, char **args, int kwm)
                        }
                        else if (strcmp(args[myidx], "store") == 0) {
                                int type;
+                               char *cw, *nw;
 
                                myidx++;
-                               type = stktable_get_data_type(args[myidx]);
-                               if (type < 0) {
-                                       Alert("parsing [%s:%d] : %s: unknown store option '%s'.\n",
-                                             file, linenum, args[0], args[myidx]);
-                                       err_code |= ERR_ALERT | ERR_FATAL;
-                                       goto out;
-                               }
-                               if (!stktable_alloc_data_type(&curproxy->table, type)) {
-                                       Warning("parsing [%s:%d]: %s: store option '%s' already enabled, ignored.\n",
-                                               file, linenum, args[0], args[myidx]);
-                                       err_code |= ERR_WARN;
+                               nw = args[myidx];
+                               while (*nw) {
+                                       /* the "store" keyword supports a comma-separated list */
+                                       cw = nw;
+                                       while (*nw && *nw != ',')
+                                               nw++;
+                                       if (*nw)
+                                               *nw++ = '\0';
+                                       type = stktable_get_data_type(cw);
+                                       if (type < 0) {
+                                               Alert("parsing [%s:%d] : %s: unknown store option '%s'.\n",
+                                                     file, linenum, args[0], cw);
+                                               err_code |= ERR_ALERT | ERR_FATAL;
+                                               goto out;
+                                       }
+                                       if (!stktable_alloc_data_type(&curproxy->table, type)) {
+                                               Warning("parsing [%s:%d]: %s: store option '%s' already enabled, ignored.\n",
+                                                       file, linenum, args[0], cw);
+                                               err_code |= ERR_WARN;
+                                       }
                                }
                                myidx++;
                        }