KEEL 1.0.0
Minimal C11 HTTP client/server library built on epoll/kqueue/io_uring/poll
Loading...
Searching...
No Matches
Data Fields
KlRoute Struct Reference

#include <router.h>

Collaboration diagram for KlRoute:
Collaboration graph
[legend]

Data Fields

const char * method
 
const char * pattern
 
size_t method_len
 
size_t pattern_len
 
KlHandler handler
 
void * user_data
 
KlBodyReaderFactory body_reader
 
KlWsServerConfigws_config
 
int streaming_handler
 
int streaming_async
 

Field Documentation

◆ method

const char* KlRoute::method

HTTP method ("GET", "POST", "*")

◆ pattern

const char* KlRoute::pattern

URL pattern ("/path", "/path/:param")

◆ method_len

size_t KlRoute::method_len

Length of method string

◆ pattern_len

size_t KlRoute::pattern_len

Length of pattern string

◆ handler

KlHandler KlRoute::handler

Handler function

◆ user_data

void* KlRoute::user_data

Opaque data passed to handler

◆ body_reader

KlBodyReaderFactory KlRoute::body_reader

Body reader factory (NULL = discard body)

◆ ws_config

KlWsServerConfig* KlRoute::ws_config

WebSocket config (non-NULL = WebSocket endpoint)

◆ streaming_handler

int KlRoute::streaming_handler

1 = invoke handler after body_reader setup BEFORE the body is fully read; the handler may yield mid-stream and the body reader's on_data callback is responsible for resuming. Used by streaming multipart and similar pull-from-body APIs.

◆ streaming_async

int KlRoute::streaming_async

1 = invoke handler BEFORE feeding any leftover body bytes via on_data (v2.2.0+). Requires the handler to yield on NEED_DATA — it'll be resumed by the body reader's on_data callback for the leftover AND subsequent socket reads.

Implies streaming_handler=1 — set both via kl_server_route_streaming_async.

Enables the full error-path mid-stream early-exit (a structured response can be written even when the cap fires inside leftover processing). Routes that opt out (use the legacy kl_server_route_streaming) still get the partial early-exit covering caps that fire after dispatch.


The documentation for this struct was generated from the following file: