Commit f15077f767 for ffmpeg
commit f15077f7674c4409a93532860765ff9abf541f6d
Author: Kacper Michajłow <kasper93@gmail.com>
Date: Sat Oct 3 00:16:53 2026 +0200
avformat/http: read the whole trailer section of a chunked reply
Read the lines after the last chunk up to the empty line that ends the
trailer section, instead of only the first one, so that the next request
on the same connection does not read trailer fields as its status line.
Signed-off-by: Kacper Michajłow <kasper93@gmail.com>
diff --git a/libavformat/http.c b/libavformat/http.c
index 675bd81ea6..4f529cf8ff 100644
--- a/libavformat/http.c
+++ b/libavformat/http.c
@@ -1919,7 +1919,10 @@ static int http_buf_read(URLContext *h, uint8_t *buf, int size)
int more = s->range_end && s->off == s->range_end &&
s->range_end < requested_end(s);
if (s->multiple_requests) {
- http_get_line(s, line, sizeof(line)); // read empty chunk
+ do {
+ if ((err = http_get_line(s, line, sizeof(line))) < 0)
+ return err;
+ } while (*line);
s->chunkend = !more;
} else {
av_log(h, AV_LOG_DEBUG, "Last chunk received, closing conn\n");