[FFmpeg-devel] http: only set filesize for 206 content-range

Submitted by Robert Nagy on Aug. 4, 2018, 10:08 p.m.

Details

Message ID CALdTkGH6odrp2FJP5PhU4ObVD0UL3_NUVRAaUQQWxkCc2Dj-Jg@mail.gmail.com
State New
Headers show

Commit Message

Robert Nagy Aug. 4, 2018, 10:08 p.m.
Growing files will return 416 with a current file size in content-range.
However, FFmpeg incorrectly assumes this is the final file size.
Fix this by only setting file size for 206 responses.
---
 libavformat/http.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

         if ((slash = strchr(p, '/')) && strlen(slash) > 0)
--
2.17.1

Patch hide | download patch | download mbox

diff --git a/libavformat/http.c b/libavformat/http.c
index 668cd51986..3bd89780c3 100644
--- a/libavformat/http.c
+++ b/libavformat/http.c
@@ -617,7 +617,7 @@  static void parse_content_range(URLContext *h, const
char *p)
     HTTPContext *s = h->priv_data;
     const char *slash;

-    if (!strncmp(p, "bytes ", 6)) {
+    if (!strncmp(p, "bytes ", 6) && s->http_code == 206) {
         p     += 6;
         s->off = strtoull(p, NULL, 10);