[FFmpeg-cvslog] avformat/http: return EOF from ff_http_do_new_request if previous response said Connection:close

Aman Gupta git at videolan.org
Sat Dec 23 02:42:59 EET 2017


ffmpeg | branch: master | Aman Gupta <aman at tmm1.net> | Fri Dec 22 16:29:41 2017 -0800| [54d0ef1738ff30c05e2edb5b019dbd44b694ebe6] | committer: Aman Gupta

avformat/http: return EOF from ff_http_do_new_request if previous response said Connection:close

This fixes a deadlock when using the hls demuxer's new http_persistent feature
to stream a youtube live stream over HTTPS. The youtube servers are http/1.1
compliant, but return a "Connecton: close". Before this commit, the demuxer
would attempt to send a new request on the partially shutdown connection and
cause a deadlock in the tls protocol.

Signed-off-by: Aman Gupta <aman at tmm1.net>

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

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

diff --git a/libavformat/http.c b/libavformat/http.c
index ffdf11cf7e..7a68378acb 100644
--- a/libavformat/http.c
+++ b/libavformat/http.c
@@ -327,6 +327,9 @@ int ff_http_do_new_request(URLContext *h, const char *uri)
     if (ret < 0)
         return ret;
 
+    if (s->willclose)
+        return AVERROR_EOF;
+
     s->end_chunked_post = 0;
     s->chunkend      = 0;
     s->off           = 0;



More information about the ffmpeg-cvslog mailing list