mirror of
https://github.com/moparisthebest/wget
synced 2024-07-03 16:38:41 -04:00
[svn] Fix loading of cookies.
Published in <sxslmopyao6.fsf@florida.arsdigita.de>.
This commit is contained in:
parent
425b5af0c9
commit
f0eb1fb758
@ -1,3 +1,10 @@
|
|||||||
|
2001-04-25 Hrvoje Niksic <hniksic@arsdigita.com>
|
||||||
|
|
||||||
|
* http.c (http_loop): Would load cookies every time.
|
||||||
|
|
||||||
|
* cookies.c (load_cookies): Handle cookies whose values contain
|
||||||
|
embedded spaces.
|
||||||
|
|
||||||
2001-04-25 Hrvoje Niksic <hniksic@arsdigita.com>
|
2001-04-25 Hrvoje Niksic <hniksic@arsdigita.com>
|
||||||
|
|
||||||
* utils.c: Define each DIGITS_* in one line.
|
* utils.c: Define each DIGITS_* in one line.
|
||||||
|
@ -1192,7 +1192,7 @@ domain_port (const char *domain_b, const char *domain_e,
|
|||||||
++p; \
|
++p; \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
#define MARK_WORD(p, b, e) do { \
|
#define SET_WORD_BOUNDARIES(p, b, e) do { \
|
||||||
SKIP_WS (p); \
|
SKIP_WS (p); \
|
||||||
b = p; \
|
b = p; \
|
||||||
/* skip non-ws */ \
|
/* skip non-ws */ \
|
||||||
@ -1239,16 +1239,25 @@ load_cookies (const char *file)
|
|||||||
/* empty line */
|
/* empty line */
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
MARK_WORD (p, domain_b, domain_e);
|
SET_WORD_BOUNDARIES (p, domain_b, domain_e);
|
||||||
MARK_WORD (p, ignore_b, ignore_e);
|
SET_WORD_BOUNDARIES (p, ignore_b, ignore_e);
|
||||||
MARK_WORD (p, path_b, path_e);
|
SET_WORD_BOUNDARIES (p, path_b, path_e);
|
||||||
MARK_WORD (p, secure_b, secure_e);
|
SET_WORD_BOUNDARIES (p, secure_b, secure_e);
|
||||||
MARK_WORD (p, expires_b, expires_e);
|
SET_WORD_BOUNDARIES (p, expires_b, expires_e);
|
||||||
MARK_WORD (p, name_b, name_e);
|
SET_WORD_BOUNDARIES (p, name_b, name_e);
|
||||||
|
|
||||||
/* Don't use MARK_WORD for value because it may contain
|
/* Don't use SET_WORD_BOUNDARIES for value because it may
|
||||||
whitespace itself. Instead, . */
|
contain whitespace. Instead, set value_e to the end of line,
|
||||||
MARK_WORD (p, value_b, value_e);
|
modulo trailing space (this will skip the line separator.) */
|
||||||
|
SKIP_WS (p);
|
||||||
|
value_b = p;
|
||||||
|
value_e = p + strlen (p);
|
||||||
|
while (value_e > value_b && ISSPACE (*(value_e - 1)))
|
||||||
|
--value_e;
|
||||||
|
if (value_b == value_e)
|
||||||
|
/* Hmm, should we check for empty value? I guess that's
|
||||||
|
legal, so I leave it. */
|
||||||
|
;
|
||||||
|
|
||||||
cookie = cookie_new ();
|
cookie = cookie_new ();
|
||||||
|
|
||||||
@ -1269,19 +1278,6 @@ load_cookies (const char *file)
|
|||||||
|
|
||||||
cookie->domain = strdupdelim (domain_b, domain_e);
|
cookie->domain = strdupdelim (domain_b, domain_e);
|
||||||
|
|
||||||
/* Don't use MARK_WORD for value because it may contain
|
|
||||||
whitespace itself. Instead, set name_e to the end of line,
|
|
||||||
modulo trailing space (which includes the NL separator.) */
|
|
||||||
SKIP_WS (p);
|
|
||||||
name_b = p;
|
|
||||||
name_e = p + strlen (p);
|
|
||||||
while (name_e >= name_b && ISSPACE (*name_e))
|
|
||||||
--name_e;
|
|
||||||
if (name_b == name_e)
|
|
||||||
/* Hmm, should we check for empty value? I guess that's
|
|
||||||
legal, so I leave it. */
|
|
||||||
;
|
|
||||||
|
|
||||||
/* safe default in case EXPIRES field is garbled. */
|
/* safe default in case EXPIRES field is garbled. */
|
||||||
cookie->expiry_time = cookies_now - 1;
|
cookie->expiry_time = cookies_now - 1;
|
||||||
|
|
||||||
|
@ -1381,7 +1381,10 @@ http_loop (struct urlinfo *u, char **newloc, int *dt)
|
|||||||
here so that we don't go through the hoops if we're just using
|
here so that we don't go through the hoops if we're just using
|
||||||
FTP or whatever. */
|
FTP or whatever. */
|
||||||
if (opt.cookies && opt.cookies_input && !cookies_loaded_p)
|
if (opt.cookies && opt.cookies_input && !cookies_loaded_p)
|
||||||
|
{
|
||||||
load_cookies (opt.cookies_input);
|
load_cookies (opt.cookies_input);
|
||||||
|
cookies_loaded_p = 1;
|
||||||
|
}
|
||||||
|
|
||||||
*newloc = NULL;
|
*newloc = NULL;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user