From b5cc6b937484c2f46751aafa0d80f6b7b3a66ad2 Mon Sep 17 00:00:00 2001 From: disqualifier Date: Mon, 6 Jul 2026 21:16:15 -0400 Subject: [PATCH] fix: _jar_to_dict prefers get_dict() to survive cross-domain cookie conflicts the preview cookie map still used jar.items(), which raises curl_cffi CookieConflict when the same cookie name lives on two domains - the blanket except then returned {}, so preview() silently showed zero cookies in exactly the state ec1a20a adopted get_dict() to survive on get_cookies. prefer get_dict() when the jar exposes it (hasattr-guarded), fall back to items() for a plain mapping jar. preview-only; the items() path is unchanged for jars without get_dict. Signed-off-by: disqualifier --- src/aioweb_tls/backends.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/aioweb_tls/backends.py b/src/aioweb_tls/backends.py index e4a9c27..6e497c7 100644 --- a/src/aioweb_tls/backends.py +++ b/src/aioweb_tls/backends.py @@ -118,6 +118,10 @@ def _jar_to_dict(session): if not jar: return {} try: + # prefer get_dict() where the jar exposes it: items() raises curl_cffi CookieConflict + # when the same name lives on two domains, get_dict() flattens instead (mirrors get_cookies) + if hasattr(jar, "get_dict"): + return jar.get_dict() return {k: v for k, v in jar.items()} except Exception: return {}