1
0
Fork 0

[cookies] Slightly modified path.c

This commit is contained in:
Witold Filipczyk 2020-05-26 20:47:31 +02:00
parent 61e7b3f0b1
commit 8ba7176f81
1 changed files with 2 additions and 8 deletions

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'));
}