diff options
| author | Xavier Del Campo Romero <xavi.dcr@tutanota.com> | 2023-04-23 05:09:53 +0200 |
|---|---|---|
| committer | Xavier Del Campo Romero <xavi.dcr@tutanota.com> | 2023-07-20 23:52:53 +0200 |
| commit | 82fffd1acebf688f1c082d7a597d68239e8a39cc (patch) | |
| tree | b09531247716ff151be7f3927958c39a19b18e8b /handler.c | |
| parent | 8e4026230611a7aac5f9e240007f5f5abc4841b5 (diff) | |
Support URL parameters
Now, http_payload includes a list of human-readable parameters that can
be read (but not modified) by users. Given the following example link:
/test?key1=value1&key2=value2
This will generate two parameters, with the following values:
{
.args =
{
[0] = {.key = "key1", .value = "value1"},
[1] = {.key = "key2", .value = "value2"}
},
.n_args = 2
}
As expected, if any URL parameters are given, struct http_payload member
"resource" is accordingly trimmed so as not to include any parameters.
Therefore, considering the example above:
{.args = {...}, .resource = "/test"}
Limitations:
- Since the definition of struct http_arg is both shared by http.h
(as a read-only pointer within struct http_payload) and http.c
(as a read/write pointer within struct ctx), its members (namely key
and value) must remain as read/write pointers, even if they must not
be modified by users of http.h.
Diffstat (limited to 'handler.c')
0 files changed, 0 insertions, 0 deletions
