request.h¶
The request.h module provides functions for interacting with
mn_request objects. Learn more at Requests.
Options¶
-
MN_REQUEST_MAX_PATH_LEN¶
Defaults to 2048. The maximum supported length of any incoming URI including a trailing
NULterminator. Requests with longer URIs automatically receive an HTTP 414 URI Too Long response. To update, define before including makinori:#define MN_REQUEST_MAX_PATH_LEN 4096 #include "makinori.h"
-
MN_REQUEST_MAX_CAPTURES¶
Defaults to 16. The maximum number of captures permitted in any route. Clients using a route with more captures than this value permits will automatically receive an HTTP 501 Not Implemented response. To update, define before include makinori:
#define MN_REQUEST_MAX_CAPTURES 32 #include "makinori.h"
-
MN_REQUEST_MAX_QUERY_PARAMS¶
Defaults to 24. The maximum number of query parameters permitted in any route. Clients specifying more query parameters than this value permits will automatically receive an HTTP 501 Not Implemented response. To update, define before include makinori:
#define MN_REQUEST_MAX_QUERY_PARAMS 48 #include "makinori.h"
API¶
-
struct mn_query_param¶
A single query param. Given e.g.
abc=def, thekeycorresponds toabcwhereasvaluecorresponds todef.
-
struct mn_request¶
A client request.
-
struct mn_query_param query[MN_REQUEST_MAX_QUERY_PARAMS]¶
The query parameters sent by the client. There are a total of
query_countvalid key/value parameters set.
-
size_t query_count¶
The number of query parameters sent by the client.
-
struct mn_view captures[MN_REQUEST_MAX_CAPTURES]¶
-
size_t capture_count¶
The number of string fragments captured.
-
struct mn_query_param query[MN_REQUEST_MAX_QUERY_PARAMS]¶
- typedef struct mn_status mn_route_handler_t(
- struct mn_request const,
- struct mn_response *const
A type alias for a user-defined handler function.
-
struct mn_route¶
A route. These are pattern-matched against client requests. For more information, refer to Routing. The following is a typical example of how a router might be defined:
static struct mn_route route_root; static struct mn_route route_abc; static struct mn_route route_def; static struct mn_route route_root = { .method = MN_METHOD_GET, .pattern = mn_str_lit("/"), .handler = handle_root, .next = &route_abc, }; static struct mn_route route_abc = { .method = MN_METHOD_GET, .pattern = mn_str_lit("/abc"), .handler = handle_abc, .next = &route_def, }; static struct mn_route route_def = { .method = MN_METHOD_GET, .pattern = mn_str_lit("/def"), .handler = handle_def, };
-
mn_route_handler_t *handler¶
The user-defined handler function to be called on a successful match.
-
mn_route_handler_t *handler¶