The CookieContainer class currently caches a cookie based on the following info:
cookie.key
cookie.originURL.hostname
cookie.originURL.pathname
typeof cookie.value
I believe the following should be used instead:
cookie.key
cookie.originURL.hostname
cookie.path
typeof cookie.value
To Reproduce
Steps to reproduce the behavior:
Send a fetch request to an endpoint that sets a cookie, e.g. api/signUp
The cookie is cached under the following key: <cookie-name>-<hostname>-/api/signUp-string
Send a fetch request to an endpoint that clears the aforementioned cookie, e.g. api/signOut
The original cookie (i.e. <cookie-name>-<hostname>-/api/signUp-string) is invalidated on the server but still not deleted by CookieContainer
This is an issue when the same cookie is set by another request, e.g. api/signIn because a new cookie will be cached under <cookie-name>-<hostname>-/api/signIn-string and yet the previous expired cookie (i.e. <cookie-name>-<hostname>-/api/signUp-string) will be sent in following requests to the same domain instead of the newer <cookie-name>-<hostname>-/api/signIn-string
Expected behavior
Cookies should be cached based on the following info:
Describe the bug
The CookieContainer class currently caches a cookie based on the following info:
cookie.key
cookie.originURL.hostname
cookie.originURL.pathname
typeof cookie.value
I believe the following should be used instead:
cookie.key
cookie.originURL.hostname
typeof cookie.value
To Reproduce Steps to reproduce the behavior:
api/signUp
<cookie-name>-<hostname>-/api/signUp-string
api/signOut
<cookie-name>-<hostname>-/api/signUp-string
) is invalidated on the server but still not deleted byCookieContainer
api/signIn
because a new cookie will be cached under<cookie-name>-<hostname>-/api/signIn-string
and yet the previous expired cookie (i.e.<cookie-name>-<hostname>-/api/signUp-string
) will be sent in following requests to the same domain instead of the newer<cookie-name>-<hostname>-/api/signIn-string
Expected behavior Cookies should be cached based on the following info:
cookie.key
cookie.originURL.hostname
typeof cookie.value