diff options
| author | Garrett D'Amore <garrett@damore.org> | 2024-11-18 01:17:24 -0800 |
|---|---|---|
| committer | Garrett D'Amore <garrett@damore.org> | 2024-11-18 08:33:05 -0800 |
| commit | ca6cfe359fa55a5a7f4b6ae73500ffd98e6ee968 (patch) | |
| tree | d69a9af2e88c9bf5bc0d565bdd2ea975f2723d52 /src/platform | |
| parent | e54e2b1a98abfdb75232a9b3218714ce34c9a34f (diff) | |
| download | nng-ca6cfe359fa55a5a7f4b6ae73500ffd98e6ee968.tar.gz nng-ca6cfe359fa55a5a7f4b6ae73500ffd98e6ee968.tar.bz2 nng-ca6cfe359fa55a5a7f4b6ae73500ffd98e6ee968.zip | |
URL refactor part 1.
This eliminates most (but not all) of the dynamic allocations
associated with URL objects. A number of convenience fields
on the URL are removed, but we are able to use common buffer
for most of the details.
Diffstat (limited to 'src/platform')
| -rw-r--r-- | src/platform/posix/posix_resolv_gai.c | 9 | ||||
| -rw-r--r-- | src/platform/windows/win_resolv.c | 10 |
2 files changed, 12 insertions, 7 deletions
diff --git a/src/platform/posix/posix_resolv_gai.c b/src/platform/posix/posix_resolv_gai.c index 7a0f8e1f..c26657e9 100644 --- a/src/platform/posix/posix_resolv_gai.c +++ b/src/platform/posix/posix_resolv_gai.c @@ -230,9 +230,12 @@ nni_resolv_ip(const char *host, uint16_t port, int af, bool passive, if (nni_aio_begin(aio) != 0) { return; } - if (host != NULL && strlen(host) >= sizeof(item->host)) { - nni_aio_finish_error(aio, NNG_EADDRINVAL); - return; + if (host != NULL) { + if ((strlen(host) >= sizeof(item->host)) || + (strcmp(host, "*") == 0)) { + nni_aio_finish_error(aio, NNG_EADDRINVAL); + return; + } } switch (af) { case NNG_AF_INET: diff --git a/src/platform/windows/win_resolv.c b/src/platform/windows/win_resolv.c index ece14655..f9e5e1f6 100644 --- a/src/platform/windows/win_resolv.c +++ b/src/platform/windows/win_resolv.c @@ -190,11 +190,13 @@ nni_resolv_ip(const char *host, uint16_t port, int family, bool passive, if (nni_aio_begin(aio) != 0) { return; } - if (host != NULL && strlen(host) >= sizeof(item->host)) { - nni_aio_finish_error(aio, NNG_EADDRINVAL); - return; + if (host != NULL) { + if ((strlen(host) >= sizeof(item->host)) || + (strcmp(host, "*") == 0)) { + nni_aio_finish_error(aio, NNG_EADDRINVAL); + return; + } } - switch (family) { case NNG_AF_INET: fam = AF_INET; |
