← Commit list

6c7bc9871f

Daniel Stenberg
Daniel Stenberg
2025-12-19
SUCCESS Duration: 528s

Subject

http: fix for unfolding line starting with TAB

Binary

No binary (build failed)

Architecture & Compiler Flags

Architecture: x86_64-linux-gnu Compiler: gcc (Ubuntu 11.4.0-1ubuntu1~22.04.3) 11.4.0

—

Build Log

(log yok)

Commit Diff GitHub →

lib/http.c+4 -7
@@ -4391,19 +4391,16 @@ static CURLcode http_parse_headers(struct Curl_easy *data,
if(data->state.leading_unfold) {
/* immediately after an unfold, keep only a single whitespace */
- const size_t iblen = blen;
while(consumed && ISBLANK(buf[0])) {
consumed--;
buf++;
blen--;
}
if(consumed) {
- if(iblen > blen) {
- /* take one step back */
- consumed++;
- buf--;
- blen++;
- }
+ /* insert a single space */
+ result = curlx_dyn_addn(&data->state.headerb, " ", 1);
+ if(result)
+ return result;
data->state.leading_unfold = FALSE; /* done now */
}
}
tests/data/test1274+4 -0
@@ -16,6 +16,9 @@ Date: Tue, 09 Nov 2010 14:49:00 GMT%CR
Server: test-server/%CR
fake%CR
folded%CR
+Tabs: tab-instead/%TAB%CR
+%TABonly%CR
+%TAB mixed%CR
Last-Modified: Tue, 13 Jun 2000 12:10:00 GMT%CR
ETag: "21025-dc7-39462498"%CR
Content-Length: 6%CR
@@ -52,6 +55,7 @@ Accept: */*
HTTP/1.1 200 OK
Date: Tue, 09 Nov 2010 14:49:00 GMT
Server: test-server/ fake folded
+Tabs: tab-instead/ only mixed
Last-Modified: Tue, 13 Jun 2000 12:10:00 GMT
ETag: "21025-dc7-39462498"
Content-Length: 6
tests/data/test1940+4 -0
@@ -17,6 +17,9 @@ Fold: is
folding a%repeat[5 x ]%
line
Content-Length: 0
+Test:%TAB
+%TAB%SP
+%TABword
Set-Cookie: onecookie=data;
Set-Cookie: secondcookie=2data;
Set-Cookie: cookie3=data3;
@@ -62,6 +65,7 @@ http://%HOSTIP:%HTTPPORT/%TESTNUMBER
Fold == is folding a line
Blank ==%SP
Blank2 ==%SP
+ Test == word
</stdout>
</verify>
</testcase>
tests/libtest/lib1940.c+1 -0
@@ -44,6 +44,7 @@ static void t1940_showem(CURL *curl, int header_request, unsigned int type)
"fold",
"blank",
"Blank2",
+ "Test",
NULL
};