Vely logo install | documentation | examples | changelog
16.10.0 released May 10, 2023
exit-request

Purpose: Exit current request processing.

exit-request

Exits current request by transferring control directly after the top-level request dispatcher. If there is an after_request_handler, it will still execute, unless exit-request is called from before_request_handler. exit-request will have no effect in startup_handler because that handler runs before any requests.

exit-request is useful when your request handler has called other functions (i.e. those implemented in non_request source files), which may have called others (etc.), and there is no need to return in the reverse order, nor to pass any further data back to them; in which case returning one step at a time may be cumbersome and error prone.

In other words, exit-request jumps to the top-level request dispatcher, and the stack of functions called to get to exit-request will be bypassed, thus those functions will not get control back; and they will not perform any additional work, rather simply the next request will be processed immediately.

Never user C's exit() function, as it will terminate the server process and prevent exit-code from functioning properly.
Examples
#include "vely.h"

void req_handler()
{
    ...
    exit-request
    ...
}

See also
Program flow ( exit-request  )  SEE ALL (documentation)


Copyright (c) 2017-2023 Dasoftver LLC