]> sjero.net Git - wget/commitdiff
[svn] Allow trailing whitespace in Set-Cookies. Also allow empty Set-Cookies
authorhniksic <devnull@localhost>
Mon, 15 Sep 2003 10:35:01 +0000 (03:35 -0700)
committerhniksic <devnull@localhost>
Mon, 15 Sep 2003 10:35:01 +0000 (03:35 -0700)
without spewing an error.
Message-ID: <m365jucpci.fsf@xemacs.org>.

src/ChangeLog
src/cookies.c

index 356082d3e0c87242d33235abd8e4a82a82061885..8d35838385e62bb8a146a190e7de5d4381549608 100644 (file)
@@ -1,3 +1,10 @@
+2003-09-15  Hrvoje Niksic  <hniksic@xemacs.org>
+
+       * 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  <hniksic@xemacs.org>
 
        * url.c (append_uri_pathel): Use opt.restrict_file_names when
index c31a286524da6aa6532714cc9395a1bf1f5ef1f7..48e62c8322eaac4816ae3b2e2216a08f5bacae03 100644 (file)
@@ -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: