From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:43361) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cAoif-0002Vi-Uo for qemu-devel@nongnu.org; Sat, 26 Nov 2016 20:57:30 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cAoif-00074X-9k for qemu-devel@nongnu.org; Sat, 26 Nov 2016 20:57:30 -0500 From: Max Reitz Date: Sun, 27 Nov 2016 02:56:21 +0100 Message-Id: <20161127015622.24105-24-mreitz@redhat.com> In-Reply-To: <20161127015622.24105-1-mreitz@redhat.com> References: <20161127015622.24105-1-mreitz@redhat.com> Subject: [Qemu-devel] [PATCH v2 23/24] block/curl: Implement bdrv_refresh_filename() List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-block@nongnu.org Cc: qemu-devel@nongnu.org, Max Reitz , Kevin Wolf , Alberto Garcia , Eric Blake 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 0777d5b..4725caf 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, }; -- 2.10.2