From nobody Fri Nov 7 13:01:08 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1538783783042234.55945131994326; Fri, 5 Oct 2018 16:56:23 -0700 (PDT) Received: from localhost ([::1]:37404 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g8ZxC-0007kO-Fx for importer@patchew.org; Fri, 05 Oct 2018 19:56:18 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:57630) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g8Zj8-0003rL-3C for qemu-devel@nongnu.org; Fri, 05 Oct 2018 19:41:50 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1g8Zj5-0000ml-HJ for qemu-devel@nongnu.org; Fri, 05 Oct 2018 19:41:44 -0400 Received: from mx1.redhat.com ([209.132.183.28]:45212) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1g8Ziw-0000au-Te; Fri, 05 Oct 2018 19:41:35 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 1B6F130820D1; Fri, 5 Oct 2018 23:41:34 +0000 (UTC) Received: from localhost (ovpn-204-46.brq.redhat.com [10.40.204.46]) by smtp.corp.redhat.com (Postfix) with ESMTPS id A081271D41; Fri, 5 Oct 2018 23:41:33 +0000 (UTC) From: Max Reitz To: qemu-block@nongnu.org Date: Sat, 6 Oct 2018 01:40:20 +0200 Message-Id: <20181005234023.8104-29-mreitz@redhat.com> In-Reply-To: <20181005234023.8104-1-mreitz@redhat.com> References: <20181005234023.8104-1-mreitz@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.47]); Fri, 05 Oct 2018 23:41:34 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH v11 28/31] block/curl: Implement bdrv_refresh_filename() X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kevin Wolf , Alberto Garcia , qemu-devel@nongnu.org, Max Reitz Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RDMRC_1 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Signed-off-by: Max Reitz Reviewed-by: Alberto Garcia --- block/curl.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/block/curl.c b/block/curl.c index 96790fdc70..a5d3e64b84 100644 --- a/block/curl.c +++ b/block/curl.c @@ -963,6 +963,23 @@ static int64_t curl_getlength(BlockDriverState *bs) return s->len; } =20 +static void curl_refresh_filename(BlockDriverState *bs) +{ + BDRVCURLState *s =3D bs->opaque; + + /* "readahead" and "timeout" do not change the guest-visible data, + * so ignore them */ + if (s->sslverify !=3D CURL_BLOCK_OPT_SSLVERIFY_DEFAULT || + s->cookie || s->username || s->password || s->proxyusername || + s->proxypassword) + { + return; + } + + pstrcpy(bs->exact_filename, sizeof(bs->exact_filename), s->url); +} + + static const char *const curl_strong_runtime_opts[] =3D { CURL_BLOCK_OPT_URL, CURL_BLOCK_OPT_SSLVERIFY, @@ -991,6 +1008,7 @@ static BlockDriver bdrv_http =3D { .bdrv_detach_aio_context =3D curl_detach_aio_context, .bdrv_attach_aio_context =3D curl_attach_aio_context, =20 + .bdrv_refresh_filename =3D curl_refresh_filename, .strong_runtime_opts =3D curl_strong_runtime_opts, }; =20 @@ -1009,6 +1027,7 @@ static BlockDriver bdrv_https =3D { .bdrv_detach_aio_context =3D curl_detach_aio_context, .bdrv_attach_aio_context =3D curl_attach_aio_context, =20 + .bdrv_refresh_filename =3D curl_refresh_filename, .strong_runtime_opts =3D curl_strong_runtime_opts, }; =20 @@ -1027,6 +1046,7 @@ static BlockDriver bdrv_ftp =3D { .bdrv_detach_aio_context =3D curl_detach_aio_context, .bdrv_attach_aio_context =3D curl_attach_aio_context, =20 + .bdrv_refresh_filename =3D curl_refresh_filename, .strong_runtime_opts =3D curl_strong_runtime_opts, }; =20 @@ -1045,6 +1065,7 @@ static BlockDriver bdrv_ftps =3D { .bdrv_detach_aio_context =3D curl_detach_aio_context, .bdrv_attach_aio_context =3D curl_attach_aio_context, =20 + .bdrv_refresh_filename =3D curl_refresh_filename, .strong_runtime_opts =3D curl_strong_runtime_opts, }; =20 --=20 2.17.1