diff options
| -rw-r--r-- | demo/rest/server.c | 6 | ||||
| -rw-r--r-- | docs/man/nng_http_handler_collect_body.3http.adoc | 11 | ||||
| -rw-r--r-- | docs/ref/migrate/nng1.md | 3 | ||||
| -rw-r--r-- | include/nng/supplemental/http/http.h | 2 | ||||
| -rw-r--r-- | src/supplemental/http/http_public.c | 4 |
5 files changed, 8 insertions, 18 deletions
diff --git a/demo/rest/server.c b/demo/rest/server.c index ee4047b5..1e1ccc96 100644 --- a/demo/rest/server.c +++ b/demo/rest/server.c @@ -289,10 +289,8 @@ rest_start(uint16_t port) // the data yourself with another HTTP read transaction by disabling // this, but that's a lot of work, especially if you want to handle // chunked transfers. - if ((rv = nng_http_handler_collect_body(handler, true, 1024 * 128)) != - 0) { - fatal("nng_http_handler_collect_body", rv); - } + nng_http_handler_collect_body(handler, true, 1024 * 128); + if ((rv = nng_http_server_add_handler(server, handler)) != 0) { fatal("nng_http_handler_add_handler", rv); } diff --git a/docs/man/nng_http_handler_collect_body.3http.adoc b/docs/man/nng_http_handler_collect_body.3http.adoc index b614f675..d02919cd 100644 --- a/docs/man/nng_http_handler_collect_body.3http.adoc +++ b/docs/man/nng_http_handler_collect_body.3http.adoc @@ -20,7 +20,7 @@ nng_http_handler_collect_body - set HTTP handler to collect request body #include <nng/nng.h> #include <nng/supplemental/http/http.h> -int nng_http_handler_collect_body(nng_http_handler *handler, bool want, size_t maxsz); +void nng_http_handler_collect_body(nng_http_handler *handler, bool want, size_t maxsz); ---- == DESCRIPTION @@ -60,15 +60,6 @@ This is considered a bug, and is a deficiency for full HTTP/1.1 compliance. However, few clients send data in this format, so in practice this should create few limitations. -== RETURN VALUES - -This function returns 0 on success, and non-zero otherwise. - -== ERRORS - -[horizontal] -`NNG_ENOTSUP`:: No support for HTTP in the library. - == SEE ALSO [.text-left] diff --git a/docs/ref/migrate/nng1.md b/docs/ref/migrate/nng1.md index 8035f854..8186e5cb 100644 --- a/docs/ref/migrate/nng1.md +++ b/docs/ref/migrate/nng1.md @@ -234,8 +234,11 @@ They may silently truncate data, and the handler methods may not have any effect - [`nng_http_req_set_method`] - [`nng_http_res_set_status`] +- [`nng_http_handler_collect_body`] - [`nng_http_handler_set_host`] - [`nng_http_handler_set_method`] +- [`nng_http_handler_set_tree`] +- [`nng_http_handler_set_tree_exclusive`] ## Security Descriptors (Windows Only) diff --git a/include/nng/supplemental/http/http.h b/include/nng/supplemental/http/http.h index a25768e9..e94aa0b3 100644 --- a/include/nng/supplemental/http/http.h +++ b/include/nng/supplemental/http/http.h @@ -372,7 +372,7 @@ NNG_DECL void nng_http_handler_set_host(nng_http_handler *, const char *); // then a 400 Bad Request will be sent back to the client. To set an // unlimited value, use (size_t)-1. To preclude the client from sending // *any* data, use 0. (The static and file handlers use 0 by default.) -NNG_DECL int nng_http_handler_collect_body(nng_http_handler *, bool, size_t); +NNG_DECL void nng_http_handler_collect_body(nng_http_handler *, bool, size_t); // nng_http_handler_set_tree indicates that the handler is being registered // for a hierarchical tree, rather than just a single path, so it will be diff --git a/src/supplemental/http/http_public.c b/src/supplemental/http/http_public.c index f85eca64..1dccbdf6 100644 --- a/src/supplemental/http/http_public.c +++ b/src/supplemental/http/http_public.c @@ -594,17 +594,15 @@ nng_http_handler_set_method(nng_http_handler *h, const char *meth) #endif } -int +void nng_http_handler_collect_body(nng_http_handler *h, bool want, size_t len) { #ifdef NNG_SUPP_HTTP nni_http_handler_collect_body(h, want, len); - return (0); #else NNI_ARG_UNUSED(h); NNI_ARG_UNUSED(want); NNI_ARG_UNUSED(len); - return (NNG_ENOTSUP); #endif } |
