]> sjero.net Git - wget/blobdiff - src/cookies.c
[svn] Don't expect HTTP paths to begin with '/'.
[wget] / src / cookies.c
index a0937e348cc67e2e3c6aae64df7c0106f7da50c1..74316791da3591d2e3f3a9e11b1cb8ca3d9da114 100644 (file)
@@ -869,13 +869,20 @@ find_matching_chains (const char *host, int port,
 static int
 path_matches (const char *full_path, const char *prefix)
 {
-  int len = strlen (prefix);
-  if (strncmp (full_path, prefix, len))
+  int len;
+
+  if (*prefix == '/')
+    /* Our HTTP paths don't begin with /; do the same change to
+       PREFIX.  */
+    ++prefix;
+
+  len = strlen (prefix);
+  if (0 != strncmp (full_path, prefix, len))
     /* FULL_PATH doesn't begin with PREFIX. */
     return 0;
 
   /* Length of PREFIX determines the quality of the match. */
-  return len;
+  return len + 1;
 }
 
 static int