aboutsummaryrefslogtreecommitdiff
path: root/docs/ref
diff options
context:
space:
mode:
authorGarrett D'Amore <garrett@damore.org>2025-10-09 07:54:52 -0700
committerGarrett D'Amore <garrett@damore.org>2025-10-09 19:01:15 -0700
commitf41cd6a9edf4b9a680194b3fb4378f39d1ed1f34 (patch)
tree6179629b18645429e44e1440063363e975138923 /docs/ref
parent9601545c27c948e9df530c5f0a912fb15cab9101 (diff)
downloadnng-f41cd6a9edf4b9a680194b3fb4378f39d1ed1f34.tar.gz
nng-f41cd6a9edf4b9a680194b3fb4378f39d1ed1f34.tar.bz2
nng-f41cd6a9edf4b9a680194b3fb4378f39d1ed1f34.zip
fixes #1868 Add nng_http_[remote,local]_address APIs.
Diffstat (limited to 'docs/ref')
-rw-r--r--docs/ref/api/http.md18
-rw-r--r--docs/ref/xref.md2
2 files changed, 20 insertions, 0 deletions
diff --git a/docs/ref/api/http.md b/docs/ref/api/http.md
index 772fe2ad..05821cbc 100644
--- a/docs/ref/api/http.md
+++ b/docs/ref/api/http.md
@@ -557,6 +557,17 @@ This function returns immediately, with no return value.
Completion of the operation is signaled via the _aio_, and the final result
may be obtained via [`nng_aio_result`].
+### Socket Addresses
+
+```c
+nng_err nng_http_local_address(nng_http *conn, nng_sockaddr *addr);
+nng_err nng_http_remote_address(nng_http *conn, nng_sockaddr *addr);
+```
+
+The {{i:`nng_http_local_address`}} and {{i:`nng_http_remote_address`}} functions
+can be used to determine the local and remote addresses for an HTTP connection.
+This can only be done while the connection is alive.
+
### Response Body
## Server API
@@ -781,6 +792,13 @@ exactly the value of the `Host` header sent by the client.
> The port number may be ignored; at present the HTTP server framework
> does not support a single server listening on different ports concurrently.
+### Detecting Addresses
+
+The [`nng_http_local_address`] and [`nng_http_remote_address`] functions
+can be used to determine the local and remote addresses for an HTTP connection
+on the server side (in a handler) just like the can be for HTTP clients
+This can be useful to provide different handling behaviors based on network identity.
+
### Handling an Entire Tree
```c
diff --git a/docs/ref/xref.md b/docs/ref/xref.md
index ee561cd0..cbaeb7c1 100644
--- a/docs/ref/xref.md
+++ b/docs/ref/xref.md
@@ -312,6 +312,8 @@
[`nng_http_handler_set_data`]: ../api/http.md#setting-the-callback-argument
[`nng_http_handler_set_tree`]: ../api/http.md#handling-an-entire-tree
[`nng_http_transact`]: ../api/http.md#submitting-the-transaction
+[`nng_http_local_address`]: ../api/http.md#socket-addresses
+[`nng_http_remote_address`]: ../api/http.md#socket-addresses
<!-- HTTP Status -->