From: Henrik Nordstrom Date: Mon, 31 Mar 2008 23:16:39 +0000 (+0200) Subject: Bug #420: Deal properly with null elements in lists (Connection and other list headers) X-Git-Tag: BASIC_TPROXY4~4^2~10^2~3 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=b5c8ff590ca07a622360d153dedb8a3d15461a31;p=thirdparty%2Fsquid.git Bug #420: Deal properly with null elements in lists (Connection and other list headers) need to deal with whitespace-only null elements ConnectIon: , , , X-Delete-Me , , , --- diff --git a/src/HttpHeaderTools.cc b/src/HttpHeaderTools.cc index 17daefa6ad..1b4b9a4f0c 100644 --- a/src/HttpHeaderTools.cc +++ b/src/HttpHeaderTools.cc @@ -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 */