+static int
+matching_cookie (const struct cookie *cookie, const char *path,
+ int connection_secure_p, int *path_goodness)
+{
+ int pg;
+
+ if (cookie->expiry_time < cookies_now)
+ /* Ignore stale cookies. There is no need to unchain the cookie
+ at this point -- Wget is a relatively short-lived application,
+ and stale cookies will not be saved by `save_cookies'. */
+ return 0;
+ if (cookie->secure && !connection_secure_p)
+ /* Don't transmit secure cookies over an insecure connection. */
+ return 0;
+ pg = path_matches (path, cookie->path);
+ if (!pg)
+ return 0;
+
+ if (path_goodness)
+ /* If the caller requested path_goodness, we return it. This is
+ an optimization, so that the caller doesn't need to call
+ path_matches() again. */
+ *path_goodness = pg;
+ return 1;
+}
+