nanomsg next generation NNG  
Home GitHub Documentation

This documentation is for version v1.2.2 of nng, but the latest released version is v1.2.5. see the documentation for v1.2.5 for the most up-to-date information.
nng_http_server_set_error_page(3http)

SYNOPSIS

#include <nng/nng.h>
#include <nng/supplemental/http/http.h>

int nng_http_server_set_error_page(nng_http_server *server,
        uint16_t code, const char *html);

DESCRIPTION

The nng_http_server_set_error_page() sets an error page to be used for HTTP status code on the server instance server. The body content of the HTTP responses will contain html.

The custom HTML content will be used when the server is returning an internally generated error response, or is returning an error response that was allocated with the nng_http_res_alloc_error() function. This HTML content will also be used if the application calls the nng_http_server_res_error(). The last custom error page set for code by either this function or nng_http_server_error_file() will be used.

Error responses that have their body content changed after allocation, or that are written directly by the application, will not use the body content supplied here.

The supplied HTML content is copied by this function, and may be reused after this function returns.

RETURN VALUES

This function returns 0 on success, and non-zero otherwise.

ERRORS

NNG_ENOMEM

Insufficient free memory exists.

NNG_ENOTSUP

HTTP not supported.

NNG Reference Manual vv1.2.2 © 2019 Staysail Systems, Inc, © 2018 Capitar IT Group BV
This document is supplied under the MIT License.
nanomsg™ and nng™ are trademarks of Garrett D'Amore.