--------------------- PatchSet 12024 Date: 2008/04/02 01:00:11 Author: hno Branch: SQUID_2_7 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.41->1.41.2.1 Index: squid/src/HttpHeaderTools.c =================================================================== RCS file: /cvsroot/squid/squid/src/HttpHeaderTools.c,v retrieving revision 1.41 retrieving revision 1.41.2.1 diff -u -r1.41 -r1.41.2.1 --- squid/src/HttpHeaderTools.c 20 Jul 2007 21:20:49 -0000 1.41 +++ squid/src/HttpHeaderTools.c 2 Apr 2008 01:00:11 -0000 1.41.2.1 @@ -1,6 +1,6 @@ /* - * $Id: HttpHeaderTools.c,v 1.41 2007/07/20 21:20:49 hno Exp $ + * $Id: HttpHeaderTools.c,v 1.41.2.1 2008/04/02 01:00:11 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 {