URL utilities: GOffice Reference Manual

## URL utilities URL utilities |

## Functions

gboolean | go_url_check_extension ()
gchar * | go_url_encode ()
char * | go_url_make_relative ()
char * | go_url_resolve_relative ()
char * | go_url_simplify ()

## Description

## Functions

### go_url_check_extension ()

    gboolean
    go_url_check_extension (gchar const *uri,
                            gchar const *std_ext,
                            gchar **new_uri);

Modifies given `uri` by adding the extension `std_ext` if needed. If no `std_ext` is given or `uri` already has some extension, it just copies `uri` .

Value in new_uri: newly allocated string which you should free after use, containing (optionally) modified uri.

#### Parameters

uri | Uri |
std_ext | Standard extension for the content type |
new_uri | New uri. | [out][optional][nullable]

#### Returns

`FALSE` if the uri has an extension not matching `std_ext`

### go_url_encode ()

    gchar *
    go_url_encode (gchar const *uri,
                   int type);

url-encode a string according to RFC 2368.

#### Parameters

uri | The uri part to be encoded |
type | 0: mailto, 1: file or http |

#### Returns

encoded string.

[transfer full]

### go_url_make_relative ()

    char *
    go_url_make_relative (const char *uri,
                          const char *ref_uri);

Creates a relative URI from `uri` relative to `ref_uri` .

#### Parameters

uri | a URI |
ref_uri | reference URI |

#### Returns

the relative URI, or `NULL` if they are on different hosts or use different protocols.

[transfer full][nullable]

### go_url_resolve_relative ()

    char *
    go_url_resolve_relative (const char *ref_uri,
                             const char *rel_uri);

Resolves a relative URI against a reference URI. This is more or less the same as gnome_vfs_uri_make_full_from_relative.

#### Parameters

ref_uri | reference URI |
rel_uri | relative URI |

#### Returns

the resolved URI.

[transfer full]

### go_url_simplify ()

    char *
    go_url_simplify (const char *uri);

Simplifies a URI.

#### Parameters

uri | a URI |

#### Returns

the simplified URI.

[transfer full]