Commit 461f48ece8 for ffmpeg

commit 461f48ece865c53532ac428ccc3bdb8c031ad544
Author: Kacper Michajłow <kasper93@gmail.com>
Date:   Fri Oct 2 01:45:17 2026 +0200

    avformat/http: stop at the end offset or the end of the file

    Stop reading, and answer a seek past the end without a request, at the
    end offset or the file size, whichever comes first. An end offset past
    the end of the file no longer leads to a request past it.

    Signed-off-by: Kacper Michajłow <kasper93@gmail.com>

diff --git a/libavformat/http.c b/libavformat/http.c
index fe2bf8fcd0..488a8eb73d 100644
--- a/libavformat/http.c
+++ b/libavformat/http.c
@@ -1957,7 +1957,7 @@ 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 file_end   = s->end_off   ? s->end_off   : s->filesize;
+        uint64_t file_end   = requested_end(s);
         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;
@@ -2325,14 +2325,11 @@ static int64_t http_seek_internal(URLContext *h, int64_t off, int whence, int fo
     s->end_of_resource = 0;

     /* do not try to make a new connection if seeking past the end of the file */
-    if (s->end_off || s->filesize != UINT64_MAX) {
-        uint64_t end_pos = s->end_off ? s->end_off : s->filesize;
-        if (s->off >= end_pos) {
-            /* nothing of the old reply belongs to this offset */
-            ffurl_closep(&s->hd);
-            s->buf_ptr = s->buf_end = s->buffer;
-            return s->off;
-        }
+    if (s->off >= requested_end(s)) {
+        /* nothing of the old reply belongs to this offset */
+        ffurl_closep(&s->hd);
+        s->buf_ptr = s->buf_end = s->buffer;
+        return s->off;
     }

     /* if the location changed (redirect), revert to the original uri */