From: Daniel Stenberg Date: Tue, 19 Jul 2022 15:54:23 +0000 (+0200) Subject: sendf: fix paused header writes since after the header API X-Git-Tag: curl-7_85_0~148 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=6f037100ebbe3b0b0f254756e57e6ba62eb2e56f;p=thirdparty%2Fcurl.git sendf: fix paused header writes since after the header API Regression since d1e4a67 Reported-by: Sergey Ogryzkov Fixes #9180 Closes #9182 --- diff --git a/lib/sendf.c b/lib/sendf.c index 32714255d4..d19fb55233 100644 --- a/lib/sendf.c +++ b/lib/sendf.c @@ -496,6 +496,9 @@ static CURLcode pausewrite(struct Curl_easy *data, } } DEBUGASSERT(i < 3); + if(i >= 3) + /* There are more types to store than what fits: very bad */ + return CURLE_OUT_OF_MEMORY; } else i = 0; @@ -607,8 +610,10 @@ static CURLcode chop_write(struct Curl_easy *data, /* here we pass in the HEADER bit only since if this was body as well then it was passed already and clearly that didn't trigger the pause, so this is saved for later with the HEADER bit only */ - return pausewrite(data, CLIENTWRITE_HEADER, optr, olen); - + return pausewrite(data, CLIENTWRITE_HEADER | + (type & (CLIENTWRITE_STATUS|CLIENTWRITE_CONNECT| + CLIENTWRITE_1XX|CLIENTWRITE_TRAILER)), + optr, olen); if(wrote != olen) { failf(data, "Failed writing header"); return CURLE_WRITE_ERROR;