diff options
author | Daniel Stenberg <daniel@haxx.se> | 2001-05-23 09:26:45 +0000 |
---|---|---|
committer | Daniel Stenberg <daniel@haxx.se> | 2001-05-23 09:26:45 +0000 |
commit | 8dc9f4330c4d9c16c21d6e7c1e94608b6c8f4959 (patch) | |
tree | 428966c45693a443c815462b16baf22a9e77dfa8 | |
parent | c77f77a1ce2e00f3db59e8337268325f879908fb (diff) |
Andrés García's netscape cookie file parser fix
-rw-r--r-- | lib/cookie.c | 14 |
1 files 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; |