A minimal, non-destructive parser for URI references.
More...
A minimal, non-destructive parser for URI references.
This module acts on URI references, and thus process both relative references and URIs.
Note that fragment identifiers are not handled by the implementation.
- See also
- https://tools.ietf.org/html/rfc3986
Handler functions for uri_parser
- Author
- Cenk Gündoğan cenk..nosp@m.guen.nosp@m.dogan.nosp@m.@haw.nosp@m.-hamb.nosp@m.urg..nosp@m.de
◆ uri_parser_is_absolute()
bool uri_parser_is_absolute |
( |
const char * |
uri, |
|
|
size_t |
uri_len |
|
) |
| |
Checks whether uri
is in absolute form.
- Parameters
-
[in] | uri | URI reference to check. Must not be NULL |
[in] | uri_len | Length of uri |
- Precondition
uri != NULL
- Returns
- true if
uri
is a URI
-
false if
uri
is a relative reference
◆ uri_parser_is_absolute_string()
bool uri_parser_is_absolute_string |
( |
const char * |
uri | ) |
|
Checks whether uri
is in absolute form.
- Parameters
-
[in] | uri | Zero-terminated URI reference to check. Must not be Null |
- Precondition
uri != NULL
- Returns
- true if
uri
is a URI
-
false if
uri
is a relative reference
◆ uri_parser_process()
Parse a URI reference.
- Parameters
-
[out] | result | pointer to a container that will hold the result |
[in] | uri | URI to parse. Must not be NULL |
[in] | uri_len | Length of uri |
- Precondition
uri != NULL
- Returns
- 0 on success
-
-1 on parsing error
◆ uri_parser_process_string()
Parse a URI reference.
- Parameters
-
[out] | result | pointer to a container that will hold the result |
[in] | uri | Zero-terminated URI to parse. Must not be NULL |
- Precondition
uri != NULL
- Returns
- 0 on success
-
-1 on parsing error
◆ uri_parser_split_query()
Provides a list of URI query parameters from a given URI parser result.
- Note
- The function DOES NOT check for duplicate query parameters.
- Precondition
uri_parsed != NULL
-
params != NULL
and all its elements are set to zero.
- Parameters
-
[in] | uri_parsed | A parsed URI result. Must not be NULL. |
[out] | params | An array of uri_parser_query_param_t. Must not be NULL and all zero-valued on call. Will be filled with the name-value-pairs in uri_parser_result_t::query of uri_parsed . If the number of query parameters in uri_parsed exceeds params_len , the list will be truncated and the function returns -2. |
[in] | params_len | The length of params |
- Returns
- number of filled entries in
params
on success. Might be 0 if uri_parser_result_t::query is NULL.
-
-1 on parsing error.
-
-2 when the number of query parameters exceeds
params_len
. In that case, the array is filled with the first params_len
name-value-pairs in uri_parser_result_t::query of uri_parsed
.