[FFmpeg-cvslog] http: Fix decetion of range support in HTTP servers

Stefan Fritsch git at videolan.org
Sat Sep 3 22:34:54 CEST 2011


ffmpeg | branch: master | Stefan Fritsch <sf at sfritsch.de> | Sat Sep  3 22:29:07 2011 +0200| [31dfc4959816aa4637e50c7f79660c75205ef84c] | committer: Michael Niedermayer

http:  Fix decetion of range support in HTTP servers

currently libavformat only allows seeking if a request with "Range:
0-" results in a 206 reply from the HTTP server which includes a
Content-Range header. But according to RFC 2616, the server may also
reply with a normal 200 reply (which is more efficient for a request
for the whole file). In fact Apache HTTPD 2.2.20 has changed the
behaviour in this way and it looks like this change will be kept in
future versions. The fix for libavformat is easy: Also look at the
Accept-Ranges header.

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=31dfc4959816aa4637e50c7f79660c75205ef84c
---

 libavformat/http.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/libavformat/http.c b/libavformat/http.c
index 95ba456..518c47d 100644
--- a/libavformat/http.c
+++ b/libavformat/http.c
@@ -265,6 +265,8 @@ static int process_line(URLContext *h, char *line, int line_count,
                     s->filesize = atoll(slash+1);
             }
             h->is_streamed = 0; /* we _can_ in fact seek */
+        } else if (!strcasecmp (tag, "Accept-Ranges") && !strncmp (p, "bytes", 5)) {
+            h->is_streamed = 0;
         } else if (!strcasecmp (tag, "Transfer-Encoding") && !strncasecmp(p, "chunked", 7)) {
             s->filesize = -1;
             s->chunksize = 0;



More information about the ffmpeg-cvslog mailing list