diff mbox

[FFmpeg-devel] lavf/http.c: Don't write chunked-transfer-trailer to listening server context.

Message ID 20180412000751.17932-1-klaxa1337@googlemail.com
State New
Headers show

Commit Message

Stephan Holljes April 12, 2018, 12:07 a.m. UTC
---
I found this bug while working on my qualification task. When closing
a listening HTTP AVIOContext http_shutdown() tries to write the
chunked-transfer-encoding trailer to the listening Context.

 libavformat/http.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Stephan Holljes April 17, 2018, 9:45 p.m. UTC | #1
On Thu, Apr 12, 2018 at 2:07 AM, Stephan Holljes
<klaxa1337@googlemail.com> wrote:
> ---
> I found this bug while working on my qualification task. When closing
> a listening HTTP AVIOContext http_shutdown() tries to write the
> chunked-transfer-encoding trailer to the listening Context.
>
>  libavformat/http.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/libavformat/http.c b/libavformat/http.c
> index 983034f083..248fa085bf 100644
> --- a/libavformat/http.c
> +++ b/libavformat/http.c
> @@ -1623,7 +1623,7 @@ 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 && !s->listen) ||
>          ((flags & AVIO_FLAG_READ) && s->chunked_post && s->listen)) {
>          ret = ffurl_write(s->hd, footer, sizeof(footer) - 1);
>          ret = ret > 0 ? 0 : ret;
> --
> 2.16.2
>

Ping
Michael Niedermayer April 19, 2018, 12:49 a.m. UTC | #2
On Tue, Apr 17, 2018 at 11:45:38PM +0200, Stephan Holljes wrote:
> On Thu, Apr 12, 2018 at 2:07 AM, Stephan Holljes
> <klaxa1337@googlemail.com> wrote:
> > ---
> > I found this bug while working on my qualification task. When closing
> > a listening HTTP AVIOContext http_shutdown() tries to write the
> > chunked-transfer-encoding trailer to the listening Context.
> >
> >  libavformat/http.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/libavformat/http.c b/libavformat/http.c
> > index 983034f083..248fa085bf 100644
> > --- a/libavformat/http.c
> > +++ b/libavformat/http.c
> > @@ -1623,7 +1623,7 @@ 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 && !s->listen) ||
> >          ((flags & AVIO_FLAG_READ) && s->chunked_post && s->listen)) {
> >          ret = ffurl_write(s->hd, footer, sizeof(footer) - 1);
> >          ret = ret > 0 ? 0 : ret;
> > --
> > 2.16.2
> >
> 
> Ping

i think this is ok but we should find a maintainer for http

anyone who wants to help and knows http (either the protocol or our 
implementation)?

Thanks

[...]
diff mbox

Patch

diff --git a/libavformat/http.c b/libavformat/http.c
index 983034f083..248fa085bf 100644
--- a/libavformat/http.c
+++ b/libavformat/http.c
@@ -1623,7 +1623,7 @@  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 && !s->listen) ||
         ((flags & AVIO_FLAG_READ) && s->chunked_post && s->listen)) {
         ret = ffurl_write(s->hd, footer, sizeof(footer) - 1);
         ret = ret > 0 ? 0 : ret;