From 338706c2420ce3e51b546a6ba2574e10346a511b Mon Sep 17 00:00:00 2001 From: Garrett D'Amore Date: Wed, 17 Jan 2018 22:49:37 -0800 Subject: fixes #211 Restore handling of '*' in URL logic --- src/core/url.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'src/core') 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; -- cgit v1.2.3-70-g09d2