]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Correct and simplify parsing of list headers
authorAmos Jeffries <amosjeffries@squid-cache.org>
Sat, 5 Apr 2008 02:58:42 +0000 (20:58 -0600)
committerAmos Jeffries <amosjeffries@squid-cache.org>
Sat, 5 Apr 2008 02:58:42 +0000 (20:58 -0600)
Author: Henrik Nordstrom <hno@squid-cache.org>

src/HttpHeaderTools.cc

index a9bd6d9cf307306008142b657da779d748e3e8da..e9f3b3f6145ea8873c88281482edb8f8e2e699b9 100644 (file)
@@ -246,31 +246,26 @@ int
 strListGetItem(const String * str, char del, const char **item, int *ilen, const char **pos)
 {
     size_t len;
-    static char delim[2][3] = {
-                                  { '"', '?', 0},
-                                  { '"', '\\', 0}};
+    static char delim[3][8] = {
+                       "\"?,",
+                       "\"\\",
+                       " ?,\t\r\n"
+    };
     int quoted = 0;
     assert(str && item && pos);
 
     delim[0][1] = del;
+    delim[2][1] = del;
 
-    if (*pos) {
-        if (!**pos)            /* end of string */
-            return 0;
-        else
-            (*pos)++;
-    } else {
+    if (!*pos) {
         *pos = str->buf();
 
         if (!*pos)
             return 0;
     }
 
-    /* skip leading ws (ltrim) */
-    *pos += xcountws(*pos);
-
-    /* skip leading delimiters */
-    *pos += strspn(*pos, delim[0]);
+    /* skip leading ws and delimiters */
+    *pos += strspn(*pos, delim[2]);
 
     *item = *pos;              /* remember item's start */