diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 18:45:59 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 18:45:59 +0000 |
commit | 19fcec84d8d7d21e796c7624e521b60d28ee21ed (patch) | |
tree | 42d26aa27d1e3f7c0b8bd3fd14e7d7082f5008dc /src/civetweb/docs/api/mg_set_request_handler.md | |
parent | Initial commit. (diff) | |
download | ceph-19fcec84d8d7d21e796c7624e521b60d28ee21ed.tar.xz ceph-19fcec84d8d7d21e796c7624e521b60d28ee21ed.zip |
Adding upstream version 16.2.11+ds.upstream/16.2.11+dsupstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r-- | src/civetweb/docs/api/mg_set_request_handler.md | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/src/civetweb/docs/api/mg_set_request_handler.md b/src/civetweb/docs/api/mg_set_request_handler.md new file mode 100644 index 000000000..95a09a08d --- /dev/null +++ b/src/civetweb/docs/api/mg_set_request_handler.md @@ -0,0 +1,26 @@ +# Civetweb API Reference + +### `mg_set_request_handler( ctx, uri, handler, cbdata );` + +### Parameters + +| Parameter | Type | Description | +| :--- | :--- | :--- | +|**`ctx`**|`struct mg_context *`|The context where the handler must be active| +|**`uri`**|`const char *`|The URI to hook the handler on| +|**`handler`**|`mg_request_handler`|Callback function doing the heavy lifting| +|**`cbdata`**|`void *`|Optional user supplied data| + +`int mg_request_handler( struct mg_connection *conn, void *cbdata );` + +### Return Value + +*none* + +### Description + +The function `mg_set_request_handler()` hooks a callback function on a URI. That callback function is called whenever a client requests the specific URI. The callback function receives the connection information and optional user supplied data as parameters and can serve information back to the client. When the callback function does not send any information back to the client, it should return **0** to signal Civetweb that the Civetweb core should handle the request. A return value between 1 and 999 is used to tell Civetweb that the request has been handled and no further processing is necessary. The returned code is stored as the status code in the access log, it is therefore recommended, although not mandatory to return a status code which matches the state of the request. + +### See Also + +* [`mg_set_auth_handler();`](mg_set_auth_handler.md) |