1
0
mirror of https://github.com/rkd77/elinks.git synced 2024-06-25 01:05:37 +00:00

[cookies] Slightly modified path.c

This commit is contained in:
Witold Filipczyk 2020-05-26 20:47:31 +02:00
parent 61e7b3f0b1
commit 8ba7176f81

View File

@ -6,15 +6,9 @@ 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] == '/');
return (!memcmp(cookiepath, requestpath, dl)
&& (cookiepath[dl - 1] == '/' || requestpath[dl] == '/' || requestpath[dl] == '\0'));
}