From 3d075fad7496ec126c5087d1c36ab7a4af73ce16 Mon Sep 17 00:00:00 2001 From: Garrett D'Amore Date: Mon, 22 Jan 2018 14:05:10 -0800 Subject: fixes #219 transports should take URL structure instead of string address This eliminates a bunch of redundant URL parsing, using the common URL logic we already have in place. While here I fixed a problem with the TLS and WSS test suites that was failing on older Ubuntu -- apparently older versions of mbedTLS were unhappy if selecting OPTIONAL verification without a validate certificate chain. --- src/transport/ipc/ipc.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'src/transport/ipc') diff --git a/src/transport/ipc/ipc.c b/src/transport/ipc/ipc.c index 84292bb8..62751d86 100644 --- a/src/transport/ipc/ipc.c +++ b/src/transport/ipc/ipc.c @@ -529,17 +529,16 @@ nni_ipc_ep_fini(void *arg) } static int -nni_ipc_ep_init(void **epp, const char *url, nni_sock *sock, int mode) +nni_ipc_ep_init(void **epp, nni_url *url, nni_sock *sock, int mode) { nni_ipc_ep *ep; int rv; size_t sz; - if (strncmp(url, "ipc://", strlen("ipc://")) != 0) { - return (NNG_EADDRINVAL); + if (((url->u_host != NULL) && (strlen(url->u_host) > 0)) || + (url->u_userinfo != NULL)) { + return (NNG_EINVAL); } - url += strlen("ipc://"); - if ((ep = NNI_ALLOC_STRUCT(ep)) == NULL) { return (NNG_ENOMEM); } @@ -547,7 +546,7 @@ nni_ipc_ep_init(void **epp, const char *url, nni_sock *sock, int mode) sz = sizeof(ep->sa.s_un.s_path.sa_path); ep->sa.s_un.s_path.sa_family = NNG_AF_IPC; - if (nni_strlcpy(ep->sa.s_un.s_path.sa_path, url, sz) >= sz) { + if (nni_strlcpy(ep->sa.s_un.s_path.sa_path, url->u_path, sz) >= sz) { NNI_FREE_STRUCT(ep); return (NNG_EADDRINVAL); } -- cgit v1.2.3-70-g09d2