/* If we don't know better, assume cookie is non-permanent and valid
for the entire session. */
- cookie->expiry_time = ~0UL;
+ cookie->expiry_time = ~(unsigned long)0;
/* Assume default port. */
cookie->port = 80;
result = alloca (HP_len + 1 + numdigit (port) + 1); \
memcpy (result, host, HP_len); \
result[HP_len] = ':'; \
- long_to_string (result + HP_len + 1, port); \
+ number_to_string (result + HP_len + 1, port); \
} while (0)
/* Find cookie chain that corresponds to DOMAIN (exact) and PORT. */
{
int dlen = strlen (cookie_domain);
int hlen = strlen (host);
- /* hostname.foobar.com */
- /* bar.com */
- /* ^ <-- must be '.' for host */
+ /* cookie host: hostname.foobar.com */
+ /* desired domain: bar.com */
+ /* '.' must be here in host-> ^ */
if (hlen > dlen && host[hlen - dlen - 1] != '.')
return 0;
}
SIZE matches are written; if more matches are present, return the
number of chains that would have been written. */
-int
+static int
find_matching_chains (const char *host, int port,
struct cookie *store[], int size)
{
{
int len;
- if (*prefix == '/')
- /* Our HTTP paths don't begin with /; do the same change to
- PREFIX. */
- ++prefix;
+ if (*prefix != '/')
+ /* Wget's HTTP paths do not begin with '/' (the URL code treats it
+ as a separator), but the '/' is assumed when matching against
+ the cookie stuff. */
+ return 0;
+ ++prefix;
len = strlen (prefix);
+
if (0 != strncmp (full_path, prefix, len))
/* FULL_PATH doesn't begin with PREFIX. */
return 0;