1
0
mirror of https://github.com/rkd77/elinks.git synced 2024-09-29 03:17:53 -04:00
elinks/src/cookies/path.c

15 lines
344 B
C
Raw Normal View History

/* 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;
2020-05-26 14:47:31 -04:00
return (!memcmp(cookiepath, requestpath, dl)
&& (cookiepath[dl - 1] == '/' || requestpath[dl] == '/' || requestpath[dl] == '\0'));
}