Sorry, I manually changed the file... This one should work.
On Sat, Jul 27, 2019 at 9:16 AM Michael Niedermayer <mich...@niedermayer.cc> wrote: On Fri, Jul 26, 2019 at 10:13:01PM +0000, Ian Klassen wrote: > Hi, > > Here is a potential fix for this bug: https://trac.ffmpeg.org/ticket/7975 > > Before reusing the connection the headers are checked to see if the server is > closing the connection. Also, the server may respond with "Connection: > Keep-alive, close" so the patch also handles this. > > Thanks. > > Ian > > http.c | 19 ++++++++++++++----- > 1 file changed, 14 insertions(+), 5 deletions(-) > 58ed36edf670ce62239eea577c47bfa0c822286d > 0001-recognize-server-closing-http-connection.patch > From 174a8913afe4e335441e3a8a77c91e6a4b4b718c Mon Sep 17 00:00:00 2001 > From: ian <i...@virtualfunc.com <mailto:i...@virtualfunc.com> > > Date: Fri, 26 Jul 2019 15:03:31 -0500 > Subject: [PATCH] recognize server closing http connection > > --- > libavformat/http.c | 19 +++++++++++++++---- > 1 file changed, 15 insertions(+), 4 deletions(-) > > diff --git a/libavformat/http.c b/libavformat/http.c > index 579debc..3bf2434 100644 > --- a/libavformat/http.c > +++ b/libavformat/http.c > @@ -332,15 +332,25 @@ int ff_http_do_new_request(URLContext *h, const char > *uri) > return AVERROR(EINVAL); > } > > + // read headers if not already loaded (this is needed to check if > connection is closing) > + if (!s->end_header) { > + int new_location; > + http_read_header(h, &new_location); > + > + if (s->willclose) { > + ret = ffurl_closep(&s->hd); > + > + if (ret < 0) > + return ret; > + } > + } > + > if (!s->end_chunked_post) { > ret = http_shutdown(h, h->flags); > if (ret < 0) > return ret; > } > > - if (s->willclose) > - return AVERROR_EOF; > - > s->end_chunked_post = 0; > s->chunkend = 0; > s->off = 0; > @@ -990,7 +1000,7 @@ static int process_line(URLContext *h, char *line, int > line_count, > } else if (!av_strcasecmp(tag, "Proxy-Authenticate")) { > ff_http_auth_handle_header(&s->proxy_auth_state, tag, p); > } else if (!av_strcasecmp(tag, "Connection")) { > - if (!strcmp(p, "close")) > + if (strstr(p, "close") != NULL) > s->willclose = 1; > } else if (!av_strcasecmp(tag, "Server")) { > if (!av_strcasecmp(p, "AkamaiGHost")) { > @@ -1637,6 +1647,7 @@ static int http_shutdown(URLContext *h, int flags) > s->hd->flags |= AVIO_FLAG_NONBLOCK; > read_ret = ffurl_read(s->hd, buf, sizeof(buf)); > s->hd->flags &= ~AVIO_FLAG_NONBLOCK; > if (read_ret < 0 && read_ret != AVERROR(EAGAIN)) { > av_log(h, AV_LOG_ERROR, "URL read error: %s\n", >av_err2str(read_ret)); > ret = read_ret; error: corrupt patch at line 55 [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB Good people do not need laws to tell them to act responsibly, while bad people will find a way around the laws. -- Plato _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org <mailto:ffmpeg-devel@ffmpeg.org> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org <mailto:ffmpeg-devel-requ...@ffmpeg.org> with subject "unsubscribe".
0008-recognize-server-closing-http-connection.patch
Description: Binary data
_______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".