Re: Support for older libxml2 [Was: [PATCH] Fixed URI parsing]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 02/15/2012 08:01 AM, Daniel Veillard wrote:

> I completely missed this, I'm not sure I understand comment 2:
> 
>  paphio:~/XML -> testURI --debug 'qemu+ssh://[3ffe::102]/system'
>  scheme: qemu+ssh
>  server: [3ffe::102]
>  path: /system
>  qemu+ssh://[3ffe::102]/system
>  paphio:~/XML ->
> 
> Seems to me that libxml2 URI parsing works as expected
> if I look at http://www.ietf.org/rfc/rfc3986.txt which is the level
> of the URI spec that libxml2 implements:

> so it seems to me that the "[" and "]" are part of the host address
> per the RFC spec and well libxml2 parsing is adequate. I'm not sure
> I understand the parsing problem,

It boils down to an ease-of-use question.  Within a URI, I agree with
you that IPv6 addresses in the 'host' element of 'authority' have a
mandatory [].  Outside of a URI, IPv6 addresses must not have [] for use
in any other libc functions.  So either all clients of libxml2 must
strip [] when reading the server: field of the broken-down struct, and
reinstate [] before asking libxml to reconstruct a valid URI, or libxml2
could be taught to provide some convenient hooks:

server: remains as is
server_cooked: new field, which matches server for IPv4 and hostnames,
and which for IPv6 strips the []

and when constructing a URI from user-provided elements, automatically
add in the needed [] around IPv6 addresses (which are otherwise invalid
as they are not IPv4 nor hostnames) to create a valid URI without the
user having to track [].

However, since any ease-of-use improvements to libxml2 will only show up
in new libxml2 versions, and we must still interoperate with old
versions, I think this patch is on the right track of abstracting the
fact that libvirt must manage [] (strip it on parse, re-add it on
format) rather than relying on libxml2.

-- 
Eric Blake   eblake@xxxxxxxxxx    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]