Files
qemu/block
Antoine Damhet 7b13fc97d7 block/curl: add support for S3 presigned URLs
S3 presigned URLs are signed for a specific HTTP method (typically GET
for our use cases). The curl block driver currently issues a HEAD
request to discover the web server features and the file size, which
fails with 'HTTP 403' (forbidden).

Add a 'force-range' option that skips the HEAD request and instead
issues a minimal GET request (querying 1 byte from the server) to
extract the file size from the 'Content-Range' response header. To
achieve this the 'curl_header_cb' is redesigned to generically parse
HTTP headers.

$ $QEMU -drive driver=https,\
             'url=https://s3.example.com/some.img?X-Amz-Security-Token=XXX',
             force-range=true

Enabling the 'force-range' option without the web server specified with
@url supporting it might cause the server to respond successfully with
'HTTP 200' and attempt to send the whole file body. With the
'CURLOPT_NOBODY' option set the libcurl will skip reading after the
headers and close the connection. QEMU still gracefully detects the
missing feature. This might waste a small number of TCP packets but is
otherwise transparent to the user.

Acked-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Antoine Damhet <adamhet@scaleway.com>
Message-ID: <20260227-fix-curl-v3-v3-3-eb8a4d88feef@scaleway.com>
Reviewed-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2026-03-10 15:48:48 +01:00
..
2026-03-10 12:12:02 +01:00
2025-12-27 10:11:09 +01:00
2025-11-11 22:06:09 +01:00
2025-03-06 14:21:25 +01:00
2023-11-08 17:56:18 +01:00
2026-01-17 10:46:42 +11:00
2024-12-20 17:44:56 +01:00
2026-03-10 14:33:55 +01:00
2025-11-18 18:01:57 +01:00
2025-12-15 09:50:41 -05:00
2023-11-08 17:56:18 +01:00
2023-11-08 17:56:18 +01:00