diff options
author | joe <joe@61a7d7f5-40b7-0310-9c16-bb0ea8cb1845> | 2006-01-01 17:10:57 +0000 |
---|---|---|
committer | joe <joe@61a7d7f5-40b7-0310-9c16-bb0ea8cb1845> | 2006-01-01 17:10:57 +0000 |
commit | 976e620bf6fcb5e529fb666b14fc15ce999c5d38 (patch) | |
tree | df4f198f859834488914ad905833ec5aea1a39d2 /src/ne_uri.c | |
parent | 5944c98e21f73caaa5f4d7226bf7d4f71c4cdd60 (diff) | |
download | neon-976e620bf6fcb5e529fb666b14fc15ce999c5d38.tar.gz |
* src/ne_uri.c (ne_uri_parse): Empty string is a valid URI-reference,
so allow it.
(ne_uri_unparse): Handle URIs with undefined authority.
* test/uri-tests.c (parse): Add test case for former.
(unparse): Add test case for latter.
git-svn-id: http://svn.webdav.org/repos/projects/neon/trunk@811 61a7d7f5-40b7-0310-9c16-bb0ea8cb1845
Diffstat (limited to 'src/ne_uri.c')
-rw-r--r-- | src/ne_uri.c | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/src/ne_uri.c b/src/ne_uri.c index face759..a592fa9 100644 --- a/src/ne_uri.c +++ b/src/ne_uri.c @@ -151,10 +151,6 @@ int ne_uri_parse(const char *uri, ne_uri *parsed) memset(parsed, 0, sizeof *parsed); - if (uri[0] == '\0') { - return -1; - } - p = s = uri; if (uri_lookup(*p) & URI_ALPHA) { @@ -387,11 +383,15 @@ char *ne_uri_unparse(const ne_uri *uri) { ne_buffer *buf = ne_buffer_create(); - ne_buffer_concat(buf, uri->scheme, "://", - uri->userinfo ? uri->userinfo : "", - uri->userinfo ? "@" : "", - uri->host, NULL); - + if (uri->host) { + ne_buffer_concat(buf, uri->scheme, "://", + uri->userinfo ? uri->userinfo : "", + uri->userinfo ? "@" : "", + uri->host, NULL); + } else { + ne_buffer_concat(buf, uri->scheme, ":", NULL); + } + if (uri->port > 0 && ne_uri_defaultport(uri->scheme) != uri->port) { char str[20]; ne_snprintf(str, 20, ":%d", uri->port); |