GNOME Bugzilla – Bug 694185
xmlCtxtReadFile doesn't work with literal IPv6 URLs
Last modified: 2013-02-28 10:28:17 UTC
Created attachment 236782 [details] sample program RedHat Bug 624626 discusses the new behavior of libxml regarding brackets around IPv6 addresses. In earlier versions such as 2.6.27, uri.c stripped the brackets (e.g. uri->server == "fdf2:1e39:73d1:934e::119"); in the current version it returns IPv6 addresses with brackets intact (e.g. uri->server == "[fdf2:1e39:73d1:934e::119]"). Thus in 2.9.0, xmlCtxtReadFile() has a problem when it is passed a URL containing a literal IPv6 address. xmlCtxReadFile() and its subroutines pass uri->server unchanged to getaddrinfo(), which doesn't recognize a bracketed IPv6 address, so the read fails. In the sample program attached, it returns: error : No such file or directory I/O warning : failed to load external entity "http://[fdf2:1e39:73d1:934e::119:4567/Manifest.xml" The attached patch strips the brackets from the uri->server value, and allows the sample program to execute without error.
Created attachment 236783 [details] [review] Proposed fix
Okay, fixed after a bit of hardening of the patch: http://git.gnome.org/browse/libxml2/commit/?id=19d785b5c76fcd9d7bc2c8d678b05ed83b02f91d thanks a lot ! Daniel