[FFmpeg-devel] [Patch] Use Transfer-Encoding: chunked (and perhaps PUT) for HTTP uploads

Ronald S. Bultje rsbultje
Mon Jan 4 03:55:49 CET 2010


Hi,

On Fri, Jan 1, 2010 at 5:10 PM, Michael Niedermayer <michaelni at gmx.at> wrote:
> i think this is ok if tested unless we have some volunteer to maintain http.c
> iam after all not ideal for the http maintainer role as i dont know the fine
> details of it

I can maintain.

One thing:

 static int http_close(URLContext *h)
 {
+    int ret;
+    char footer[] = "0\r\n\r\n";
     HTTPContext *s = h->priv_data;
+
+    /* signal end of chunked encoding if used */
+    if ((h->flags & URL_WRONLY) && s->chunksize != -1 &&
+        (ret = url_write(s->hd, footer, sizeof(footer) - 1)) < 0)
+        return ret;
+
     url_close(s->hd);
     av_free(s);
     return 0;

If it fails, you want to close it the more, and still return an error,
no? If the write fails, this is a memleak.

(BTW why does close() have an error return value anyway?)

Ronald



More information about the ffmpeg-devel mailing list