diff options
-rw-r--r-- | DOCS/man/en/options.rst | 3 | ||||
-rw-r--r-- | stream/cookies.c | 45 |
2 files changed, 4 insertions, 44 deletions
diff --git a/DOCS/man/en/options.rst b/DOCS/man/en/options.rst index 38a615ea72..6b8041c192 100644 --- a/DOCS/man/en/options.rst +++ b/DOCS/man/en/options.rst @@ -435,8 +435,7 @@ --cookies-file=<filename> (network only) - Read HTTP cookies from <filename> (default: ``~/.mozilla/`` and - ``~/.netscape/``) and skip reading from default locations. The file is + Read HTTP cookies from <filename>. The file is assumed to be in Netscape format. --correct-pts, --no-correct-pts diff --git a/stream/cookies.c b/stream/cookies.c index d4ae1afab0..2680bf1834 100644 --- a/stream/cookies.c +++ b/stream/cookies.c @@ -181,52 +181,13 @@ static struct cookie_list_type *load_cookies_from(const char *filename, return list; } -/* Attempt to load cookies.txt from various locations. Returns a pointer to the linked list contain the cookies. */ +/* Attempt to load cookies.txt. Returns a pointer to the linked list contain the cookies. */ static struct cookie_list_type *load_cookies(void) { - DIR *dir; - struct dirent *ent; - struct cookie_list_type *list = NULL; - char *buf; - - char *homedir; - if (cookies_file) - return load_cookies_from(cookies_file, list); - - homedir = getenv("HOME"); - if (!homedir) - return list; - + return load_cookies_from(cookies_file, NULL); - buf = malloc(strlen(homedir) + sizeof("/.mozilla/default") + 1); - sprintf(buf, "%s/.mozilla/default", homedir); - dir = opendir(buf); - free(buf); - - if (dir) { - while ((ent = readdir(dir)) != NULL) { - if ((ent->d_name)[0] != '.') { - const char *home = getenv("HOME"); - unsigned len = strlen(home) + - sizeof("/.mozilla/default/") + - strlen(ent->d_name) + sizeof("cookies.txt") + 1; - buf = malloc(len); - snprintf(buf, len, "%s/.mozilla/default/%s/cookies.txt", - home, ent->d_name); - list = load_cookies_from(buf, list); - free(buf); - } - } - closedir(dir); - } - - buf = malloc(strlen(homedir) + sizeof("/.netscape/cookies.txt") + 1); - sprintf(buf, "%s/.netscape/cookies.txt", homedir); - list = load_cookies_from(buf, list); - free(buf); - - return list; + return NULL; } /* Take an HTTP_header_t, and insert the correct headers. The cookie files are read if necessary. */ |