2020-05-10 09:52:33 -04:00
|
|
|
/* Cookie path matching */
|
|
|
|
|
|
|
|
#include <string.h>
|
2020-10-05 14:14:55 -04:00
|
|
|
#include "cookies/path.h"
|
2020-05-10 09:52:33 -04:00
|
|
|
|
|
|
|
int
|
2021-01-02 10:20:27 -05:00
|
|
|
is_path_prefix(char *cookiepath, char *requestpath)
|
2020-05-10 09:52:33 -04:00
|
|
|
{
|
|
|
|
int dl = strlen(cookiepath);
|
|
|
|
|
2023-09-24 04:27:29 -04:00
|
|
|
if (!dl) return 1;
|
|
|
|
|
2020-05-10 09:52:33 -04:00
|
|
|
if (memcmp(cookiepath, requestpath, dl)) return 0;
|
|
|
|
|
2020-05-26 14:47:31 -04:00
|
|
|
return (!memcmp(cookiepath, requestpath, dl)
|
|
|
|
&& (cookiepath[dl - 1] == '/' || requestpath[dl] == '/' || requestpath[dl] == '\0'));
|
2020-05-10 09:52:33 -04:00
|
|
|
}
|