You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Simple cookie parser keeps first cookie with same name, not most recently set #1831
changed the title [-]I recently ran into an issue and found out that the reason was that the first cookie was kept after a request, which is different from the browser's behavior[/-][+]I recently encountered a problem and found that the reason is that when there are multiple Set-Cookies setting the same cookie in the header of a response, only the first cookie is retained, which is different from the browser's behavior[/+]on Aug 30, 2022
As shown in the figures, if there are two identical Set-Cookie in the response header, the browser (e.g. Edge) will save the second one, however Jsoup will save the first one, and when the subsequent request carrie that cookie, the exception will occur.
changed the title [-]I recently encountered a problem and found that the reason is that when there are multiple Set-Cookies setting the same cookie in the header of a response, only the first cookie is retained, which is different from the browser's behavior[/-][+]Simple cookie parser keeps first cookie with same name, not most recently set[/+]on Jan 5, 2023
Thanks, fixed. I simplified the implementation to have the simple cookie map populated by the set result of the Cookie Store, which corrects for order, path, etc.
This fix makes lots of trouble! "set-cookie" will be none sence by this fix and many "set-cookie"s are ignored after this fix. You must test more cases to check whether it is fine!
This fix makes lots of trouble! "set-cookie" will be none sence by this fix and many "set-cookie"s are ignored after this fix. You must test more cases to check whether it is fine!
Yeah... I rolled it back in 8dec9c3 and we just keep the last set one.
Activity
[-]I recently ran into an issue and found out that the reason was that the first cookie was kept after a request, which is different from the browser's behavior[/-][+]I recently encountered a problem and found that the reason is that when there are multiple Set-Cookies setting the same cookie in the header of a response, only the first cookie is retained, which is different from the browser's behavior[/+]Fix bug(jhy#1831)
Fix jhy#1831
jeffthomasweb commentedon Sep 9, 2022
Hi, to help others duplicate this issue, can you please include a code sample and the error you receive? Thanks!
lvpiao commentedon Sep 12, 2022
As shown in the figures, if there are two identical Set-Cookie in the response header, the browser (e.g. Edge) will save the second one, however Jsoup will save the first one, and when the subsequent request carrie that cookie, the exception will occur.
[-]I recently encountered a problem and found that the reason is that when there are multiple Set-Cookies setting the same cookie in the header of a response, only the first cookie is retained, which is different from the browser's behavior[/-][+]Simple cookie parser keeps first cookie with same name, not most recently set[/+]jhy commentedon Sep 11, 2024
Thanks, fixed. I simplified the implementation to have the simple cookie map populated by the set result of the Cookie Store, which corrects for order, path, etc.
Use the CookieManager to populate response cookies
anonyein commentedon Sep 15, 2024
This fix makes lots of trouble! "set-cookie" will be none sence by this fix and many "set-cookie"s are ignored after this fix. You must test more cases to check whether it is fine!
jhy commentedon Nov 21, 2024
@anonyein
Yeah... I rolled it back in 8dec9c3 and we just keep the last set one.
chore(deps): update all non-major dependencies (mulk/mulkcms2!58)