]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
config2setopts: add space in cookie header with multiple -b
authorpojomi <potter.jonathan.m@gmail.com>
Sun, 4 Jan 2026 20:50:27 +0000 (15:50 -0500)
committerDaniel Stenberg <daniel@haxx.se>
Mon, 5 Jan 2026 22:32:00 +0000 (23:32 +0100)
Closes #20184

src/config2setopts.c
tests/data/test6

index 6ecabe5cc813b566e941818c606bbcd5ddabb289..d462e8cd54e18af6bf3a5b7d7e5614bafba78ba7 100644 (file)
@@ -547,8 +547,8 @@ static CURLcode cookie_setopts(struct OperationConfig *config, CURL *curl)
       if(cl == config->cookies)
         result = curlx_dyn_add(&cookies, cl->data);
       else
-        result = curlx_dyn_addf(&cookies, ";%s", cl->data);
-
+        result = curlx_dyn_addf(&cookies, ";%s%s",
+                                ISBLANK(cl->data[0]) ? "" : " ", cl->data);
       if(result) {
         warnf("skipped provided cookie, the cookie header "
               "would go over %u bytes", MAX_COOKIE_LINE);
index 557c6eda8ff00e5e52142ad7819e0ade8105c60f..5f1d096d260e89ea19ff9ca1a8f66760541864e4 100644 (file)
@@ -44,7 +44,7 @@ GET /we/want/that/page/%TESTNUMBER HTTP/1.1
 Host: %HOSTIP:%HTTPPORT
 User-Agent: curl/%VERSION
 Accept: */*
-Cookie: name=contents;name2=content2;name3=content3
+Cookie: name=contents;name2=content2; name3=content3
 
 </protocol>
 </verify>