From 9d402489db08138dc24cf316bd2be1d1f14e5106 Mon Sep 17 00:00:00 2001
From: Maciej Zdeb <maciej@zdeb.pl>
Date: Fri, 13 Nov 2020 09:38:06 +0000
Subject: [PATCH] BUG/MINOR: http: Extract cookie value even when cookie name
 is not specified

HTTP sample fetch req.cook_cnt() should return number of all cookies in
request, instead it always returned 0. Fixed condition in
http_extract_cookie_value to allow extracting all cookies values when no
cookie name specified.

This should be backported as far as 1.7
---
 src/http.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/http.c b/src/http.c
index bb99c5098..2f23762a8 100644
--- a/src/http.c
+++ b/src/http.c
@@ -728,7 +728,7 @@ char *http_extract_cookie_value(char *hdr, const char *hdr_end,
 		 * its value between val_beg and val_end.
 		 */
 
-		if (att_end - att_beg == cookie_name_l &&
+		if (cookie_name_l == 0 || att_end - att_beg == cookie_name_l &&
 		    memcmp(att_beg, cookie_name, cookie_name_l) == 0) {
 			/* let's return this value and indicate where to go on from */
 			*value = val_beg;
-- 
2.17.1

