diff options
| author | Robert Bielik <Robert.Bielik@dirac.com> | 2019-12-28 08:35:17 +0100 |
|---|---|---|
| committer | Garrett D'Amore <garrett@damore.org> | 2019-12-29 22:39:13 -0800 |
| commit | 86b4573c22af46582d5018f9b86cb9f96f5f6c44 (patch) | |
| tree | 8691841228a0a3bb20cdbe9227f1c4023804eb54 /src/supplemental/http | |
| parent | 0cf84675edef0290a74dfd1e289c0b9e1bb3fb5c (diff) | |
| download | nng-86b4573c22af46582d5018f9b86cb9f96f5f6c44.tar.gz nng-86b4573c22af46582d5018f9b86cb9f96f5f6c44.tar.bz2 nng-86b4573c22af46582d5018f9b86cb9f96f5f6c44.zip | |
Add http server method for getting address
Diffstat (limited to 'src/supplemental/http')
| -rw-r--r-- | src/supplemental/http/http_public.c | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/src/supplemental/http/http_public.c b/src/supplemental/http/http_public.c index 3152c41f..d2e876ab 100644 --- a/src/supplemental/http/http_public.c +++ b/src/supplemental/http/http_public.c @@ -9,8 +9,8 @@ // #include "core/nng_impl.h" -#include "nng/supplemental/http/http.h" #include "http_api.h" +#include "nng/supplemental/http/http.h" #include "nng/supplemental/tls/tls.h" // Symbols in this file are "public" versions of the HTTP API. @@ -780,6 +780,22 @@ nng_http_server_get_tls(nng_http_server *srv, struct nng_tls_config **cfgp) } int +nng_http_server_get_addr(nng_http_server *srv, nng_sockaddr *addrp) +{ +#ifdef NNG_SUPP_HTTP + size_t size = sizeof(nng_sockaddr); + if (srv == NULL || addrp == NULL) + return NNG_EINVAL; + return (nni_http_server_getx( + srv, NNG_OPT_LOCADDR, addrp, &size, NNI_TYPE_SOCKADDR)); +#else + NNI_ARG_UNUSED(srv); + NNI_ARG_UNUSED(addrp); + return (NNG_ENOTSUP); +#endif +} + +int nng_http_server_res_error(nng_http_server *srv, nng_http_res *res) { #ifdef NNG_SUPP_HTTP |
