From patchwork Mon Jan 16 20:51:55 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Max Reitz X-Patchwork-Id: 9519505 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 5646E60209 for ; Mon, 16 Jan 2017 21:19:00 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 482F4281F9 for ; Mon, 16 Jan 2017 21:19:00 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3D1B62823E; Mon, 16 Jan 2017 21:19:00 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id D4EFB281F9 for ; Mon, 16 Jan 2017 21:18:59 +0000 (UTC) Received: from localhost ([::1]:59643 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cTEg6-0001ab-Uk for patchwork-qemu-devel@patchwork.kernel.org; Mon, 16 Jan 2017 16:18:59 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:46625) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cTEGD-0003Nc-4i for qemu-devel@nongnu.org; Mon, 16 Jan 2017 15:52:13 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cTEGA-0004RH-4q for qemu-devel@nongnu.org; Mon, 16 Jan 2017 15:52:13 -0500 Received: from mx1.redhat.com ([209.132.183.28]:35400) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cTEG8-0004QR-7S; Mon, 16 Jan 2017 15:52:08 -0500 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 554827F09D; Mon, 16 Jan 2017 20:52:08 +0000 (UTC) Received: from localhost (ovpn-204-161.brq.redhat.com [10.40.204.161]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id v0GKq64t028094 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Mon, 16 Jan 2017 15:52:07 -0500 From: Max Reitz To: qemu-block@nongnu.org Date: Mon, 16 Jan 2017 21:51:55 +0100 Message-Id: <20170116205156.32513-4-mreitz@redhat.com> In-Reply-To: <20170111181432.18868-1-mreitz@redhat.com> References: <20170111181432.18868-1-mreitz@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Mon, 16 Jan 2017 20:52:08 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH v4 24/25] 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+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP Signed-off-by: Max Reitz --- block/curl.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/block/curl.c b/block/curl.c index 34a5b0f7e3..7f129a35df 100644 --- a/block/curl.c +++ b/block/curl.c @@ -872,6 +872,20 @@ static int64_t curl_getlength(BlockDriverState *bs) return s->len; } +static void curl_refresh_filename(BlockDriverState *bs) +{ + BDRVCURLState *s = bs->opaque; + + if (!s->sslverify || 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_sgfnt_runtime_opts[] = { CURL_BLOCK_OPT_URL, CURL_BLOCK_OPT_SSLVERIFY, @@ -899,6 +913,7 @@ static BlockDriver bdrv_http = { .bdrv_detach_aio_context = curl_detach_aio_context, .bdrv_attach_aio_context = curl_attach_aio_context, + .bdrv_refresh_filename = curl_refresh_filename, .sgfnt_runtime_opts = curl_sgfnt_runtime_opts, }; @@ -917,6 +932,7 @@ static BlockDriver bdrv_https = { .bdrv_detach_aio_context = curl_detach_aio_context, .bdrv_attach_aio_context = curl_attach_aio_context, + .bdrv_refresh_filename = curl_refresh_filename, .sgfnt_runtime_opts = curl_sgfnt_runtime_opts, }; @@ -935,6 +951,7 @@ static BlockDriver bdrv_ftp = { .bdrv_detach_aio_context = curl_detach_aio_context, .bdrv_attach_aio_context = curl_attach_aio_context, + .bdrv_refresh_filename = curl_refresh_filename, .sgfnt_runtime_opts = curl_sgfnt_runtime_opts, }; @@ -953,6 +970,7 @@ static BlockDriver bdrv_ftps = { .bdrv_detach_aio_context = curl_detach_aio_context, .bdrv_attach_aio_context = curl_attach_aio_context, + .bdrv_refresh_filename = curl_refresh_filename, .sgfnt_runtime_opts = curl_sgfnt_runtime_opts, };