[FFmpeg-devel] [PATCH] Fix the timeout option not working when connecting to a HTTP url that requires authentication.

Michael Niedermayer michaelni at gmx.at
Sat Nov 15 14:25:18 CET 2014


On Sat, Nov 15, 2014 at 08:08:42AM -0500, Brandon Lees wrote:
> On Sat, Nov 15, 2014 at 6:23 AM, Michael Niedermayer <michaelni at gmx.at>
> wrote:
> 
> > On Fri, Nov 14, 2014 at 06:05:44PM -0500, Brandon Lees wrote:
> > > In http_open_cnx, the patch restores the AVDictionary if connection
> > needs to be re-tried
> > > because of a authentication/redirect status code.
> > >
> > > Previously, if a 401/407/30x status code was encountered, http_open_cnx
> > would restart at the redo label, but any options
> > > used by the underlying protocol would be missing because they were
> > removed by the first attempt.
> > >
> > > Signed-off-by: Brandon Lees <brandon at n-hega.com>
> > > ---
> > >  libavformat/http.c | 3 +++
> > >  1 file changed, 3 insertions(+)
> > >
> > > diff --git a/libavformat/http.c b/libavformat/http.c
> > > index dfc01ee..f17b2f8 100644
> > > --- a/libavformat/http.c
> > > +++ b/libavformat/http.c
> > > @@ -207,6 +207,9 @@ static int http_open_cnx(URLContext *h, AVDictionary
> > **options)
> > >      HTTPContext *s = h->priv_data;
> > >      int location_changed, attempts = 0, redirects = 0;
> > >  redo:
> > > +    if (attempts > 0)
> > > +        av_dict_copy(options, s->chained_options, 0);
> >
> > i might be missing something, but why is this conditional on
> > attempts > 0 ?
> > i think if its unconditional some calling code could be simplified
> >
> > [...]
> > --
> > Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
> >
> > In fact, the RIAA has been known to suggest that students drop out
> > of college or go to community college in order to be able to afford
> > settlements. -- The RIAA
> >
> 
> 
> the condition is there because for the first attempt (attempt == 0) options
> are already set to the correct value so the copy is unnecessary. I guess it
> just depends on if you prefer an extra copy or an extra line of code.

ok, patch applied and simplifed

thanks

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Rewriting code that is poorly written but fully understood is good.
Rewriting code that one doesnt understand is a sign that one is less smart
then the original author, trying to rewrite it will not make it better.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 181 bytes
Desc: Digital signature
URL: <https://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20141115/145f671d/attachment.asc>


More information about the ffmpeg-devel mailing list