diff --git a/libsoup/soup-cookie-jar.c b/libsoup/soup-cookie-jar.c
index a20f288..939a64f 100644
--- a/libsoup/soup-cookie-jar.c
+++ b/libsoup/soup-cookie-jar.c
@@ -351,9 +351,12 @@ soup_cookie_jar_add_cookie (SoupCookieJar *jar, SoupCookie *cookie)
 		old_cookie = oc->data;
 		if (!strcmp (cookie->name, old_cookie->name) &&
 		    !g_strcmp0 (cookie->path, old_cookie->path)) {
-			if (cookie->expires && soup_date_is_past (cookie->expires)) {
-				/* The new cookie has an expired date,
-				 * this is the way the the server has
+			if ((cookie->expires && soup_date_is_past (cookie->expires)) ||
+			    !(cookie->name[0] || cookie->value[0])){
+				/* Either the cookie is an empty cookie,
+				 * so it will not be stored, or the new
+				 * cookie has an expired date, which
+				 * is the way the the server has
 				 * of telling us that we have to
 				 * remove the cookie.
 				 */
@@ -376,7 +379,8 @@ soup_cookie_jar_add_cookie (SoupCookieJar *jar, SoupCookie *cookie)
 	}
 
 	/* The new cookie is... a new cookie */
-	if (cookie->expires && soup_date_is_past (cookie->expires)) {
+	if ((cookie->expires && soup_date_is_past (cookie->expires)) ||
+	    !(cookie->name[0] || cookie->value[0])) {
 		soup_cookie_free (cookie);
 		return;
 	}
