]> sjero.net Git - wget/blobdiff - src/cookies.c
[svn] Allow Wget to be compiled with a K&R compiler.
[wget] / src / cookies.c
index 74316791da3591d2e3f3a9e11b1cb8ca3d9da114..18e6c8f9f11ddfcd4ef4f11187c857a3de5d7389 100644 (file)
@@ -84,7 +84,7 @@ cookie_new (void)
 
   /* 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;
@@ -121,7 +121,7 @@ delete_cookie (struct cookie *cookie)
   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.  */
@@ -726,9 +726,9 @@ check_domain_match (const char *cookie_domain, const char *host)
     {
       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;
     }
@@ -825,7 +825,7 @@ set_cookie_header_cb (const char *hdr, void *closure)
    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)
 {
@@ -871,12 +871,15 @@ path_matches (const char *full_path, const char *prefix)
 {
   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;