--------------------- PatchSet 12027 Date: 2008/04/02 01:04:20 Author: hno Branch: SQUID_2_6 Tag: (none) Log: Bug #420: Deal properly with empty list members Parse constructs such as "Connection: ,,,X-Delete-Me,,," and "Connection: , , , X-Delete-Me , , ," properly. Members: src/HttpHeaderTools.c:1.37.2.2->1.37.2.3 Index: squid/src/HttpHeaderTools.c =================================================================== RCS file: /cvsroot/squid/squid/src/HttpHeaderTools.c,v retrieving revision 1.37.2.2 retrieving revision 1.37.2.3 diff -u -r1.37.2.2 -r1.37.2.3 --- squid/src/HttpHeaderTools.c 21 Jul 2007 21:15:31 -0000 1.37.2.2 +++ squid/src/HttpHeaderTools.c 2 Apr 2008 01:04:20 -0000 1.37.2.3 @@ -1,6 +1,6 @@ /* - * $Id: HttpHeaderTools.c,v 1.37.2.2 2007/07/21 21:15:31 hno Exp $ + * $Id: HttpHeaderTools.c,v 1.37.2.3 2008/04/02 01:04:20 hno Exp $ * * DEBUG: section 66 HTTP Header Tools * AUTHOR: Alex Rousskov @@ -239,26 +239,24 @@ strListGetItem(const String * str, char del, const char **item, int *ilen, const char **pos) { size_t len; - static char delim[2][3] = + static char delim[3][8] = { - {'"', 0, 0}, - {'"', '\\', 0}}; + "\"?,", + "\"\\", + " ?,\t\r\n" + }; int quoted = 0; delim[0][1] = del; + delim[2][1] = del; assert(str && item && pos); - if (*pos) { - if (!**pos) /* end of string */ - return 0; - else - (*pos)++; - } else { + if (!*pos) { *pos = strBuf(*str); if (!*pos) return 0; } + /* skip leading whitespace and delimiters */ + *pos += strspn(*pos, delim[2]); - /* skip leading ws (ltrim) */ - *pos += xcountws(*pos); *item = *pos; /* remember item's start */ /* find next delimiter */ do {