diff --git a/marginalia_nu/src/main/java/nu/marginalia/wmsa/edge/crawling/retreival/Cookies.java b/marginalia_nu/src/main/java/nu/marginalia/wmsa/edge/crawling/retreival/Cookies.java index 2fde3091..b19478ea 100644 --- a/marginalia_nu/src/main/java/nu/marginalia/wmsa/edge/crawling/retreival/Cookies.java +++ b/marginalia_nu/src/main/java/nu/marginalia/wmsa/edge/crawling/retreival/Cookies.java @@ -9,21 +9,22 @@ import java.util.List; import java.util.concurrent.ConcurrentHashMap; public class Cookies { - final ThreadLocal>> cookieJar = ThreadLocal.withInitial(ConcurrentHashMap::new); + final ThreadLocal>> cookieJar = ThreadLocal.withInitial(ConcurrentHashMap::new); public CookieJar getJar() { return new CookieJar() { @Override public void saveFromResponse(HttpUrl url, List cookies) { + if (!cookies.isEmpty()) { - cookieJar.get().put(url, cookies); + cookieJar.get().put(url.host(), cookies); } } @Override public List loadForRequest(HttpUrl url) { - return cookieJar.get().getOrDefault(url, Collections.emptyList()); + return cookieJar.get().getOrDefault(url.host(), Collections.emptyList()); } }; }