1
0
mirror of https://github.com/rkd77/elinks.git synced 2024-11-04 08:17:17 -05:00
elinks/src/cookies/path.c

21 lines
370 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);
int sl = strlen(requestpath);
if (dl > sl) return 0;
if (memcmp(cookiepath, requestpath, dl)) return 0;
if (dl == sl) return 1;
if (cookiepath[dl - 1] == '/') return 1;
return (requestpath[dl] == '/');
}