5b99f978e93b036f9cf3f375aab18a6b504d71ee
diff --git a/libsoup/soup-cookie-jar.c b/libsoup/soup-cookie-jar.c
index a042948..08ee4e1 100644
--- a/libsoup/soup-cookie-jar.c
+++ b/libsoup/soup-cookie-jar.c
@@ -183,7 +183,7 @@ soup_cookie_jar_add_cookie_header (SoupCookieJar *jar, SoupMessage *msg)
 	cookies = g_slist_copy (g_hash_table_lookup (priv->domains, domain));
 	d = domain + 1;
 	while (d) {
-		domain_cookies = g_hash_table_lookup (priv->domains, domain);
+		domain_cookies = g_hash_table_lookup (priv->domains, d);
 		if (domain_cookies) {
 			cookies = g_slist_append (cookies,
 						  g_slist_copy (domain_cookies));
