guri: Document and check restrictions on path prefixes
RFC 3986, section 3 says:
The scheme and path components are required, though the path may be empty (no characters). When authority is present, the path must either be empty or begin with a slash ("/") character. When authority is not present, the path cannot begin with two slash characters ("//"). These restrictions result in five different ABNF rules for a path (Section 3.3), only one of which will match any given URI reference.
(See https://tools.ietf.org/html/rfc3986#section-3.)
Given that those conditions are almost always going to be true, and that
typically the number and form of arguments passed to g_uri_join() will
be known at compile time, it would be unnecessarily awkward to add a
GError
argument to g_uri_join() to detect these situations.
Instead, add precondition checks and document the restrictions. Developers are responsible for ensuring their paths are in the right format themselves.
Signed-off-by: Philip Withnall withnall@endlessm.com