### Function

# GLib Uri split_with_user

since: 2.66

#### Declaration

    gboolean
    g_uri_split_with_user (
      const gchar* uri_ref,
      GUriFlags flags,
      gchar** scheme,
      gchar** user,
      gchar** password,
      gchar** auth_params,
      gchar** host,
      gint* port,
      gchar** path,
      gchar** query,
      gchar** fragment,
      GError** error
    )

#### Description

Parses `uri_ref` (which can be an absolute or relative URI) according to `flags`, and returns the pieces. Any component that doesn’t appear in `uri_ref` will be returned as `NULL` (but note that all URIs always have a path component, though it may be the empty string).

See g_uri_split(), and the definition of `GUriFlags`, for more information on the effect of `flags`. Note that `password` will only be parsed out if `flags` contains `G_URI_FLAGS_HAS_PASSWORD`, and `auth_params` will only be parsed out if `flags` contains `G_URI_FLAGS_HAS_AUTH_PARAMS`.

Available since: 2.66

#### Parameters

`uri_ref`

  Type: `const gchar*`

  A string containing a relative or 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_ref`.

`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.

`user`

  Type: `gchar**`

  On return, contains the user, 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.

`password`

  Type: `gchar**`

  On return, contains the password, 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.

`auth_params`

  Type: `gchar**`

  On return, contains the auth_params, 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`.

`path`

  Type: `gchar**`

  On return, contains the path.

  The argument will be set 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.

`query`

  Type: `gchar**`

  On return, contains the query, 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.

`fragment`

  Type: `gchar**`

  On return, contains the fragment, 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.

`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_ref` parsed successfully, `FALSE` on error.