public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
From: Jan Macku <jamacku@redhat.com>
To: git-commits@fedoraproject.org
Subject: [rpms/curl] curl-v8.23.0-3: fix: Leftovers after chunking should not be part of the curl buffer output
Date: Tue, 03 Nov 2026 12:39:09 GMT	[thread overview]
Message-ID: <179370954979.1.10397440094410104882.rpms-curl-9a38bdf948aa@fedoraproject.org> (raw)

            A new commit has been pushed.

            Repo   : rpms/curl
            Branch : curl-v8.23.0-3
            Commit : 9a38bdf948aacf59ec81f0e35ef10f430252f1a6
            Author : Jan Macku <jamacku@redhat.com>
            Date   : 2024-02-19T13:23:34+01:00
            Stats  : +90/-1 in 2 file(s)
            URL    : https://src.fedoraproject.org/rpms/curl/c/9a38bdf948aacf59ec81f0e35ef10f430252f1a6?branch=curl-v8.23.0-3

            Log:
            fix: Leftovers after chunking should not be part of the curl buffer output

Resolves: #2264220

---
diff --git a/0004-curl-8.6.0-http_chunks-fix-the-accounting-of-consumed-bytes.patch b/0004-curl-8.6.0-http_chunks-fix-the-accounting-of-consumed-bytes.patch
new file mode 100644
index 0000000..39b2f31
--- /dev/null
+++ b/0004-curl-8.6.0-http_chunks-fix-the-accounting-of-consumed-bytes.patch
@@ -0,0 +1,83 @@
+From c7438ccfceee373a75d6d890259cf2e6b5e0e203 Mon Sep 17 00:00:00 2001
+From: Stefan Eissing <stefan@eissing.org>
+Date: Wed, 14 Feb 2024 16:27:23 +0100
+Subject: [PATCH] http_chunks: fix the accounting of consumed bytes
+
+Prior to this change chunks were handled correctly although in verbose
+mode libcurl could incorrectly warn of "Leftovers after chunking" even
+if there were none.
+
+Reported-by: Michael Kaufmann
+
+Fixes https://github.com/curl/curl/issues/12937
+Closes https://github.com/curl/curl/pull/12939
+
+(cherry picked from commit 59e2c78af3a5588d6e6ae6d2223b222f067e054b)
+Signed-off-by: Jan Macku <jamacku@redhat.com>
+---
+ lib/http_chunks.c | 7 +++++++
+ 1 file changed, 7 insertions(+)
+
+diff --git a/lib/http_chunks.c b/lib/http_chunks.c
+index 039c179c4..ad1ee9ada 100644
+--- a/lib/http_chunks.c
++++ b/lib/http_chunks.c
+@@ -152,6 +152,7 @@ static CURLcode httpchunk_readwrite(struct Curl_easy *data,
+         ch->hexbuffer[ch->hexindex++] = *buf;
+         buf++;
+         blen--;
++        (*pconsumed)++;
+       }
+       else {
+         char *endptr;
+@@ -189,6 +190,7 @@ static CURLcode httpchunk_readwrite(struct Curl_easy *data,
+ 
+       buf++;
+       blen--;
++      (*pconsumed)++;
+       break;
+ 
+     case CHUNK_DATA:
+@@ -236,6 +238,7 @@ static CURLcode httpchunk_readwrite(struct Curl_easy *data,
+       }
+       buf++;
+       blen--;
++      (*pconsumed)++;
+       break;
+ 
+     case CHUNK_TRAILER:
+@@ -293,6 +296,7 @@ static CURLcode httpchunk_readwrite(struct Curl_easy *data,
+       }
+       buf++;
+       blen--;
++      (*pconsumed)++;
+       break;
+ 
+     case CHUNK_TRAILER_CR:
+@@ -300,6 +304,7 @@ static CURLcode httpchunk_readwrite(struct Curl_easy *data,
+         ch->state = CHUNK_TRAILER_POSTCR;
+         buf++;
+         blen--;
++        (*pconsumed)++;
+       }
+       else {
+         ch->state = CHUNK_FAILED;
+@@ -320,6 +325,7 @@ static CURLcode httpchunk_readwrite(struct Curl_easy *data,
+         /* skip if CR */
+         buf++;
+         blen--;
++        (*pconsumed)++;
+       }
+       /* now wait for the final LF */
+       ch->state = CHUNK_STOP;
+@@ -328,6 +334,7 @@ static CURLcode httpchunk_readwrite(struct Curl_easy *data,
+     case CHUNK_STOP:
+       if(*buf == 0x0a) {
+         blen--;
++        (*pconsumed)++;
+         /* Record the length of any data left in the end of the buffer
+            even if there's no more chunks to read */
+         ch->datasize = blen;
+-- 
+2.43.2
+

diff --git a/curl.spec b/curl.spec
index 33f4fba..5118b71 100644
--- a/curl.spec
+++ b/curl.spec
@@ -1,7 +1,7 @@
 Summary: A utility for getting files from remote servers (FTP, HTTP, and others)
 Name: curl
 Version: 8.6.0
-Release: 6%{?dist}
+Release: 7%{?dist}
 License: curl
 Source0: https://curl.se/download/%{name}-%{version}.tar.xz
 Source1: https://curl.se/download/%{name}-%{version}.tar.xz.asc
@@ -21,6 +21,9 @@ Patch002: 0002-curl-8.6.0-ignore-response-body-to-HEAD.patch
 # it breaks pycurl tests suite
 Patch003: 0003-curl-8.6.0-vtls-revert-receive-max-buffer-add-test-case.patch
 
+# Fix: Leftovers after chunking should not be part of the curl buffer output
+Patch004: 0004-curl-8.6.0-http_chunks-fix-the-accounting-of-consumed-bytes.patch
+
 # patch making libcurl multilib ready
 Patch101: 0101-curl-7.32.0-multilib.patch
 
@@ -411,6 +414,9 @@ rm -f ${RPM_BUILD_ROOT}%{_mandir}/man1/mk-ca-bundle.1*
 %{_libdir}/libcurl.so.4.[0-9].[0-9].minimal
 
 %changelog
+* Mon Feb 19 2024 Jan Macku <jamacku@redhat.com> - 8.6.0-7
+- Fix: Leftovers after chunking should not be part of the curl buffer output (#2264220)
+
 * Mon Feb 12 2024 Jan Macku <jamacku@redhat.com> - 8.6.0-6
 - revert "receive max buffer" + add test case
 - temporarily disable test 0313

                 reply	other threads:[~2026-11-03 12:39 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=179370954979.1.10397440094410104882.rpms-curl-9a38bdf948aa@fedoraproject.org \
    --to=jamacku@redhat.com \
    --cc=git-commits@fedoraproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox