[FFmpeg-cvslog] http: Properly handle chunked transfer-encoding for replies to post data

Martin Storsjö git at videolan.org
Mon Jun 18 20:25:39 CEST 2012


ffmpeg | branch: master | Martin Storsjö <martin at martin.st> | Sun Jun 17 21:19:41 2012 +0300| [35127bf156df09ebf43f1ad7ea236653f7ba7707] | committer: Martin Storsjö

http: Properly handle chunked transfer-encoding for replies to post data

Signed-off-by: Martin Storsjö <martin at martin.st>

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

 libavformat/http.c |   15 ++++++---------
 1 file changed, 6 insertions(+), 9 deletions(-)

diff --git a/libavformat/http.c b/libavformat/http.c
index 2b5f2cc..a494193 100644
--- a/libavformat/http.c
+++ b/libavformat/http.c
@@ -353,6 +353,8 @@ static int http_read_header(URLContext *h, int *new_location)
     char line[1024];
     int err = 0;
 
+    s->chunksize = -1;
+
     for (;;) {
         if ((err = http_get_line(s, line, sizeof(line))) < 0)
             return err;
@@ -470,7 +472,6 @@ static int http_connect(URLContext *h, const char *path, const char *local_path,
         s->http_code = 200;
         return 0;
     }
-    s->chunksize = -1;
 
     /* wait for header */
     err = http_read_header(h, new_location);
@@ -513,14 +514,10 @@ static int http_read(URLContext *h, uint8_t *buf, int size)
     if (!s->hd)
         return AVERROR_EOF;
 
-    if (s->end_chunked_post) {
-        if (!s->end_header) {
-            err = http_read_header(h, &new_location);
-            if (err < 0)
-                return err;
-        }
-
-        return http_buf_read(h, buf, size);
+    if (s->end_chunked_post && !s->end_header) {
+        err = http_read_header(h, &new_location);
+        if (err < 0)
+            return err;
     }
 
     if (s->chunksize >= 0) {



More information about the ffmpeg-cvslog mailing list