[FFmpeg-devel,1/3] http: do not print a warning message for expired cookies

Submitted by wm4 on March 8, 2018, 3:53 a.m.

Details

Message ID 20180308035357.18138-1-nfxjfg@googlemail.com
State Accepted
Commit 39c1d170a3474a06f4805589d642f605f7ef1436
Headers show

Commit Message

wm4 March 8, 2018, 3:53 a.m.
libavformat prints a warning that the cookie couldn't be parsed (see
callers of parse_cookie()). This is obviously not true - it could be
parsed, but was simply ignored. Don't return an error to avoid the
warning.
---
 libavformat/http.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Carl Eugen Hoyos March 8, 2018, 4:47 p.m.
2018-03-08 4:53 GMT+01:00, wm4 <nfxjfg@googlemail.com>:
> libavformat prints a warning that the cookie couldn't be parsed (see
> callers of parse_cookie()). This is obviously not true - it could be
> parsed, but was simply ignored. Don't return an error to avoid the
> warning.
> ---
>  libavformat/http.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/libavformat/http.c b/libavformat/http.c
> index 344fd603cb..d7a72e7129 100644
> --- a/libavformat/http.c
> +++ b/libavformat/http.c
> @@ -802,7 +802,7 @@ static int parse_cookie(HTTPContext *s, const char *p,
> AVDictionary **cookies)
>              // if the cookie has already expired ignore it
>              if (av_timegm(&new_tm) < av_gettime() / 1000000) {
>                  av_dict_free(&new_params);
> -                return -1;
> +                return 0;

Should a warning instead be printed here?

Carl Eugen
wm4 March 8, 2018, 6:08 p.m.
On Thu, 8 Mar 2018 17:47:33 +0100
Carl Eugen Hoyos <ceffmpeg@gmail.com> wrote:

> 2018-03-08 4:53 GMT+01:00, wm4 <nfxjfg@googlemail.com>:
> > libavformat prints a warning that the cookie couldn't be parsed (see
> > callers of parse_cookie()). This is obviously not true - it could be
> > parsed, but was simply ignored. Don't return an error to avoid the
> > warning.
> > ---
> >  libavformat/http.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/libavformat/http.c b/libavformat/http.c
> > index 344fd603cb..d7a72e7129 100644
> > --- a/libavformat/http.c
> > +++ b/libavformat/http.c
> > @@ -802,7 +802,7 @@ static int parse_cookie(HTTPContext *s, const char *p,
> > AVDictionary **cookies)
> >              // if the cookie has already expired ignore it
> >              if (av_timegm(&new_tm) < av_gettime() / 1000000) {
> >                  av_dict_free(&new_params);
> > -                return -1;
> > +                return 0;  
> 
> Should a warning instead be printed here?

I don't think so - the warning is annoying when you save cookies from
an earlier HTTP request, which have a an expiry date very close to the
current time. Effectively this would make ffmpeg print useless messages.
wm4 March 18, 2018, 12:52 p.m.
On Thu,  8 Mar 2018 04:53:55 +0100
wm4 <nfxjfg@googlemail.com> wrote:

> libavformat prints a warning that the cookie couldn't be parsed (see
> callers of parse_cookie()). This is obviously not true - it could be
> parsed, but was simply ignored. Don't return an error to avoid the
> warning.
> ---
>  libavformat/http.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/libavformat/http.c b/libavformat/http.c
> index 344fd603cb..d7a72e7129 100644
> --- a/libavformat/http.c
> +++ b/libavformat/http.c
> @@ -802,7 +802,7 @@ static int parse_cookie(HTTPContext *s, const char *p, AVDictionary **cookies)
>              // if the cookie has already expired ignore it
>              if (av_timegm(&new_tm) < av_gettime() / 1000000) {
>                  av_dict_free(&new_params);
> -                return -1;
> +                return 0;
>              }
>  
>              // only replace an older cookie with the same name

All pushed.

Patch hide | download patch | download mbox

diff --git a/libavformat/http.c b/libavformat/http.c
index 344fd603cb..d7a72e7129 100644
--- a/libavformat/http.c
+++ b/libavformat/http.c
@@ -802,7 +802,7 @@  static int parse_cookie(HTTPContext *s, const char *p, AVDictionary **cookies)
             // if the cookie has already expired ignore it
             if (av_timegm(&new_tm) < av_gettime() / 1000000) {
                 av_dict_free(&new_params);
-                return -1;
+                return 0;
             }
 
             // only replace an older cookie with the same name