From 0274024abf87c3bc9fc81bafe5bd2a4391192705 Mon Sep 17 00:00:00 2001 From: Garrett D'Amore Date: Fri, 10 Jan 2025 12:37:13 -0800 Subject: http: drop exclusive tree mode Nothing really needs it -- we kept it in 1.0 to preserve semantics, but there is no requirement for semantic preservation in 2.0. --- docs/man/nng_http_handler_alloc.3http.adoc | 7 +------ docs/man/nng_http_handler_set_tree.3http.adoc | 20 ++++---------------- 2 files changed, 5 insertions(+), 22 deletions(-) (limited to 'docs/man') diff --git a/docs/man/nng_http_handler_alloc.3http.adoc b/docs/man/nng_http_handler_alloc.3http.adoc index 8d55c752..3eb9674a 100644 --- a/docs/man/nng_http_handler_alloc.3http.adoc +++ b/docs/man/nng_http_handler_alloc.3http.adoc @@ -114,11 +114,7 @@ The `Content-Type` will be set automatically based upon the extension of the requested file name. If a content type cannot be determined from the extension, then `application/octet-stream` is used. -The directory handler is created as a tree handler initially in exclusive mode (see -xref:nng_http_handler_set_tree.3http.adoc[nng_http_handler_set_tree_exclusive]). -This can be changed by calling -xref:nng_http_handler_set_tree.3http.adoc[nng_http_handler_set_tree(3http)] -after creating the directory handler. +The directory handler is created as a tree handler. === File Handler @@ -183,7 +179,6 @@ xref:nng_http_handler_free.3http.adoc[nng_http_handler_free(3http)], xref:nng_http_handler_set_host.3http.adoc[nng_http_handler_set_host(3http)], xref:nng_http_handler_set_method.3http.adoc[nng_http_handler_set_method(3http)], xref:nng_http_handler_set_tree.3http.adoc[nng_http_handler_set_tree(3http)], -xref:nng_http_handler_set_tree.3http.adoc[nng_http_handler_set_tree_exclusive(3http)], xref:nng_http_server_add_handler.3http.adoc[nng_http_server_add_handler(3http)], xref:nng_strerror.3.adoc[nng_strerror(3)], xref:nng_aio.5.adoc[nng_aio(5)], diff --git a/docs/man/nng_http_handler_set_tree.3http.adoc b/docs/man/nng_http_handler_set_tree.3http.adoc index 821a5f7b..77b1cc59 100644 --- a/docs/man/nng_http_handler_set_tree.3http.adoc +++ b/docs/man/nng_http_handler_set_tree.3http.adoc @@ -1,6 +1,6 @@ = nng_http_handler_set_tree(3http) -// Copyright 2024 Staysail Systems, Inc. +// Copyright 2025 Staysail Systems, Inc. // Copyright 2018 Capitar IT Group BV // Copyright 2020 Dirac Research // @@ -21,8 +21,6 @@ nng_http_handler_set_tree - set HTTP handler to match trees #include void nng_http_handler_set_tree(nng_http_handler *handler); - -void nng_http_handler_set_tree_exclusive(nng_http_handler *handler); ---- == DESCRIPTION @@ -31,27 +29,17 @@ The `nng_http_handler_set_tree()` function causes the _handler_ to be matched if by the client is a logical child of the path for _handler_, and no more specific _handler_ has been registered. -The `nng_http_handler_set_tree_exclusive()` function is similar to `nng_http_server_set_tree()` -with the distinction that the _handler_ will be considered to *exclusively* handle its request URI. -Unlike `nng_http_server_set_tree()`, it will not be possible to register additional -handlers in logical subdirectories of _handler_. - This is useful in cases when the handler would like to examine the entire path and possibly behave differently; for example a REST API that uses the rest of the path to pass additional parameters. -TIP: These methods are useful when constructing API handlers where a single +TIP: This function is useful when constructing API handlers where a single service address (path) supports dynamically generated children. - -TIP: The non-exclusive form is also useful for providing a default handler to be -generated when a more specific child does not exist. -This can provide a better experience for users than the standard 404 error -handling. +It can also provide a logical fallback instead of relying on a 404 error code. == SEE ALSO [.text-left] xref:nng_http_handler_alloc.3http.adoc[nng_http_handler_alloc(3http)], xref:nng_http_server_add_handler.3http.adoc[nng_http_server_add_handler(3http)], -xref:nng_http_get_method.3http.adoc[nng_http_get_method(3http)], -xref:nng.7.adoc[nng(7)] +xref:nng_http_get_method.3http.adoc[nng_http_get_method(3http)] -- cgit v1.2.3-70-g09d2