]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
Andrés García's netscape cookie file parser fix
authorDaniel Stenberg <daniel@haxx.se>
Wed, 23 May 2001 09:26:45 +0000 (09:26 +0000)
committerDaniel Stenberg <daniel@haxx.se>
Wed, 23 May 2001 09:26:45 +0000 (09:26 +0000)
lib/cookie.c

index d1c308304ecf7bf51b1df8ad4e6d31b8e4701e3f..3c4034c423765ed78cefc020295d1457176eb541 100644 (file)
@@ -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;