aboutsummaryrefslogtreecommitdiff
path: root/src/supplemental/http/http_public.c
diff options
context:
space:
mode:
authorGarrett D'Amore <garrett@damore.org>2025-10-25 11:43:59 -0700
committerGarrett D'Amore <garrett@damore.org>2025-10-25 20:11:51 -0700
commitcc419cf01d9c060a3bd3fc318f9b9bc9e736dae9 (patch)
tree2f26cd782a54bed35e03b451003deee5df701983 /src/supplemental/http/http_public.c
parentebc479a61b8f2d2f3a6d846d18debfb9022e6010 (diff)
downloadnng-cc419cf01d9c060a3bd3fc318f9b9bc9e736dae9.tar.gz
nng-cc419cf01d9c060a3bd3fc318f9b9bc9e736dae9.tar.bz2
nng-cc419cf01d9c060a3bd3fc318f9b9bc9e736dae9.zip
Add stream direct address functions for socket addresses.
This is going to be used to facilitate debugging, and eliminate some inconveniences around these things. We plan to move the pipe functions to use these directly, hopefully moving away from the pipe_getopt hack. (The transport API will need to grow these. For now this is just the streams.)
Diffstat (limited to 'src/supplemental/http/http_public.c')
-rw-r--r--src/supplemental/http/http_public.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/src/supplemental/http/http_public.c b/src/supplemental/http/http_public.c
index 8c225e5e..edf5e609 100644
--- a/src/supplemental/http/http_public.c
+++ b/src/supplemental/http/http_public.c
@@ -309,13 +309,23 @@ nng_http_read_response(nng_http *conn, nng_aio *aio)
nng_err
nng_http_remote_address(nng_http *conn, nng_sockaddr *addrp)
{
- return (nni_http_get_addr(conn, NNG_OPT_REMADDR, addrp));
+ const nng_sockaddr *sap;
+ nng_err rv;
+ if ((rv = nni_http_peer_addr(conn, &sap)) == NNG_OK) {
+ *addrp = *sap;
+ }
+ return (rv);
}
nng_err
nng_http_local_address(nng_http *conn, nng_sockaddr *addrp)
{
- return (nni_http_get_addr(conn, NNG_OPT_LOCADDR, addrp));
+ const nng_sockaddr *sap;
+ nng_err rv;
+ if ((rv = nni_http_self_addr(conn, &sap)) == NNG_OK) {
+ *addrp = *sap;
+ }
+ return (rv);
}
nng_err