From nobody Mon Feb 9 01:31:01 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 63.128.21.74 as permitted sender) client-ip=63.128.21.74; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-74.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.74 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1585577132; cv=none; d=zohomail.com; s=zohoarc; b=fmJKxlPjA27YWQE8s/1uCeijABuKMZTASA0v9EDe2SqbFcthhN1Td8uN6SWGw0B6TkYA6GrBaoXO/xBl4YH2cy8SHby1neHeQCZo6QO023UfXN1KMhs7UlrGDjj74x7bW3R9ZJbbz0AhOlxokEff/zTnNDj0ac0wBgXECvMI28A= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1585577132; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=WuWOKLO05hh6gJvbnTs15I7Zsgi4CjUW9O3h/Ld/jq8=; b=bIWq9ItJi/kb0uUsysfENqs8DOM1oehtLVv+3fjwJ6FPeBgRrnyL5rZsPioXbHIKQRzfWmT/b+B1aryn3enqVshMjwYdYEApcUZFM+mZ1qg2czXUke0x0zuPYKTo4D3YIzDkZ2nseghiOBBuYQC2Mi+3sd8P8928mz4rXCgTZMo= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.74 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-74.mimecast.com (us-smtp-delivery-74.mimecast.com [63.128.21.74]) by mx.zohomail.com with SMTPS id 15855771324851018.9861155801455; Mon, 30 Mar 2020 07:05:32 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-426-42yUnDWuO8WjcQyZbLM_Ww-1; Mon, 30 Mar 2020 10:05:28 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id C68C68018A1; Mon, 30 Mar 2020 14:05:22 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 8C404A7D0; Mon, 30 Mar 2020 14:05:22 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id DFE1318089C8; Mon, 30 Mar 2020 14:05:21 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 02UE5K3j021614 for ; Mon, 30 Mar 2020 10:05:20 -0400 Received: by smtp.corp.redhat.com (Postfix) id 31C50A7D0; Mon, 30 Mar 2020 14:05:20 +0000 (UTC) Received: from angien.redhat.com (unknown [10.43.2.48]) by smtp.corp.redhat.com (Postfix) with ESMTP id A9BF6A7EC for ; Mon, 30 Mar 2020 14:05:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1585577131; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=WuWOKLO05hh6gJvbnTs15I7Zsgi4CjUW9O3h/Ld/jq8=; b=PjilgkYp77YmAj0y9ztS53lL4aaGjOBKotWiYAn7mTmQH3VU9AL9gXpYaV/jHaYd7oC8bP f5/Tqqlg7eAPCWlgQmKXK18j6htLchA9o9FEHcEjc7WbPTkU6q90Yo8w7sVBFMu5LixJe3 PZiMGjN4+Y3shDluGw3Z6TxsZ94ykno= X-MC-Unique: 42yUnDWuO8WjcQyZbLM_Ww-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH v2 4/4] virStorageSourceParseBackingURI: Preserve query string of URI for http(s) Date: Mon, 30 Mar 2020 16:05:09 +0200 Message-Id: <235d0916fd35c887e305d97eb8b44b9c2640b7ce.1585576985.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-loop: libvir-list@redhat.com X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" For http/https URIs we need to preserve the query part as it may be important to refer to the image. Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- src/util/virstoragefile.c | 13 ++++++++++--- tests/virstoragetest.c | 4 ++-- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/src/util/virstoragefile.c b/src/util/virstoragefile.c index bccef863b4..069bc8d776 100644 --- a/src/util/virstoragefile.c +++ b/src/util/virstoragefile.c @@ -2852,9 +2852,16 @@ virStorageSourceParseBackingURI(virStorageSourcePtr = src, return -1; } - /* handle socket stored as a query */ - if (uri->query) - src->hosts->socket =3D g_strdup(STRSKIP(uri->query, "socket=3D")); + if (uri->query) { + if (src->protocol =3D=3D VIR_STORAGE_NET_PROTOCOL_HTTP || + src->protocol =3D=3D VIR_STORAGE_NET_PROTOCOL_HTTPS) { + src->query =3D g_strdup(uri->query); + } else { + /* handle socket stored as a query */ + if (STRPREFIX(uri->query, "socket=3D")) + src->hosts->socket =3D g_strdup(STRSKIP(uri->query, "socke= t=3D")); + } + } /* uri->path is NULL if the URI does not contain slash after host: * transport://host:port */ diff --git a/tests/virstoragetest.c b/tests/virstoragetest.c index 10d5421150..6e8ebeba13 100644 --- a/tests/virstoragetest.c +++ b/tests/virstoragetest.c @@ -1632,7 +1632,7 @@ mymain(void) "\"file.url\": \"https://host/folder/es= x6.5-rhel7.7-x86%5f64/esx6.5-rhel7.7-x86%5f64-flat.vmdk?dcPath=3Ddata&dsNam= e=3Desx6.5-matrix\"," "\"file.timeout\": 2000" "}", - "\n" + "\n" " \n" " \n" " \n" @@ -1647,7 +1647,7 @@ mymain(void) "\"file.url\": \"https://host/folder/es= x6.5-rhel7.7-x86%5f64/esx6.5-rhel7.7-x86%5f64-flat.vmdk?dcPath=3Ddata&dsNam= e=3Desx6.5-matrix\"," "\"file.timeout\": 2000" "}", - "\n" + "\n" " \n" " \n" " \n" --=20 2.24.1