Function

GLibUrisplit_network

since: 2.66

Declaration [src]

gboolean
g_uri_split_network (
  const gchar* uri_string,
  GUriFlags flags,
  gchar** scheme,
  gchar** host,
  gint* port,
  GError** error
)

Description [src]

Parses uri_string (which must be an absolute URI) according to flags, and returns the pieces relevant to connecting to a host. See the documentation for g_uri_split() for more details; this is mostly a wrapper around that function with simpler arguments. However, it will return an error if uri_string is a relative URI, or does not contain a hostname component.

Available since: 2.66

Parameters

uri_string

Type: const gchar*

A string containing an absolute URI.

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

Type: GUriFlags

Flags for parsing uri_string.

scheme

Type: gchar**

On return, contains the scheme (converted to lowercase), or NULL.

The argument will be set by the function.
The argument can be set to NULL by the function.
The argument can be NULL.
The caller of the function takes ownership of the returned data, and is responsible for freeing it.
The value is a NUL terminated UTF-8 string.
host

Type: gchar**

On return, contains the host, or NULL.

The argument will be set by the function.
The argument can be set to NULL by the function.
The argument can be NULL.
The caller of the function takes ownership of the returned data, and is responsible for freeing it.
The value is a NUL terminated UTF-8 string.
port

Type: gint*

On return, contains the port, or -1.

The argument will be set by the function.
The argument can be NULL.
error

Type: GError **

The return location for a recoverable error.

The argument can be NULL.
If the return location is not NULL, then you must initialize it to a NULL GError*.
The argument will be left initialized to NULL by the function if there are no errors.
In case of error, the argument will be set to a newly allocated GError; the caller will take ownership of the data, and be responsible for freeing it.

Return value

Type: gboolean

TRUE if uri_string parsed successfully, FALSE on error.