diff options
Diffstat (limited to 'docs/man')
| -rw-r--r-- | docs/man/CMakeLists.txt | 2 | ||||
| -rw-r--r-- | docs/man/libnng.3.adoc | 2 | ||||
| -rw-r--r-- | docs/man/nng_http_req_alloc.3http.adoc | 5 | ||||
| -rw-r--r-- | docs/man/nng_http_req_free.3http.adoc | 4 | ||||
| -rw-r--r-- | docs/man/nng_http_req_reset.3http.adoc | 48 | ||||
| -rw-r--r-- | docs/man/nng_http_res_alloc.3http.adoc | 5 | ||||
| -rw-r--r-- | docs/man/nng_http_res_free.3http.adoc | 6 | ||||
| -rw-r--r-- | docs/man/nng_http_res_reset.3http.adoc | 44 |
8 files changed, 113 insertions, 3 deletions
diff --git a/docs/man/CMakeLists.txt b/docs/man/CMakeLists.txt index e39f2da3..5381f1e5 100644 --- a/docs/man/CMakeLists.txt +++ b/docs/man/CMakeLists.txt @@ -238,6 +238,7 @@ if (NNG_ENABLE_DOC) nng_http_req_get_method nng_http_req_get_uri nng_http_req_get_version + nng_http_req_reset nng_http_req_set_data nng_http_req_set_header nng_http_req_set_method @@ -254,6 +255,7 @@ if (NNG_ENABLE_DOC) nng_http_res_get_reason nng_http_res_get_status nng_http_res_get_version + nng_http_res_reset nng_http_res_set_data nng_http_res_set_header nng_http_res_set_reason diff --git a/docs/man/libnng.3.adoc b/docs/man/libnng.3.adoc index 299b73ef..0a62f931 100644 --- a/docs/man/libnng.3.adoc +++ b/docs/man/libnng.3.adoc @@ -311,6 +311,7 @@ and connections. |<<nng_http_req_get_method.3http#,nng_http_req_get_method()>>|return HTTP request method |<<nng_http_req_get_uri.3http#,nng_http_req_get_uri()>>|return HTTP request URI |<<nng_http_req_get_version.3http#,nng_http_req_get_version()>>|return HTTP request protocol version +|<<nng_http_req_reset.3http#,nng_http_req_reset()>>|reset HTTP request structure |<<nng_http_req_set_data.3http#,nng_http_req_set_data()>>|set HTTP request body |<<nng_http_req_set_header.3http#,nng_http_req_set_header()>>|set HTTP request header |<<nng_http_req_set_method.3http#,nng_http_req_set_method()>>|set HTTP request method @@ -327,6 +328,7 @@ and connections. |<<nng_http_res_get_reason.3http#,nng_http_res_get_reason()>>|return HTTP response reason |<<nng_http_res_get_status.3http#,nng_http_res_get_status()>>|return HTTP response status |<<nng_http_res_get_version.3http#,nng_http_res_get_version()>>|return HTTP response protocol version +|<<nng_http_res_reset.3http#,nng_http_res_reset()>>|reset HTTP response structure |<<nng_http_res_set_data.3http#,nng_http_res_set_data()>>|set HTTP response body |<<nng_http_res_set_header.3http#,nng_http_res_set_header()>>|set HTTP response header |<<nng_http_res_set_reason.3http#,nng_http_res_set_reason()>>|set HTTP response reason diff --git a/docs/man/nng_http_req_alloc.3http.adoc b/docs/man/nng_http_req_alloc.3http.adoc index 3a522b3e..fe7458de 100644 --- a/docs/man/nng_http_req_alloc.3http.adoc +++ b/docs/man/nng_http_req_alloc.3http.adoc @@ -30,6 +30,10 @@ and stores a pointer to it in __reqp__. The request will be initialized to perform an HTTP/1.1 `GET` operation using the URL specified in __url__. +TIP: It is possible to specify `NULL` for the URL. +In this case the URI for the request must be specified by a subsequent call +to `<<nng_http_req_set_uri.3http#,nng_http_req_set_uri()>>`. + == RETURN VALUES This function returns 0 on success, and non-zero otherwise. @@ -53,6 +57,7 @@ This function returns 0 on success, and non-zero otherwise. <<nng_http_req_get_method.3http#,nng_http_req_get_method(3http)>>, <<nng_http_req_get_uri.3http#,nng_http_req_get_uri(3http)>>, <<nng_http_req_get_version.3http#,nng_http_req_get_version(3http)>>, +<<nng_http_req_reset.3http#,nng_http_req_reset(3http)>>, <<nng_http_req_set_data.3http#,nng_http_req_set_data(3http)>>, <<nng_http_req_set_method.3http#,nng_http_req_set_method(3http)>>, <<nng_http_req_set_uri.3http#,nng_http_req_set_uri(3http)>>, diff --git a/docs/man/nng_http_req_free.3http.adoc b/docs/man/nng_http_req_free.3http.adoc index df86c5da..2564c422 100644 --- a/docs/man/nng_http_req_free.3http.adoc +++ b/docs/man/nng_http_req_free.3http.adoc @@ -28,6 +28,9 @@ void nng_http_req_free(nng_http_req *req); The `nng_http_req_free()` function deallocates the HTTP request structure _req_ entirely. +TIP: Instead of freeing and reallocating request structures, it is possible +to reuse _req_ with `<<nng_http_req_reset.3http#,nng_http_req_reset()>>`. + == RETURN VALUES None. @@ -40,4 +43,5 @@ None. [.text-left] <<nng_http_req_alloc.3http#,nng_http_req_alloc(3http)>>, +<<nng_http_req_reset.3http#,nng_http_req_reset(3http)>>, <<nng.7#,nng(7)>> diff --git a/docs/man/nng_http_req_reset.3http.adoc b/docs/man/nng_http_req_reset.3http.adoc new file mode 100644 index 00000000..9aab704a --- /dev/null +++ b/docs/man/nng_http_req_reset.3http.adoc @@ -0,0 +1,48 @@ += nng_http_req_reset(3http) +// +// Copyright 2018 Staysail Systems, Inc. <info@staysail.tech> +// Copyright 2018 Capitar IT Group BV <info@capitar.com> +// +// This document is supplied under the terms of the MIT License, a +// copy of which should be located in the distribution where this +// file was obtained (LICENSE.txt). A copy of the license may also be +// found online at https://opensource.org/licenses/MIT. +// + +== NAME + +nng_http_req_reset - reset HTTP request structure + +== SYNOPSIS + +[source, c] +---- +#include <nng/nng.h> +#include <nng/supplemental/http/http.h> + +void nng_http_req_reset(nng_http_req *req); +---- + +== DESCRIPTION + +The `nng_http_req_reset()` function resets the request __req__ so that it +is just as if it had been freshly allocated with +`<<nng_http_req_alloc.3http#,nng_http_req_alloc()>>` with a `NULL` URL. + +NOTE: Before using this with an HTTP operation, the URI must be set using +`<<nng_http_req_set_uri.3http#,nng_http_req_set_uri()>>`. + +== RETURN VALUES + +None. + +== ERRORS + +None. + +== SEE ALSO + +[.text-left] +<<nng_http_req_alloc.3http#,nng_http_req_alloc(3http)>>, +<<nng_http_req_set_uri.3http#,nng_http_req_set_uri(3http)>>, +<<nng.7#,nng(7)>> diff --git a/docs/man/nng_http_res_alloc.3http.adoc b/docs/man/nng_http_res_alloc.3http.adoc index 2b7699a7..b395b502 100644 --- a/docs/man/nng_http_res_alloc.3http.adoc +++ b/docs/man/nng_http_res_alloc.3http.adoc @@ -28,8 +28,8 @@ int nng_http_res_alloc(nng_http_res **resp); The `nng_http_res_alloc()` function allocates a new HTTP response structure and stores a pointer to it in __resp__. The response will be initialized -with status code 200 (`NNG_HTTP_STATUS_OK`), and a reason phrase of "OK", -and HTTP protocol version "HTTP/1.1". +with status code 200 (`NNG_HTTP_STATUS_OK`), and a reason phrase of `"OK`", +and HTTP protocol version `"HTTP/1.1`". TIP: When an error response is needed, consider using `<<nng_http_res_alloc_error.3http#,nng_http_res_alloc_error()>>` instead. @@ -59,6 +59,7 @@ This function returns 0 on success, and non-zero otherwise. <<nng_http_res_get_reason.3http#,nng_http_res_get_reason(3http)>>, <<nng_http_res_get_status.3http#,nng_http_res_get_status(3http)>>, <<nng_http_res_get_version.3http#,nng_http_res_get_version(3http)>>, +<<nng_http_res_reset.3http#,nng_http_res_reset(3http)>>, <<nng_http_res_set_data.3http#,nng_http_res_set_data(3http)>>, <<nng_http_res_set_reason.3http#,nng_http_res_set_reason(3http)>>, <<nng_http_res_set_status.3http#,nng_http_res_set_status(3http)>>, diff --git a/docs/man/nng_http_res_free.3http.adoc b/docs/man/nng_http_res_free.3http.adoc index 0c7f2445..e97f0be6 100644 --- a/docs/man/nng_http_res_free.3http.adoc +++ b/docs/man/nng_http_res_free.3http.adoc @@ -28,6 +28,9 @@ void nng_http_res_free(nng_http_res *req); The `nng_http_res_free()` function deallocates the HTTP response structure _res_ entirely. +TIP: Instead of freeing and reallocating response structures, it is possible +to reuse _res_ with `<<nng_http_res_reset.3http#,nng_http_res_reset()>>`. + == RETURN VALUES None. @@ -39,5 +42,6 @@ None. == SEE ALSO [.text-left] -<<nng_http_res_alloc.3http#,nng_http_req_alloc(3http)>>, +<<nng_http_res_alloc.3http#,nng_http_res_alloc(3http)>>, +<<nng_http_res_reset.3http#,nng_http_res_reset(3http)>>, <<nng.7#,nng(7)>> diff --git a/docs/man/nng_http_res_reset.3http.adoc b/docs/man/nng_http_res_reset.3http.adoc new file mode 100644 index 00000000..f33a0207 --- /dev/null +++ b/docs/man/nng_http_res_reset.3http.adoc @@ -0,0 +1,44 @@ += nng_http_res_reset(3http) +// +// Copyright 2018 Staysail Systems, Inc. <info@staysail.tech> +// Copyright 2018 Capitar IT Group BV <info@capitar.com> +// +// This document is supplied under the terms of the MIT License, a +// copy of which should be located in the distribution where this +// file was obtained (LICENSE.txt). A copy of the license may also be +// found online at https://opensource.org/licenses/MIT. +// + +== NAME + +nng_http_res_reset - reset HTTP response structure + +== SYNOPSIS + +[source, c] +---- +#include <nng/nng.h> +#include <nng/supplemental/http/http.h> + +void nng_http_res_reset(nng_http_res *res); +---- + +== DESCRIPTION + +The `nng_http_res_reset()` function resets the response __res__ so that it +is just as if it had been freshly allocated with +`<<nng_http_res_alloc.3http#,nng_http_res_alloc()>>`. + +== RETURN VALUES + +None. + +== ERRORS + +None. + +== SEE ALSO + +[.text-left] +<<nng_http_res_alloc.3http#,nng_http_res_alloc(3http)>>, +<<nng.7#,nng(7)>> |
