1
0
mirror of https://github.com/rkd77/elinks.git synced 2024-06-28 01:35:32 +00:00
elinks/src/cookies/path.c
2020-05-26 20:47:31 +02:00

15 lines
344 B
C

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