This is an automated email from the git hooks/post-receive script. Git pushed a commit to branch master in repository ffmpeg.
commit 6aff32549772c8a9667145fa433eabeb15725e72 Author: Kacper Michajłow <[email protected]> AuthorDate: Sat Sep 26 20:28:44 2026 +0200 Commit: Kacper Michajłow <[email protected]> CommitDate: Mon Oct 12 22:42:24 2026 +0200 avformat/libcurl: keep requesting when the file size is unknown Keep requesting from where each reply stopped when the file size is unknown ("Content-Range: bytes S-E/*"). Treat a 416 on such a follow-up request as EOF and take the size from its "bytes */N". A 416 that states a size past the requested offset is an error. A compressed reply is not continued, as its range counts compressed bytes. Signed-off-by: Kacper Michajłow <[email protected]> --- libavformat/libcurl.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/libavformat/libcurl.c b/libavformat/libcurl.c index 398e000bd1..fc487602db 100644 --- a/libavformat/libcurl.c +++ b/libavformat/libcurl.c @@ -583,7 +583,7 @@ static size_t header_callback(char *ptr, size_t size, size_t nitems, void *userd } c->stream_ok = 1; - c->request_end = content_end; + c->request_end = c->hdr_compressed ? -1 : content_end; /* Capture the post-redirect URL, this is exposed as "location" AVOption * for compatibility with http.c. */ if (!c->probed) { @@ -622,6 +622,14 @@ static size_t header_callback(char *ptr, size_t size, size_t nitems, void *userd c->seekable = 0; c->content_size = -1; } + } else if (status == 416 && c->probed && c->content_size < 0 && + (c->hdr_content_total < 0 || + c->hdr_content_total <= c->request_start)) { + /* A 416 on a follow-up request of a file of unknown size is EOF, unless + * it states a size past the requested offset. */ + c->content_size = c->hdr_content_total; + c->stream_ok = 0; + update_status_locked(c, AVERROR_EOF, CURLE_OK); } else { c->loop->num_errors++; c->stream_ok = 0; @@ -780,7 +788,7 @@ static void on_done(CurlContext *c, CURLcode code) } if (code == CURLE_OK && c->stream_ok) { - int64_t file_end = c->content_size > 0 ? c->content_size - 1 : -1; + int64_t file_end = c->content_size >= 0 ? c->content_size - 1 : INT64_MAX; if (c->end_off > 0) file_end = FFMIN(file_end, c->end_off - 1); if (c->seekable && c->request_end >= 0 && c->request_end < file_end) { -- To stop receiving notification emails like this one, please contact [email protected]. _______________________________________________ ffmpeg-cvslog mailing list -- [email protected] To unsubscribe send an email to [email protected]
