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

18 lines
373 B
C
Raw Permalink Normal View History

/* Cookie path matching */
#include <string.h>
#include "cookies/path.h"
int
is_path_prefix(char *cookiepath, char *requestpath)
{
int dl = strlen(cookiepath);
2023-09-24 04:27:29 -04:00
if (!dl) return 1;
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'));
}