aboutsummaryrefslogtreecommitdiff
path: root/src/core
diff options
context:
space:
mode:
authorGarrett D'Amore <garrett@damore.org>2024-11-22 18:43:13 -0800
committerGarrett D'Amore <garrett@damore.org>2024-11-22 18:43:13 -0800
commitdacb9629b9161cbd09de533842bb05ee0b0cad48 (patch)
treede0c8a70440c3f7e8dea5763e5a6d4a3aef32284 /src/core
parentcef6e70c0b3e92e36b6895e7d6e981b00c702f9b (diff)
downloadnng-dacb9629b9161cbd09de533842bb05ee0b0cad48.tar.gz
nng-dacb9629b9161cbd09de533842bb05ee0b0cad48.tar.bz2
nng-dacb9629b9161cbd09de533842bb05ee0b0cad48.zip
Fix socket:// hostname should be null, and add test case
Diffstat (limited to 'src/core')
-rw-r--r--src/core/url.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/core/url.c b/src/core/url.c
index e436b0e1..c4bda443 100644
--- a/src/core/url.c
+++ b/src/core/url.c
@@ -390,8 +390,13 @@ nni_url_parse_inline(nng_url *url, const char *raw)
if ((strcmp(url->u_scheme, "ipc") == 0) ||
(strcmp(url->u_scheme, "unix") == 0) ||
(strcmp(url->u_scheme, "abstract") == 0) ||
- (strcmp(url->u_scheme, "inproc") == 0)) {
- url->u_path = p;
+ (strcmp(url->u_scheme, "inproc") == 0) ||
+ (strcmp(url->u_scheme, "socket") == 0)) {
+ url->u_path = p;
+ url->u_hostname = NULL;
+ url->u_query = NULL;
+ url->u_fragment = NULL;
+ url->u_userinfo = NULL;
return (0);
}
@@ -553,7 +558,8 @@ nng_url_sprintf(char *str, size_t size, const nng_url *url)
if ((strcmp(scheme, "ipc") == 0) || (strcmp(scheme, "inproc") == 0) ||
(strcmp(scheme, "unix") == 0) ||
- (strcmp(scheme, "abstract") == 0)) {
+ (strcmp(scheme, "abstract") == 0) ||
+ (strcmp(scheme, "socket") == 0)) {
return (snprintf(str, size, "%s://%s", scheme, url->u_path));
}