/* 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
-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
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
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));
}
}
struct cookie *cookie = cookie_new ();
param_token name, value;
- if (!extract_param (&ptr, &name, &value))
+ if (!extract_param (&ptr, &name, &value, ';'))
goto error;
if (!value.b)
goto error;
cookie->attr = strdupdelim (name.b, name.e);
cookie->value = strdupdelim (value.b, value.e);
- while (extract_param (&ptr, &name, &value))
+ while (extract_param (&ptr, &name, &value, ';'))
{
if (TOKEN_IS (name, "domain"))
{
{
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.) */
;
-
- /* 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"))
{
}
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);
param_token name, value;
const char *ptr = data;
int j = 0;
- while (extract_param (&ptr, &name, &value))
+ while (extract_param (&ptr, &name, &value, ';'))
{
char *n = strdupdelim (name.b, name.e);
char *v = strdupdelim (value.b, value.e);