### Function

# GLib Uri join

since: 2.66

#### Declaration

    gchar*
    g_uri_join (
      GUriFlags flags,
      const gchar* scheme,
      const gchar* userinfo,
      const gchar* host,
      gint port,
      const gchar* path,
      const gchar* query,
      const gchar* fragment
    )

#### Description

Joins the given components together according to `flags` to create an absolute URI string. `path` may not be `NULL` (though it may be the empty string).

When `host` is present, `path` must either be empty or begin with a slash (`/`) character. When `host` is not present, `path` cannot begin with two slash characters (`//`). See RFC 3986, section 3.

See also g_uri_join_with_user(), which allows specifying the components of the ‘userinfo’ separately.

`G_URI_FLAGS_HAS_PASSWORD` and `G_URI_FLAGS_HAS_AUTH_PARAMS` are ignored if set in `flags`.

Available since: 2.66

#### Parameters

`flags`

  Type: `GUriFlags`

  Flags describing how to build the URI string.

`scheme`

  Type: `const gchar*`

  The URI scheme, or `NULL`.

  The argument can be `NULL`.
  The data is owned by the caller of the function.
  The value is a NUL terminated UTF-8 string.

`userinfo`

  Type: `const gchar*`

  The userinfo component, or `NULL`.

  The argument can be `NULL`.
  The data is owned by the caller of the function.
  The value is a NUL terminated UTF-8 string.

`host`

  Type: `const gchar*`

  The host component, or `NULL`.

  The argument can be `NULL`.
  The data is owned by the caller of the function.
  The value is a NUL terminated UTF-8 string.

`port`

  Type: `gint`

  The port, or `-1`.

`path`

  Type: `const gchar*`

  The path component.

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

`query`

  Type: `const gchar*`

  The query component, or `NULL`.

  The argument can be `NULL`.
  The data is owned by the caller of the function.
  The value is a NUL terminated UTF-8 string.

`fragment`

  Type: `const gchar*`

  The fragment, or `NULL`.

  The argument can be `NULL`.
  The data is owned by the caller of the function.
  The value is a NUL terminated UTF-8 string.

#### Return value

Type: `gchar*`

An absolute URI string.

The caller of the function takes ownership of the data, and is responsible for freeing it.
The value is a NUL terminated UTF-8 string.