summaryrefslogtreecommitdiff
path: root/uri.c
diff options
context:
space:
mode:
authorRaphaël Hertzog <hertzog@debian.org>2015-08-25 21:55:55 +0200
committerRaphaël Hertzog <hertzog@debian.org>2015-08-25 21:55:55 +0200
commit21ee18bdbc9a9d4500e12a1399d51c593b8b31d4 (patch)
tree35c498d3ec731bcf7b90ce66bce68ecd54659250 /uri.c
parentde338c1adfa336ddb5177ceb5c63bcd868a0ebc7 (diff)
parent7300193becde71a344c8ac0973dc290fa24d800d (diff)
downloadlibxml2-21ee18bdbc9a9d4500e12a1399d51c593b8b31d4.tar.gz
Merge tag 'upstream/2.9.1+dfsg1'
Upstream version 2.9.1+dfsg1
Diffstat (limited to 'uri.c')
-rw-r--r--uri.c36
1 files changed, 17 insertions, 19 deletions
diff --git a/uri.c b/uri.c
index ff47abb..4ab0ce2 100644
--- a/uri.c
+++ b/uri.c
@@ -759,8 +759,6 @@ xmlParse3986HierPart(xmlURIPtr uri, const char **str)
cur += 2;
ret = xmlParse3986Authority(uri, &cur);
if (ret != 0) return(ret);
- if (uri->server == NULL)
- uri->port = -1;
ret = xmlParse3986PathAbEmpty(uri, &cur);
if (ret != 0) return(ret);
*str = cur;
@@ -1108,7 +1106,7 @@ xmlSaveUri(xmlURIPtr uri) {
}
}
} else {
- if ((uri->server != NULL) || (uri->port == -1)) {
+ if (uri->server != NULL) {
if (len + 3 >= max) {
temp = xmlSaveUriRealloc(ret, &max);
if (temp == NULL) goto mem_error;
@@ -1145,24 +1143,22 @@ xmlSaveUri(xmlURIPtr uri) {
}
ret[len++] = '@';
}
- if (uri->server != NULL) {
- p = uri->server;
- while (*p != 0) {
- if (len >= max) {
- temp = xmlSaveUriRealloc(ret, &max);
- if (temp == NULL) goto mem_error;
- ret = temp;
- }
- ret[len++] = *p++;
+ p = uri->server;
+ while (*p != 0) {
+ if (len >= max) {
+ temp = xmlSaveUriRealloc(ret, &max);
+ if (temp == NULL) goto mem_error;
+ ret = temp;
}
- if (uri->port > 0) {
- if (len + 10 >= max) {
- temp = xmlSaveUriRealloc(ret, &max);
- if (temp == NULL) goto mem_error;
- ret = temp;
- }
- len += snprintf((char *) &ret[len], max - len, ":%d", uri->port);
+ ret[len++] = *p++;
+ }
+ if (uri->port > 0) {
+ if (len + 10 >= max) {
+ temp = xmlSaveUriRealloc(ret, &max);
+ if (temp == NULL) goto mem_error;
+ ret = temp;
}
+ len += snprintf((char *) &ret[len], max - len, ":%d", uri->port);
}
} else if (uri->authority != NULL) {
if (len + 3 >= max) {
@@ -1198,6 +1194,8 @@ xmlSaveUri(xmlURIPtr uri) {
if (temp == NULL) goto mem_error;
ret = temp;
}
+ ret[len++] = '/';
+ ret[len++] = '/';
}
if (uri->path != NULL) {
p = uri->path;