Repository navigation
Query Maps
Header: <cwist/net/http/query.h>
cwist_query_map is a string-to-string hash map keyed with SipHash and a
random per-map seed (so attackers cannot force collisions). CWIST uses it for
query parameters (req->query_params), path parameters
(req->path_params), parsed cookies and flash messages.
static void search(cwist_http_request *req, cwist_http_response *res) {
const char *q = cwist_query_map_get(req->query_params, "q"); /* NULL if absent */
const char *page = cwist_query_map_get(req->query_params, "page");
...
}req->query_params is NULL when the request has no query string;
cwist_query_map_get() accepts a NULL map and returns NULL.
| Function | Description |
|---|---|
cwist_query_map *cwist_query_map_create(void) |
Empty map. |
void cwist_query_map_destroy(cwist_query_map *map) |
Free it and its strings. |
void cwist_query_map_parse(cwist_query_map *map, const char *raw_query) |
Parse a=1&b=2 (percent-decoding through liburiparser). |
const char *cwist_query_map_get(cwist_query_map *map, const char *key) |
Value or NULL; owned by the map. |
void cwist_query_map_set(cwist_query_map *map, const char *key, const char *value) |
Set or replace (copied). |
void cwist_query_map_delete(cwist_query_map *map, const char *key) |
Remove a key. |
void cwist_query_map_clear(cwist_query_map *map) |
Remove every entry. |
void cwist_query_map_foreach(cwist_query_map *map, cwist_query_map_iter_func cb, void *ctx) |
Call cb(key, value, ctx) for each entry. |
cwist_query_map_create_in_arena(arena) places the map in a request arena;
the framework uses it for per-request maps.
The keyed hash itself is available as siphash24(src, len, key) with
cwist_generate_hash_seed(key) in <cwist/core/siphash/siphash.h>.
CWIST wiki, written against the dev branch of c4punks/CWIST. Pages marked "Source:" are generated from files under docs/; fix those in the repository. Questions: Discord.
Getting started
- Installation
- Quick Start
- Linking
- Server Modes
- Configuration and Environment
- Project CLI
- Tutorial / Korean
- Examples and Tutorials
Guides
Core
- API Reference
- Application
- Routing
- Middleware
- Requests and Responses
- Async Handlers
- Streaming Responses
- Error Handling
- Graceful Shutdown
- Multiport
Protocols
- HTTPS and TLS
- HTTP/2
- HTTP/3 and QUIC
- WebTransport
- WebSocket
- Server-Sent Events
- gRPC Server
- gRPC Client
- Protobuf and Codegen
- GraphQL
- WebRTC DataChannels
- HTTP Clients
Web features
- Static Files and Assets
- Big Dumb Reply Cache
- Compression
- Cookies
- Sessions and Flash
- Query Maps
- Multipart Uploads
- HTML Components
- Templates
- JSON
- Validation
- OpenAPI
Security
Data
Runtime
- Memory Management
- Full GC
- Async GC Ownership
- SString
- Reactor and I/O
- Metrics and Health
- Logging
- Testing
Platforms
Performance notes
- Benchmark Methodology
- C1M File Limits
- Reactor Fairness
- Cooperative Queuing
- Classic Pool Starvation
- Reactor Wakeup
- wrk Dual Histogram
- FIXED Endpoint Cache
- ADR-0001
- Durable Queue Gate
- Mux References
Project