]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Bug #420: Deal properly with null elements in lists (Connection and other list headers)
authorHenrik Nordstrom <henrik@henriknordstrom.net>
Mon, 31 Mar 2008 23:16:39 +0000 (01:16 +0200)
committerHenrik Nordstrom <henrik@henriknordstrom.net>
Mon, 31 Mar 2008 23:16:39 +0000 (01:16 +0200)
need to deal with whitespace-only null elements

ConnectIon: , , , X-Delete-Me , , ,

src/HttpHeaderTools.cc

index 17daefa6adc7da079bd09b75faa887cc4e4945d0..1b4b9a4f0cf41e116398e3aeac4d12425811466a 100644 (file)
@@ -246,13 +246,16 @@ 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"
+    };
     int quoted = 0;
     assert(str && item && pos);
 
     delim[0][1] = del;
+    delim[2][1] = del;
 
     if (*pos) {
         if (!**pos)            /* end of string */
@@ -266,11 +269,8 @@ strListGetItem(const String * str, char del, const char **item, int *ilen, const
             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 */