Function

GLibUripeek_scheme

since: 2.66

Declaration

const char*
g_uri_peek_scheme (
  const char* uri
)

Description

Gets the scheme portion of a URI string. RFC 3986 decodes the scheme as:

URI = scheme ":" hier-part [ "?" query ] [ "#" fragment ]

Common schemes include file, https, svn+ssh, etc.

Unlike g_uri_parse_scheme(), the returned scheme is normalized to all-lowercase and does not need to be freed.

Available since: 2.66

Parameters

uri

Type: const char*

A valid URI.

The data is owned by the caller of the function.
The value is a NUL terminated UTF-8 string.

Return value

Type: const char*

The ‘scheme’ component of the URI, or NULL on error. The returned string is normalized to all-lowercase, and interned via g_intern_string(), so it does not need to be freed.

The data is owned by the called function.
The return value can be NULL.
The value is a NUL terminated UTF-8 string.