enhanced xmlBuildRelativeURI to allow the URI and the base to be in
* uri.c: enhanced xmlBuildRelativeURI to allow the URI and the
base to be in "relative" form
diff --git a/uri.c b/uri.c
index d2fa521..1fdbaf8 100644
--- a/uri.c
+++ b/uri.c
@@ -2070,14 +2070,6 @@
if ((URI == NULL) || (*URI == 0))
return NULL;
- /*
- * Special case - if URI starts with '.', we assume it's already
- * in relative form, so nothing to do.
- */
- if (*URI == '.') {
- val = xmlStrdup (URI);
- goto done;
- }
/*
* First parse URI into a standard form
@@ -2085,9 +2077,13 @@
ref = xmlCreateURI ();
if (ref == NULL)
return NULL;
- ret = xmlParseURIReference (ref, (const char *) URI);
- if (ret != 0)
- goto done; /* Error in URI, return NULL */
+ /* If URI not already in "relative" form */
+ if (URI[0] != '.') {
+ ret = xmlParseURIReference (ref, (const char *) URI);
+ if (ret != 0)
+ goto done; /* Error in URI, return NULL */
+ } else
+ ref->path = (char *)xmlStrdup(URI);
/*
* Next parse base into the same standard form
@@ -2099,9 +2095,12 @@
bas = xmlCreateURI ();
if (bas == NULL)
goto done;
- ret = xmlParseURIReference (bas, (const char *) base);
- if (ret != 0)
- goto done; /* Error in base, return NULL */
+ if (base[0] != '.') {
+ ret = xmlParseURIReference (bas, (const char *) base);
+ if (ret != 0)
+ goto done; /* Error in base, return NULL */
+ } else
+ bas->path = (char *)xmlStrdup(base);
/*
* If the scheme / server on the URI differs from the base,