Commit 7063ee2f3c for ffmpeg
commit 7063ee2f3cd5bb20b778341a6ae368c36792603d
Author: Michael Niedermayer <michael@niedermayer.cc>
Date: Sat Nov 7 00:22:09 2026 +0100
avformat/httpcookie: strip whitespace around cookie and attribute values
As specified by RFC 6265 section 5.2. "sid= secret" was sent with the
spaces and "Domain= example.com" matched no host.
Fixes: cookie values with surrounding whitespace
diff --git a/libavformat/httpcookie.c b/libavformat/httpcookie.c
index 369a367181..e1ab2a9681 100644
--- a/libavformat/httpcookie.c
+++ b/libavformat/httpcookie.c
@@ -83,7 +83,7 @@ int ff_http_parse_set_cookie(const char *set_cookie, AVDictionary **cookie, AVDi
return AVERROR_INVALIDDATA;
}
*eql = '\0';
- ret = av_dict_set(cookie, trim(param), eql + 1, 0);
+ ret = av_dict_set(cookie, trim(param), trim(eql + 1), 0);
while (ret >= 0 && (param = av_strtok(next_param, ";", &saveptr))) {
char *value = strchr(param, '=');
@@ -92,7 +92,7 @@ int ff_http_parse_set_cookie(const char *set_cookie, AVDictionary **cookie, AVDi
*value++ = '\0';
param = trim(param);
if (*param)
- ret = av_dict_set(attributes, param, value ? value : "", 0);
+ ret = av_dict_set(attributes, param, value ? trim(value) : "", 0);
}
av_free(cstr);