[FFmpeg-devel] [PATCH] http Transfer-Encoding chunked

Peter Holik peter
Sat May 23 11:55:41 CEST 2009


>> That was not working because http.c sends a HTTP/1.1 request and in the response
>> i got a "Transfer-Encoding: chunked" Header - not known by http.c.
>>
>> The only drawback of my patch is, that the filesize is limited (i've taken 512 kByte)

>Just set filesize to -1 then, i.e. unlimited. Don't make up some
>arbitrary number. It should just work.

Sorry, but this doesn't work for "image2"

>For the last chunk, your patch reads:
>0\r\n
>which signals the last-chunk (empty). However, this should (if I
>understand correctly) be followed by *another* \r\n before the next
>HTTP header starts (in a stream if HTTP requests):
>[.. end of old HTTP header ..]
>Transfer-Encoding: chunked\r\n
>\r\n
>ae9\r\n
><data:0xae9>\r\n
>0\r\n
>\r\n
>HTTP/1.1 200 OK
>[.. rest of new HTTP header ..]

> Your patch doesn't skip this and thus only works for the first HTTP
> data chunk (DAV servers use multiple in a session).


That's true, i take only the chunks till i read a "0".

I can't imagine a need for "multiple chunks", please give me an example.


for ffmpeg -loop_input a small fix is needed for my patch:

diff --git a/libavformat/http.c b/libavformat/http.c
index f6d3682..31cda9a 100644
--- a/libavformat/http.c
+++ b/libavformat/http.c
@@ -204,6 +204,7 @@ static int process_line(URLContext *h, char *line, int line_count,
             h->is_streamed = 0; /* we _can_ in fact seek */
         } else if (!strcmp (tag, "Transfer-Encoding") && !strncmp(p, "chunked", 7)) {
             s->filesize = 0x7ffff; /* we don't know the size - limit to 512 kBytes */
+            s->chunk_size = 0;
             s->chunked = 1;
         }
     }

cu peter





More information about the ffmpeg-devel mailing list