[FFmpeg-devel] [PATCH] libavformat/http.c: cookie path attribute should be optional not compulsory

Michael J. Walsh mjfwalsh at gmail.com
Fri Mar 3 18:24:02 EET 2023


The path attribute in the Set-Cookie header is optional but treated by ffmpeg as being compulsory.

Signed-off-by: Michael J. Walsh <mjfwalsh at gmail.com>
—--
 libavformat/http.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/libavformat/http.c b/libavformat/http.c
index 7bce821535..dde22a7e09 100644
--- a/libavformat/http.c
+++ b/libavformat/http.c
@@ -1293,9 +1293,9 @@ static int get_cookies(HTTPContext *s, char **cookies, const char *path,
                 goto skip_cookie;
         }
 
-        // ensure this cookie matches the path
+        // if a cookie path is provided, ensure the request path is within that path
         e = av_dict_get(cookie_params, "path", NULL, 0);
-        if (!e || av_strncasecmp(path, e->value, strlen(e->value)))
+        if (e && av_strncasecmp(path, e->value, strlen(e->value)))
             goto skip_cookie;
 
         // cookie parameters match, so copy the value
-- 
2.30.2




More information about the ffmpeg-devel mailing list