Function
Coguri_guess_from_user_input
Declaration [src]
char*
cog_uri_guess_from_user_input (
const char* uri_like,
gboolean is_cli_arg,
GError** error
)
Description [src]
Tries to assemble a valid URI from input that resembles a URI.
First, if is_cli_arg
is set, the input string is converted to UTF-8.
Then, the following heuristics may applied:
- If the input is already a valid URI with a known scheme, return it as-is.
- If the input is a relative path, or resembles a local file path, try to
resolve it to a full path and return a
file://
URI. - If a URI does not have any path, set
/
as the path. - As a last resort, try to prepend the
http://
scheme.
The main use case for this function is turning some “simpler” version
of a URI, as typically entered by a user in a browser URL entry
(e.g. wpewebkit.org/release
) and turn it into an actual
URI (http://wpewebkit.org/release/
) which can be then passed to WebKit.WebView.load_uri.