From: Vladimir Lobanov Date: Wed, 17 Jun 2026 09:44:56 +0000 (+0300) Subject: block/curl: set User-Agent header X-Git-Tag: v11.1.0-rc2~11^2~4 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=68dd6989abe5212fc89ef0fcb6fedc460bfd1cb7;p=thirdparty%2Fqemu.git block/curl: set User-Agent header Some HTTP servers and WAFs (e.g. Amazon CloudFront) reject requests without a User-Agent header with 403 Forbidden. This makes qemu-img info and other curl-based operations fail on such URLs without any obvious indication of the root cause. Set a "QEMU/" User-Agent string on all curl handles to ensure compatibility with these endpoints. Signed-off-by: Vladimir Lobanov Reviewed-by: Michael Tokarev Signed-off-by: Michael Tokarev --- diff --git a/block/curl.c b/block/curl.c index 684c677ef7..1958eb80d1 100644 --- a/block/curl.c +++ b/block/curl.c @@ -482,6 +482,8 @@ static int curl_init_state(BDRVCURLState *s, CURLState *state) } } if (curl_easy_setopt(state->curl, CURLOPT_TIMEOUT, (long)s->timeout) || + curl_easy_setopt(state->curl, CURLOPT_USERAGENT, + "QEMU/" QEMU_VERSION) || curl_easy_setopt(state->curl, CURLOPT_WRITEFUNCTION, (void *)curl_read_cb) || curl_easy_setopt(state->curl, CURLOPT_WRITEDATA, (void *)state) ||