summaryrefslogtreecommitdiff
path: root/src/ne_uri.c
diff options
context:
space:
mode:
authorjoe <joe@61a7d7f5-40b7-0310-9c16-bb0ea8cb1845>2006-01-01 21:19:25 +0000
committerjoe <joe@61a7d7f5-40b7-0310-9c16-bb0ea8cb1845>2006-01-01 21:19:25 +0000
commit836b2572c5c914face53165c7448f2d92e91d8d7 (patch)
tree6e9fc4ae969e936e24ba7313d8a2f30c8643c8ee /src/ne_uri.c
parent6f61acd09bb1d8ce139462a235424985d6e740ac (diff)
downloadneon-836b2572c5c914face53165c7448f2d92e91d8d7.tar.gz
* src/ne_uri.c (ne_uri_unparse): Handle port correctly if scheme is
undefined. * test/uri-tests.c (unparse): Add test case. git-svn-id: http://svn.webdav.org/repos/projects/neon/trunk@815 61a7d7f5-40b7-0310-9c16-bb0ea8cb1845
Diffstat (limited to 'src/ne_uri.c')
-rw-r--r--src/ne_uri.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/src/ne_uri.c b/src/ne_uri.c
index 22e59af..2bd9929 100644
--- a/src/ne_uri.c
+++ b/src/ne_uri.c
@@ -543,12 +543,14 @@ char *ne_uri_unparse(const ne_uri *uri)
ne_buffer_concat(buf, uri->userinfo, "@", NULL);
}
ne_buffer_zappend(buf, uri->host);
- }
- if (uri->port > 0 && ne_uri_defaultport(uri->scheme) != uri->port) {
- char str[20];
- ne_snprintf(str, 20, ":%d", uri->port);
- ne_buffer_zappend(buf, str);
+ if (uri->port > 0
+ && (!uri->scheme
+ || ne_uri_defaultport(uri->scheme) != uri->port)) {
+ char str[20];
+ ne_snprintf(str, 20, ":%d", uri->port);
+ ne_buffer_zappend(buf, str);
+ }
}
ne_buffer_zappend(buf, uri->path);