aboutsummaryrefslogtreecommitdiffstats
path: root/uri.c
diff options
context:
space:
mode:
authorDaniel Veillard <veillard@src.gnome.org>2000-10-02 23:04:54 +0000
committerDaniel Veillard <veillard@src.gnome.org>2000-10-02 23:04:54 +0000
commit740abf5ae7bb78491a031feb501baea43ded7688 (patch)
tree65b5b90ee41884d8c3372fb5e721d38fc9d84419 /uri.c
parent3bff2b0e5d2428cff9778ae60d38476f6c58c43b (diff)
downloadandroid_external_libxml2-740abf5ae7bb78491a031feb501baea43ded7688.tar.gz
android_external_libxml2-740abf5ae7bb78491a031feb501baea43ded7688.tar.bz2
android_external_libxml2-740abf5ae7bb78491a031feb501baea43ded7688.zip
Big XPath cleanup continues, one URI fix:
- xpath.[ch] debugXML.c testXPath.c: fixed the XPath evaluation engine, should be far more stable, incorporated a new version of preceding/following axis, need testing - uri.c: fixed file:///c:/a/b/c problem - test/XPath/tests/idsimple: augmented the XPath tests Daniel
Diffstat (limited to 'uri.c')
-rw-r--r--uri.c26
1 files changed, 25 insertions, 1 deletions
diff --git a/uri.c b/uri.c
index 7166c5d9..cb1c215c 100644
--- a/uri.c
+++ b/uri.c
@@ -373,6 +373,17 @@ xmlSaveUri(xmlURIPtr uri) {
ret[len++] = lo + (lo > 9? 'A'-10 : '0');
}
}
+ } else if (uri->scheme != NULL) {
+ if (len + 3 >= max) {
+ max *= 2;
+ ret = (xmlChar *) xmlRealloc(ret, (max + 1) * sizeof(xmlChar));
+ if (ret == NULL) {
+ fprintf(stderr, "xmlSaveUri: out of memory\n");
+ return(NULL);
+ }
+ }
+ ret[len++] = '/';
+ ret[len++] = '/';
}
if (uri->path != NULL) {
p = uri->path;
@@ -767,11 +778,24 @@ xmlParseURIServer(xmlURIPtr uri, const char **str) {
cur = *str;
}
/*
+ * This can be empty in the case where there is no server
+ */
+ host = cur;
+ if (*cur == '/') {
+ if (uri != NULL) {
+ if (uri->authority != NULL) xmlFree(uri->authority);
+ uri->authority = NULL;
+ if (uri->server != NULL) xmlFree(uri->server);
+ uri->server = NULL;
+ uri->port = 0;
+ }
+ return(0);
+ }
+ /*
* host part of hostport can derive either an IPV4 address
* or an unresolved name. Check the IP first, it easier to detect
* errors if wrong one
*/
- host = cur;
if (IS_DIGIT(*cur)) {
while(IS_DIGIT(*cur)) cur++;
if (*cur != '.')