1
0
mirror of https://github.com/rkd77/elinks.git synced 2024-06-21 00:25:37 +00:00
elinks/src/cookies/path.c
2023-09-24 10:27:29 +02:00

18 lines
373 B
C

/* Cookie path matching */
#include <string.h>
#include "cookies/path.h"
int
is_path_prefix(char *cookiepath, char *requestpath)
{
int dl = strlen(cookiepath);
if (!dl) return 1;
if (memcmp(cookiepath, requestpath, dl)) return 0;
return (!memcmp(cookiepath, requestpath, dl)
&& (cookiepath[dl - 1] == '/' || requestpath[dl] == '/' || requestpath[dl] == '\0'));
}