|
KEEL 1.0.0
Minimal C11 HTTP client/server library built on epoll/kqueue/io_uring/poll
|


Go to the source code of this file.
Data Structures | |
| struct | KlBodyReader |
| struct | KlBufReader |
| Built-in buffer reader — accumulates body into a growable buffer. More... | |
Typedefs | |
| typedef struct KlRequest | KlRequest |
| Forward declaration — full definition in request.h. | |
| typedef struct KlBodyReader | KlBodyReader |
| Pluggable body reader interface. | |
| typedef KlBodyReader *(* | KlBodyReaderFactory) (KlAllocator *alloc, const KlRequest *req, void *user_data) |
| Factory creates a body reader for a given request. | |
Functions | |
| KlBodyReader * | kl_body_reader_buffer (KlAllocator *alloc, const KlRequest *req, void *user_data) |
| Factory: create a buffer body reader. | |
| typedef struct KlBodyReader KlBodyReader |
Pluggable body reader interface.
The factory receives a fully-parsed KlRequest with valid header pointers. Inspect method, path, Content-Type, Content-Length, etc. in the factory — header pointers into read_buf may be invalidated once the body spans multiple socket reads. Handlers should access body data exclusively through the body reader, not through KlRequest header fields.
| typedef KlBodyReader *(* KlBodyReaderFactory) (KlAllocator *alloc, const KlRequest *req, void *user_data) |
Factory creates a body reader for a given request.
user_data is the value passed to kl_server_route / kl_router_add. Return NULL to reject the request (KEEL sends 415 and closes).
| KlBodyReader * kl_body_reader_buffer | ( | KlAllocator * | alloc, |
| const KlRequest * | req, | ||
| void * | user_data | ||
| ) |
Factory: create a buffer body reader.
Pass max_size as user_data via cast: (void *)(size_t)max_size. Pass NULL (0) for unlimited.
| alloc | Allocator for buffer growth. |
| req | Parsed request (headers inspectable). |
| user_data | Cast to size_t max_size limit. |