This is an automated email from the git hooks/post-receive script. Git pushed a commit to branch release/7.1 in repository ffmpeg.
commit 1b368260500831c9ecdb0fc08b99103e7accc43d Author: Marvin Scholz <[email protected]> AuthorDate: Thu May 22 20:14:49 2025 +0200 Commit: Marvin Scholz <[email protected]> CommitDate: Tue Dec 9 15:14:05 2025 +0000 avformat/http: Handle IPv6 Zone ID in hostname When using a literal IPv6 address as hostname, it can contain a Zone ID especially in the case of link-local addresses. Sending this to the server in the Host header is not useful to the server and in some cases servers refuse such requests. To prevent any such issues, strip the Zone ID from the address if it's an IPv6 address. This also removes it for the Cookies lookup. Based on a patch by: Daniel N Pettersson <[email protected]> (cherry picked from commit 5cb6d2221a6d4c07453b6c301ecfcaed48402680) Signed-off-by: Marvin Scholz <[email protected]> --- libavformat/http.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/libavformat/http.c b/libavformat/http.c index b674171d3c..c152dc7a17 100644 --- a/libavformat/http.c +++ b/libavformat/http.c @@ -22,6 +22,7 @@ #include "config.h" #include "config_components.h" +#include <string.h> #include <time.h> #if CONFIG_ZLIB #include <zlib.h> @@ -212,7 +213,7 @@ static int http_open_cnx_internal(URLContext *h, AVDictionary **options) const char *path, *proxy_path, *lower_proto = "tcp", *local_path; char *env_http_proxy, *env_no_proxy; char *hashmark; - char hostname[1024], hoststr[1024], proto[10]; + char hostname[1024], hoststr[1024], proto[10], tmp_host[1024]; char auth[1024], proxyauth[1024] = ""; char path1[MAX_URL_SIZE], sanitized_path[MAX_URL_SIZE + 1]; char buf[1024], urlbuf[MAX_URL_SIZE]; @@ -222,7 +223,14 @@ static int http_open_cnx_internal(URLContext *h, AVDictionary **options) av_url_split(proto, sizeof(proto), auth, sizeof(auth), hostname, sizeof(hostname), &port, path1, sizeof(path1), s->location); - ff_url_join(hoststr, sizeof(hoststr), NULL, NULL, hostname, port, NULL); + + av_strlcpy(tmp_host, hostname, sizeof(tmp_host)); + // In case of an IPv6 address, we need to strip the Zone ID, + // if any. We do it at the first % sign, as percent encoding + // can be used in the Zone ID itself. + if (strchr(tmp_host, ':')) + tmp_host[strcspn(tmp_host, "%")] = '\0'; + ff_url_join(hoststr, sizeof(hoststr), NULL, NULL, tmp_host, port, NULL); env_http_proxy = getenv_utf8("http_proxy"); proxy_path = s->http_proxy ? s->http_proxy : env_http_proxy; _______________________________________________ ffmpeg-cvslog mailing list -- [email protected] To unsubscribe send an email to [email protected]
