Re: [xml] xmlReadFile with filename instead of URL?



On Fri, Mar 30, 2007 at 09:43:43AM +1000, Michael Day wrote:
The behaviour only seems to trigger when you configure --without-zlib. I 
don't know why yet, but there are zlib specific #ifdefs in the loading 
and URL mangling code, so there could be something funny going on that 
isn't triggered when zlib is disabled.

Okay, I found the bug, it's very simple.

  haha :-) Cool !

[...]
So I suggest this patch to xmlFileOpen in xmlIO.c:

    retval = xmlFileOpen_real(filename);
    if (retval == NULL) {
        unescaped = xmlURIUnescapeString(filename, 0, NULL);
        if (unescaped != NULL) {
            retval = xmlFileOpen_real(unescaped);
            xmlFree(unescaped);
        }
    }
    return retval;

With this code the file "hello%2Fworld.xml" will be loaded first, and 
only if it is not found will "hello/world.xml" be loaded. But yeah, I 
would rather delete that entire if test, as it seems to me that any URL 
unescaping should be handled a lot earlier before xmlFileOpen sees it.

  Sounds better I made the change in SVN,

   thanks a lot !

Daniel

-- 
Red Hat Virtualization group http://redhat.com/virtualization/
Daniel Veillard      | virtualization library  http://libvirt.org/
veillard redhat com  | libxml GNOME XML XSLT toolkit  http://xmlsoft.org/
http://veillard.com/ | Rpmfind RPM search engine  http://rpmfind.net/



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