On Fri, Oct 02, 2009 at 12:18:19PM +0200, Ralf Junker wrote:
> I could narrow the problem down to the fact that uri.c has indeed changed in
> an incompatible way. Consider this:
>
> uri = xmlParseURIRaw('http://www.google.com', 0);
>
> After the call, in 2.7.5 uri->path contains an empty string. In previous
> versions it contained NULL, just like the other "empty" pieces.
>
> I believe that this a bug in uri.c. It clearly results in the problem
> described in my initial message.
Yes I tend to agree, this is an oversight.
And I think this affect only the path part, for other parts like
fragment, query or username, there is an extra symbol (# ? or @)
which would get lost if we didn't convert to "" . But for all the
case for path I think this need fixing, could you try the enclosed
patch which I think covers all cases ?
thanks for raising the issue !
Daniel
--
Daniel Veillard | libxml Gnome XML XSLT toolkit http://xmlsoft.org/
[email protected] | Rpmfind RPM search engine http://rpmfind.net/
http://veillard.com/ | virtualization library http://libvirt.org/
diff --git a/uri.c b/uri.c
index 1e5e03f..807b183 100644
@@ -558,10 +558,14 @@ xmlParse3986PathAbEmpty(xmlURIPtr uri, const char **str)
}
if (uri != NULL) {
if (uri->path != NULL) xmlFree(uri->path);
- if (uri->cleanup & 2)
- uri->path = STRNDUP(*str, cur - *str);
- else
- uri->path = xmlURIUnescapeString(*str, cur - *str, NULL);
+ if (*str != cur) {
+ if (uri->cleanup & 2)
+ uri->path = STRNDUP(*str, cur - *str);
+ else
+ uri->path = xmlURIUnescapeString(*str, cur - *str, NULL);
+ } else {
+ uri->path = NULL;
+ }
}
*str = cur;
return (0);
@@ -600,10 +604,14 @@ xmlParse3986PathAbsolute(xmlURIPtr uri, const char **str)
}
if (uri != NULL) {
if (uri->path != NULL) xmlFree(uri->path);
- if (uri->cleanup & 2)
- uri->path = STRNDUP(*str, cur - *str);
- else
- uri->path = xmlURIUnescapeString(*str, cur - *str, NULL);
+ if (cur != *str) {
+ if (uri->cleanup & 2)
+ uri->path = STRNDUP(*str, cur - *str);
+ else
+ uri->path = xmlURIUnescapeString(*str, cur - *str, NULL);
+ } else {
+ uri->path = NULL;
+ }
}
*str = cur;
return (0);
@@ -638,10 +646,14 @@ xmlParse3986PathRootless(xmlURIPtr uri, const char **str)
}
if (uri != NULL) {
if (uri->path != NULL) xmlFree(uri->path);
- if (uri->cleanup & 2)
- uri->path = STRNDUP(*str, cur - *str);
- else
- uri->path = xmlURIUnescapeString(*str, cur - *str, NULL);
+ if (cur != *str) {
+ if (uri->cleanup & 2)
+ uri->path = STRNDUP(*str, cur - *str);
+ else
+ uri->path = xmlURIUnescapeString(*str, cur - *str, NULL);
+ } else {
+ uri->path = NULL;
+ }
}
*str = cur;
return (0);
@@ -676,10 +688,14 @@ xmlParse3986PathNoScheme(xmlURIPtr uri, const char **str)
}
if (uri != NULL) {
if (uri->path != NULL) xmlFree(uri->path);
- if (uri->cleanup & 2)
- uri->path = STRNDUP(*str, cur - *str);
- else
- uri->path = xmlURIUnescapeString(*str, cur - *str, NULL);
+ if (cur != *str) {
+ if (uri->cleanup & 2)
+ uri->path = STRNDUP(*str, cur - *str);
+ else
+ uri->path = xmlURIUnescapeString(*str, cur - *str, NULL);
+ } else {
+ uri->path = NULL;
+ }
}
*str = cur;
return (0);
_______________________________________________
xml mailing list, project page http://xmlsoft.org/
[email protected]
http://mail.gnome.org/mailman/listinfo/xml