From 8dc9f4330c4d9c16c21d6e7c1e94608b6c8f4959 Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Wed, 23 May 2001 09:26:45 +0000 Subject: [PATCH] =?UTF-8?q?Andr=E9s=20Garc=EDa's=20netscape=20cookie=20fil?= =?UTF-8?q?e=20parser=20fix?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/cookie.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/lib/cookie.c b/lib/cookie.c index d1c308304..3c4034c42 100644 --- a/lib/cookie.c +++ b/lib/cookie.c @@ -233,8 +233,18 @@ Curl_cookie_add(struct CookieInfo *c, /* what _is_ this field for? */ break; case 2: - co->path = strdup(ptr); - break; + /* It turns out, that sometimes the file format allows the path + field to remain not filled in, we try to detect this and work + around it! Andrés García made us aware of this... */ + if (strcmp("TRUE", ptr) && strcmp("FALSE", ptr)) { + /* only if the path doesn't look like a boolean option! */ + co->path = strdup(ptr); + break; + } + /* this doesn't look like a path, make one up! */ + co->path = strdup("/"); + fields++; /* add a field and fall down to secure */ + /* FALLTHROUGH */ case 3: co->secure = strequal(ptr, "TRUE"); break;