This is an automated email from the git hooks/post-receive script. Git pushed a commit to branch master in repository ffmpeg.
commit ca2c5ff4120439e52257154d4528da609570b7f0 Author: Niklas Haas <[email protected]> AuthorDate: Fri Jan 23 10:37:02 2026 +0100 Commit: Niklas Haas <[email protected]> CommitDate: Sat Feb 7 10:02:36 2026 +0000 avformat/http: parse range size from Content-Range header In the event that the range returned is smaller than the true filesize, we should only expect to receive that many bytes - not the entire rest of the file. This commit is theoretically non-functional on its own, since any conforming HTTP server will always return us the full file range, but I wanted to split it off from the subsequent changes in order to make review easier. --- libavformat/http.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/libavformat/http.c b/libavformat/http.c index 03f417100f..0fbf84165a 100644 --- a/libavformat/http.c +++ b/libavformat/http.c @@ -78,7 +78,7 @@ typedef struct HTTPContext { /* Used if "Transfer-Encoding: chunked" otherwise -1. */ uint64_t chunksize; int chunkend; - uint64_t off, end_off, filesize; + uint64_t off, end_off, filesize, range_end; char *uri; char *location; HTTPAuthState auth_state; @@ -892,11 +892,13 @@ static int parse_location(HTTPContext *s, const char *p) static void parse_content_range(URLContext *h, const char *p) { HTTPContext *s = h->priv_data; - const char *slash; + const char *slash, *end; if (!strncmp(p, "bytes ", 6)) { p += 6; s->off = strtoull(p, NULL, 10); + if ((end = strchr(p, '-')) && strlen(end) > 0) + s->range_end = strtoull(end + 1, NULL, 10) + 1; if ((slash = strchr(p, '/')) && strlen(slash) > 0) s->filesize_from_content_range = strtoull(slash + 1, NULL, 10); } @@ -1702,8 +1704,9 @@ static int http_buf_read(URLContext *h, uint8_t *buf, int size) memcpy(buf, s->buf_ptr, len); s->buf_ptr += len; } else { - uint64_t target_end = s->end_off ? s->end_off : s->filesize; - if ((!s->willclose || s->chunksize == UINT64_MAX) && s->off >= target_end) + uint64_t file_end = s->end_off ? s->end_off : s->filesize; + uint64_t target_end = s->range_end ? s->range_end : file_end; + if ((!s->willclose || s->chunksize == UINT64_MAX) && s->off >= file_end) return AVERROR_EOF; len = ffurl_read(s->hd, buf, size); if ((!len || len == AVERROR_EOF) && _______________________________________________ ffmpeg-cvslog mailing list -- [email protected] To unsubscribe send an email to [email protected]
