19.0.0 released Nov 08, 2023
Exit request

Purpose: Exit current request processing.


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 use C's exit() function, as it will terminate the server process and prevent exit-code from functioning properly.
In this example, a request handler "req_handler" calls function "my_function()" which exits the request:
#include "vely.h"

request-handler /req_handler
    // After exit-request in my_function(), the following code is never executed

void my_function () {

See also
Program flow
See all

You are free to copy, redistribute and adapt this web page (even commercially), as long as you give credit and provide a dofollow link back to this page - see full license at CC-BY-4.0. Copyright (c) 2019-2023 Dasoftver LLC. Vely and elephant logo are trademarks of Dasoftver LLC. The software and information on this web site are provided "AS IS" and without any warranties or guarantees of any kind. Icons from table-icons.io copyright PaweĊ‚ Kuna, licensed under MIT license.