]> sjero.net Git - wget/blobdiff - src/cookies.c
[svn] Merge of fix for bugs 20341 and 20410.
[wget] / src / cookies.c
index 29f539644d1dd77c9d36a4cfb6bc1d2e492f2ca9..4f7d2ac39a1282a18cd93d5d75e64286c265a83e 100644 (file)
@@ -1,11 +1,11 @@
 /* Support for cookies.
 /* Support for cookies.
-   Copyright (C) 2001-2005 Free Software Foundation, Inc.
+   Copyright (C) 2001-2006 Free Software Foundation, Inc.
 
 This file is part of GNU Wget.
 
 GNU Wget is free software; you can redistribute it and/or modify
 it under the terms of the GNU General Public License as published by
 
 This file is part of GNU Wget.
 
 GNU Wget is free software; you can redistribute it and/or modify
 it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or (at
+the Free Software Foundation; either version 3 of the License, or (at
 your option) any later version.
 
 GNU Wget is distributed in the hope that it will be useful, but
 your option) any later version.
 
 GNU Wget is distributed in the hope that it will be useful, but
@@ -14,8 +14,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 General Public License for more details.
 
 You should have received a copy of the GNU General Public License
 General Public License for more details.
 
 You should have received a copy of the GNU General Public License
-along with Wget; if not, write to the Free Software Foundation, Inc.,
-51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+along with Wget.  If not, see <http://www.gnu.org/licenses/>.
 
 In addition, as a special exception, the Free Software Foundation
 gives permission to link the code of its release of Wget with the
 
 In addition, as a special exception, the Free Software Foundation
 gives permission to link the code of its release of Wget with the
@@ -265,7 +264,7 @@ store_cookie (struct cookie_jar *jar, struct cookie *cookie)
               cookie->path,
               cookie->permanent ? "permanent" : "session",
               cookie->secure ? "secure" : "insecure",
               cookie->path,
               cookie->permanent ? "permanent" : "session",
               cookie->secure ? "secure" : "insecure",
-              cookie->expiry_time ? datetime_str (&exptime) : "none",
+              cookie->expiry_time ? datetime_str (exptime) : "none",
               cookie->attr, cookie->value));
     }
 }
               cookie->attr, cookie->value));
     }
 }
@@ -390,17 +389,16 @@ parse_set_cookie (const char *set_cookie, bool silent)
            {
              cookie->permanent = 1;
              cookie->expiry_time = expires;
            {
              cookie->permanent = 1;
              cookie->expiry_time = expires;
+             /* According to netscape's specification, expiry time in
+                the past means that discarding of a matching cookie
+                is requested.  */
+             if (cookie->expiry_time < cookies_now)
+               cookie->discard_requested = 1;
            }
          else
            /* Error in expiration spec.  Assume default (cookie doesn't
               expire, but valid only for this session.)  */
            ;
            }
          else
            /* Error in expiration spec.  Assume default (cookie doesn't
               expire, but valid only for this session.)  */
            ;
-
-         /* According to netscape's specification, expiry time in the
-            past means that discarding of a matching cookie is
-            requested.  */
-         if (cookie->expiry_time < cookies_now)
-           cookie->discard_requested = 1;
        }
       else if (TOKEN_IS (name, "max-age"))
        {
        }
       else if (TOKEN_IS (name, "max-age"))
        {
@@ -1255,7 +1253,7 @@ cookie_jar_save (struct cookie_jar *jar, const char *file)
     }
 
   fputs ("# HTTP cookie file.\n", fp);
     }
 
   fputs ("# HTTP cookie file.\n", fp);
-  fprintf (fp, "# Generated by Wget on %s.\n", datetime_str (&cookies_now));
+  fprintf (fp, "# Generated by Wget on %s.\n", datetime_str (cookies_now));
   fputs ("# Edit at your own risk.\n\n", fp);
 
   for (hash_table_iterate (jar->chains, &iter);
   fputs ("# Edit at your own risk.\n\n", fp);
 
   for (hash_table_iterate (jar->chains, &iter);