aboutsummaryrefslogtreecommitdiff
path: root/src/core
diff options
context:
space:
mode:
authorGarrett D'Amore <garrett@damore.org>2018-01-17 22:49:37 -0800
committerGarrett D'Amore <garrett@damore.org>2018-01-17 22:49:37 -0800
commit338706c2420ce3e51b546a6ba2574e10346a511b (patch)
tree6bcb07f219936e5780eecf683309660a810f8f3e /src/core
parent4c637fe5e4624eeaac55ed77deabdf427d2ba7a6 (diff)
downloadnng-338706c2420ce3e51b546a6ba2574e10346a511b.tar.gz
nng-338706c2420ce3e51b546a6ba2574e10346a511b.tar.bz2
nng-338706c2420ce3e51b546a6ba2574e10346a511b.zip
fixes #211 Restore handling of '*' in URL logic
Diffstat (limited to 'src/core')
-rw-r--r--src/core/url.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/core/url.c b/src/core/url.c
index 7e1b61b5..1c3d6c83 100644
--- a/src/core/url.c
+++ b/src/core/url.c
@@ -283,6 +283,20 @@ nni_url_parse(nni_url **urlp, const char *raw)
}
}
+ // If the hostname part is just '*', skip over it. (We treat it
+ // as an empty host for legacy nanomsg compatibility. This may be
+ // non-RFC compliant, but we're really only interested in parsing
+ // nanomsg URLs. One weird side effect of this is that some URLS
+ // which would be invalid (ipc://*/bogus for example) will now parse
+ // to something that might be surprising (ipc:///bogus now), for
+ // example -- although in the IPC case the URL is *always* a local
+ // path without any host component.
+ if (((len == 1) && (s[0] == '*')) ||
+ ((len > 1) && (strncmp(s, "*:", 2) == 0))) {
+ s++;
+ len--;
+ }
+
if ((url->u_host = nni_alloc(len + 1)) == NULL) {
rv = NNG_ENOMEM;
goto error;