From: Amos Jeffries Date: Sat, 5 Apr 2008 02:58:42 +0000 (-0600) Subject: Correct and simplify parsing of list headers X-Git-Tag: SQUID_3_0_STABLE5~27 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=decae562c319c310518f5fb2f0f15cc16565a5cc;p=thirdparty%2Fsquid.git Correct and simplify parsing of list headers Author: Henrik Nordstrom --- diff --git a/src/HttpHeaderTools.cc b/src/HttpHeaderTools.cc index a9bd6d9cf3..e9f3b3f614 100644 --- a/src/HttpHeaderTools.cc +++ b/src/HttpHeaderTools.cc @@ -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 */