]> git.sesse.net Git - ffmpeg/commitdiff
avformat/http: return EOF from ff_http_do_new_request if previous response said Conne...
authorAman Gupta <aman@tmm1.net>
Sat, 23 Dec 2017 00:29:41 +0000 (16:29 -0800)
committerAman Gupta <aman@tmm1.net>
Sat, 23 Dec 2017 00:39:37 +0000 (16:39 -0800)
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@tmm1.net>
libavformat/http.c

index ffdf11cf7efd3f852ea472d7fb0711651946132b..7a68378acb25f082849bd183da542dafeea3aef0 100644 (file)
@@ -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;