|
cwist
Modern C web framework with libttak runtime
|
middleware.h interface. More...

Go to the source code of this file.
Enumerations | |
| enum | cwist_log_format_t { CWIST_LOG_COMMON , CWIST_LOG_COMBINED , CWIST_LOG_JSON } |
| Access log middleware output formats. More... | |
Functions | |
| cwist_middleware_func | cwist_mw_request_id (const char *header_name) |
| Request ID middleware factory. | |
| cwist_middleware_func | cwist_mw_access_log (cwist_log_format_t format) |
| Access log middleware factory. | |
| cwist_middleware_func | cwist_mw_rate_limit_ip (int requests_per_minute) |
| Fixed-window rate limiter middleware (per-IP). | |
middleware.h interface.
Definition in file middleware.h.
Access log middleware output formats.
| Enumerator | |
|---|---|
| CWIST_LOG_COMMON | |
| CWIST_LOG_COMBINED | |
| CWIST_LOG_JSON | |
Definition at line 16 of file middleware.h.
| cwist_middleware_func cwist_mw_access_log | ( | cwist_log_format_t | format | ) |
Access log middleware factory.
Access log middleware factory.
| format | Log format selector (COMMON, COMBINED, JSON). |
Definition at line 296 of file middleware.c.
References cap, CWIST_LOG_COMBINED, CWIST_LOG_COMMON, and CWIST_LOG_JSON.
| cwist_middleware_func cwist_mw_rate_limit_ip | ( | int | requests_per_minute | ) |
Fixed-window rate limiter middleware (per-IP).
Fixed-window rate limiter middleware (per-IP).
Reuses an existing wrapper when the same rate was already registered. If all CWIST_RATE_LIMIT_MAX_CFGS config slots are taken, logs a warning and falls back to the first registered wrapper.
| requests_per_minute | Allowed requests per minute (token bucket rate); values <= 0 fall back to 60. |
Definition at line 467 of file middleware.c.
References cap, and CWIST_RATE_LIMIT_MAX_CFGS.
| cwist_middleware_func cwist_mw_request_id | ( | const char * | header_name | ) |
Request ID middleware factory.
Request ID middleware factory.
| header_name | Currently unused custom header override. |
Definition at line 79 of file middleware.c.
References cap, cwist_mw_request_id_handler(), and CWIST_UNUSED.