95f5a2b71db02f80b82a78802f01e9c6ad91614b
diff --git a/libsoup/soup-cookie.c b/libsoup/soup-cookie.c
index bba46b0..b7475e4 100644
--- a/libsoup/soup-cookie.c
+++ b/libsoup/soup-cookie.c
@@ -752,6 +752,7 @@ soup_cookies_to_response (GSList *cookies, SoupMessage *msg)
 		soup_message_headers_append (msg->response_headers,
 					     "Set-Cookie", header->str);
 		g_string_truncate (header, 0);
+		cookies = cookies->next;
 	}
 	g_string_free (header, TRUE);
 }
@@ -774,8 +775,10 @@ soup_cookies_to_request (GSList *cookies, SoupMessage *msg)
 
 	header = g_string_new (soup_message_headers_get (msg->request_headers,
 							 "Cookie"));
-	while (cookies)
+	while (cookies) {
 		serialize_cookie (cookies->data, header, FALSE);
+		cookies = cookies->next;
+	}
 	soup_message_headers_replace (msg->request_headers,
 				      "Cookie", header->str);
 	g_string_free (header, TRUE);
