2.4 URI¶
-
struct SerdURI¶
A parsed URI.
This struct directly refers to chunks in other strings, it does not own any memory itself. Thus, URIs can be parsed and/or resolved against a base URI in-place without allocating memory.
-
uint8_t *serd_file_uri_parse(const uint8_t *uri, uint8_t **hostname)¶
Get the unescaped path and hostname from a file URI.
The returned path and
*hostname
must be freed withserd_free()
.- Parameters:
uri – A file URI.
hostname – If non-NULL, set to the hostname, if present.
- Returns:
The path component of the URI.
-
bool serd_uri_string_has_scheme(const uint8_t *utf8)¶
Return true iff
utf8
starts with a valid URI scheme.
-
SerdStatus serd_uri_parse(const uint8_t *utf8, SerdURI *out)¶
Parse
utf8
, writing result toout
-
void serd_uri_resolve(const SerdURI *r, const SerdURI *base, SerdURI *t)¶
Set target
t
to referencer
resolved againstbase
.See also: RFC3986 5.2.2
-
size_t serd_uri_serialise(const SerdURI *uri, SerdSink sink, void *stream)¶
Serialise
uri
with a series of calls tosink
-
size_t serd_uri_serialise_relative(const SerdURI *uri, const SerdURI *base, const SerdURI *root, SerdSink sink, void *stream)¶
Serialise
uri
relative tobase
with a series of calls tosink
The
uri
is written as a relative URI iff if it a child ofbase
androot
. The optionalroot
parameter must be a prefix ofbase
and can be used keep up-references (“../”) within a certain namespace.