int nng_http_handler_collect_body(nng_http_handler *handler, bool want, size_t maxsz);
nng_http_handler_collect_data() function causes the handler to
collect any request body that was submitted with the request, and attach
it to the
nng_http_req before the handler is called.
Subsequently the data can be retrieved by the handler from the request with the
The collection is enabled if want is true. Furthermore, the data that the client may sent is limited by the value of maxsz. If the client attempts to send more data than maxsz, then the request will be terminated with a 400 “Bad Request” status.
|Limiting the size of incoming request data can provide protection against denial of service attacks, as a buffer of the client-supplied size must be allocated to receive the data.
In order to provide an unlimited size, use
(size_t)-1 for maxsz.
0 for maxsz can be used to prevent any data from being passed
by the client.
The built-in handlers for files, directories, and static data limit the maxsz to zero by default. Otherwise the default setting is to enable this capability with a default value of maxsz of 1 megabyte.
The handler looks for data indicated by the
If this header is absent, the request is assumed not to contain any data.
This specifically does not support the
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.
This function returns 0 on success, and non-zero otherwise.
No support for HTTP in the library.