E2kUri

## E2kUri E2kUri — URI utility routines |

## Synopsis

                        E2kUri;
    E2kUri *            e2k_uri_new                         (const gchar *uri_string);
    void                e2k_uri_free                        (E2kUri *uri);

    const gchar *       e2k_uri_get_param                   (E2kUri *uri,
                                                             const gchar *name);

    void                e2k_uri_decode                      (gchar *part);
    gchar *             e2k_uri_encode                      (const gchar *in,
                                                             gboolean wss_encode,
                                                             const gchar *extra_enc_chars);
    void                e2k_uri_append_encoded              (GString *str,
                                                             const gchar *in,
                                                             gboolean wss_encode,
                                                             const gchar *extra_enc_chars);

    const gchar *       e2k_uri_path                        (const gchar *uri_string);
    gchar *             e2k_uri_concat                      (const gchar *uri_prefix,
                                                             const gchar *tail);
    const gchar *       e2k_uri_relative                    (const gchar *uri_prefix,
                                                             const gchar *uri);

## Description

## Details

### E2kUri

    typedef struct {
    	gchar  *protocol;
    	gchar  *user;
    	gchar  *domain;
    	gchar  *authmech;
    	gchar  *passwd;
    	gchar  *host;
    	gint    port;
    	gchar  *path;
    	GData *params;
    	gchar  *query;
    	gchar  *fragment;
    } E2kUri;

### e2k_uri_new ()

    E2kUri *            e2k_uri_new                         (const gchar *uri_string);

Parses `uri_string`.

`uri_string` : | the URI
Returns : | a parsed `E2kUri`

### e2k_uri_free ()

    void                e2k_uri_free                        (E2kUri *uri);

Frees `uri`

`uri` : | an `E2kUri`

### e2k_uri_get_param ()

    const gchar *       e2k_uri_get_param                   (E2kUri *uri,
                                                             const gchar *name);

Fetches a parameter from `uri`

`uri` : | an `E2kUri`
`name` : | name of the parameter
Returns : | the value of `name`, or `NULL` if it is not set

### e2k_uri_decode ()

    void                e2k_uri_decode                      (gchar *part);

Undoes URI-escaping in `part` in-place.

`part` : | a piece of a URI

### e2k_uri_encode ()

    gchar *             e2k_uri_encode                      (const gchar *in,
                                                             gboolean wss_encode,
                                                             const gchar *extra_enc_chars);

Encodes URI-unsafe characters as in `e2k_uri_append_encoded()`

`in` : | data to encode
`wss_encode` : | whether or not to use the special Web Storage System encoding rules
`extra_enc_chars` : | additional characters beyond the normal URI-reserved characters to encode when appending to `str`
Returns : | the encoded string

### e2k_uri_append_encoded ()

    void                e2k_uri_append_encoded              (GString *str,
                                                             const gchar *in,
                                                             gboolean wss_encode,
                                                             const gchar *extra_enc_chars);

Appends `in` to `str`, encoding URI-unsafe characters as needed (optionally including some Exchange-specific encodings).

When appending a path, you must append each segment separately; `e2k_uri_append_encoded()` will encode any "/"s passed in.

`str` : | a `GString` containing part of a URI
`in` : | data to append to `str`
`wss_encode` : | whether or not to use the special Web Storage System encoding rules
`extra_enc_chars` : | additional characters beyond the normal URI-reserved characters to encode when appending to `str`

### e2k_uri_path ()

    const gchar *       e2k_uri_path                        (const gchar *uri_string);

Returns the path component of `uri_string`, including the initial "/". (The return value is actually a pointer into the passed-in string, meaning this will only really work if the URI has no query/fragment/etc.)

`uri_string` : | a well-formed absolute URI
Returns : | the path component of `uri_string`.

### e2k_uri_concat ()

    gchar *             e2k_uri_concat                      (const gchar *uri_prefix,
                                                             const gchar *tail);

Constructs a new URI consisting of the concatenation of `uri_prefix` and `tail`. If `uri_prefix` does not end with a "/", one will be inserted between `uri_prefix` and `tail`.

`uri_prefix` : | an absolute URI
`tail` : | a relative path
Returns : | the new URI

### e2k_uri_relative ()

    const gchar *       e2k_uri_relative                    (const gchar *uri_prefix,
                                                             const gchar *uri);

Returns a URI describing `uri`'s relation to `uri_prefix`; either a relative URI consisting of the subpath of `uri` underneath `uri_prefix`, or all of `uri` if it is not a sub-uri of `uri_prefix`.

`uri_prefix` : | an absolute URI
`uri` : | another URI, presumably a child of `uri_prefix`
Returns : | the relative URI