From b5c8ff590ca07a622360d153dedb8a3d15461a31 Mon Sep 17 00:00:00 2001 From: Henrik Nordstrom Date: Tue, 1 Apr 2008 01:16:39 +0200 Subject: [PATCH] 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 , , , --- src/HttpHeaderTools.cc | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) 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 */ -- 2.47.3