[FFmpeg-cvslog] lavf/http: Correctly terminate session with HTTP POST client.

Stephan Holljes git at videolan.org
Wed Jun 10 18:41:39 CEST 2015


ffmpeg | branch: master | Stephan Holljes <klaxa1337 at googlemail.com> | Tue Jun  9 22:26:48 2015 +0200| [de3a7ef2042f4d82d02711d7d979630f620c73a3] | committer: Michael Niedermayer

lavf/http: Correctly terminate session with HTTP POST client.

Send a footer to correctly close client sockets.
This fixes network errors in client applications.

Signed-off-by: Stephan Holljes <klaxa1337 at googlemail.com>
Reviewed-by: Nicolas George <george at nsup.org>
Signed-off-by: Michael Niedermayer <michaelni at gmx.at>

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

 libavformat/http.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/libavformat/http.c b/libavformat/http.c
index 2db2dea..676bfd5 100644
--- a/libavformat/http.c
+++ b/libavformat/http.c
@@ -325,6 +325,7 @@ static int http_listen(URLContext *h, const char *uri, int flags,
     char lower_url[100];
     const char *lower_proto = "tcp";
     int port, new_location;
+    s->chunked_post = 1;
     av_url_split(proto, sizeof(proto), NULL, 0, hostname, sizeof(hostname), &port,
                  NULL, 0, uri);
     if (!strcmp(proto, "https"))
@@ -1242,7 +1243,8 @@ static int http_shutdown(URLContext *h, int flags)
     HTTPContext *s = h->priv_data;
 
     /* signal end of chunked encoding if used */
-    if ((flags & AVIO_FLAG_WRITE) && s->chunked_post) {
+    if (((flags & AVIO_FLAG_WRITE) && s->chunked_post) ||
+        ((flags & AVIO_FLAG_READ) && s->chunked_post && s->listen)) {
         ret = ffurl_write(s->hd, footer, sizeof(footer) - 1);
         ret = ret > 0 ? 0 : ret;
         s->end_chunked_post = 1;



More information about the ffmpeg-cvslog mailing list