0
0
mirror of https://github.com/rkd77/elinks.git synced 2025-06-30 22:19:29 -04:00
elinks/src/cookies/path.c
Witold Filipczyk 73fff45f01 [debug] ELOG for debugging purposes
ELOG can be defined to print information about called functions
2025-05-06 13:02:02 +02:00

19 lines
381 B
C

/* Cookie path matching */
#include <string.h>
#include "cookies/path.h"
int
is_path_prefix(char *cookiepath, char *requestpath)
{
//ELOG
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'));
}