1
0
mirror of https://github.com/rkd77/elinks.git synced 2024-10-07 04:53:37 -04:00
elinks/src/cookies/path.c
Witold Filipczyk 0fea79cc8f [cflags] Removed -Wno-pointer-sign
Likely some new bugs were introduced by this change.
The long term goal is clean compilation by g++.
2021-01-02 16:20:27 +01:00

16 lines
352 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 (memcmp(cookiepath, requestpath, dl)) return 0;
return (!memcmp(cookiepath, requestpath, dl)
&& (cookiepath[dl - 1] == '/' || requestpath[dl] == '/' || requestpath[dl] == '\0'));
}