[libvirt] parsing url with percent sign when user want to use iso disk via http

Ján Tomko jtomko at redhat.com
Fri Jan 22 09:19:38 UTC 2016


On Fri, Jan 22, 2016 at 09:59:53AM +0100, Michal Privoznik wrote:
> On 19.01.2016 13:15, Vasiliy Tolstov wrote:
> > I found a strange thing, when i specify url for iso in libvirt xml like:
> > 

What does the XML look like? AFAIK libvirt does not support specifying
the whole disk URL, just separate parts of it.

> > qemu gets invalid url in cmdline
> > i think that problem is
> > qemu/qemu_command.c:3430:            ret = virURIFormat(uri);
> > 
> > test string looks like  https://alukardd.org/data/test?t=1
> > qemu gets url with percent urlencoded %3F , in this case http server
> > get not test with param t=1 but filename test%3Ft=1 so this is not
> > right.
> > 
> > why libvirt try to fix contructed url ?
> > does it safe to delete this line ?
> > 
> 
> No it's not safe. Othewise you won't get any source string for your
> disk. The line we are talking about is in qemuBuildNetworkDriveURI().
> Now, it's virURIFormat that formats the URI and it uses libxml2 for
> that. In our tests it seems like we should be discarding escape
> sequences in Format(). Take a look at tests/viruritest.c and you'll see.
> So maybe a bug in libxml2?

libxml2 does the right thing here.
We treat the <source name=''/> attribute as the 'path' part of the URI,
not 'path?query'. If the query is important, a separate XML attribute
would be neater than overloading 'name' to do both.

Jan
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20160122/c2a48a3c/attachment-0001.sig>


More information about the libvir-list mailing list