From 3abcd16d79873e58bd08bcaa94dfc66867188fc3 Mon Sep 17 00:00:00 2001 From: hniksic Date: Mon, 15 Sep 2003 03:35:01 -0700 Subject: [PATCH] [svn] Allow trailing whitespace in Set-Cookies. Also allow empty Set-Cookies without spewing an error. Message-ID: . --- src/ChangeLog | 7 +++++++ src/cookies.c | 18 +++++++----------- 2 files changed, 14 insertions(+), 11 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index 356082d3..8d358383 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,10 @@ +2003-09-15 Hrvoje Niksic + + * cookies.c (parse_set_cookies): Allow trailing space in + set-cookies header. Also, allow any amount of whitespace, not + only one character. Allow empty set-cookies header without + spewing an error. + 2003-09-14 Hrvoje Niksic * url.c (append_uri_pathel): Use opt.restrict_file_names when diff --git a/src/cookies.c b/src/cookies.c index c31a2865..48e62c83 100644 --- a/src/cookies.c +++ b/src/cookies.c @@ -466,15 +466,17 @@ parse_set_cookies (const char *sc) const char *name_b = NULL, *name_e = NULL; const char *value_b = NULL, *value_e = NULL; - FETCH (c, p); - while (state != S_DONE && state != S_ERROR) { switch (state) { case S_NAME_PRE: - if (ISSPACE (c)) - FETCH (c, p); + /* Strip whitespace preceding the name. */ + do + FETCH1 (c, p); + while (c && ISSPACE (c)); + if (!c) + state = S_DONE; else if (ATTR_NAME_CHAR (c)) { name_b = p - 1; @@ -589,13 +591,7 @@ parse_set_cookies (const char *sc) state = S_ERROR; break; } - - if (c) - FETCH1 (c, p); - if (!c) - state = S_DONE; - else - state = S_NAME_PRE; + state = S_NAME_PRE; } break; case S_DONE: -- 2.39.2