diff options
Diffstat (limited to 'docs/ref')
| -rw-r--r-- | docs/ref/api/http.md | 18 | ||||
| -rw-r--r-- | docs/ref/xref.md | 2 |
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 --> |
