url

url — Manage URL parser work.

Synopsis

gboolean            uc_url_is_faked                     (UCLinkProperties *prop,
                                                         UCHTMLTag *tag);
gchar *             uc_url_extract_url_from_local_path  (const gchar *path);
void                uc_url_correction                   (UCLinkProperties *prop);
gchar *             uc_url_normalize                    (const gchar *current_host,
                                                         const gchar *current_path,
                                                         gchar *url);
gchar *             uc_url_get_hostname                 (const gchar *current_host,
                                                         const gchar *url);
gchar *             uc_url_get_port                     (const gchar *url);
gchar *             uc_url_add_protocol                 (const gchar *proto,
                                                         const gchar *host);
gchar *             uc_url_add_slash                    (const gchar *url);
gboolean            uc_url_is_valid                     (const gchar *url);
gchar *             uc_url_get_protocol                 (const gchar *url);
gboolean            uc_url_parse                        (const gchar *current_host,
                                                         const gchar *current_path,
                                                         gchar *rurl,
                                                         gchar **host,
                                                         gchar **port,
                                                         gchar **path,
                                                         gchar **args);
gchar *             uc_url_get_ip                       (gchar *host);

Description

Details

uc_url_is_faked ()

gboolean            uc_url_is_faked                     (UCLinkProperties *prop,
                                                         UCHTMLTag *tag);

Check if the link is in fact a redirection or if it has another location.

prop :

A UCLinkProperties object.

tag :

A UCHTMLTag.

Returns :

TRUE if URL has been modified. Tag struct is modified.

uc_url_extract_url_from_local_path ()

gchar *             uc_url_extract_url_from_local_path  (const gchar *path);

A little tricky: extract a URL from a path. The URL must be at the end of the given path.

path :

The path from which to extract URL.

Returns :

The URL in a newly allocated string or NULL.

uc_url_correction ()

void                uc_url_correction                   (UCLinkProperties *prop);

prop :


uc_url_normalize ()

gchar *             uc_url_normalize                    (const gchar *current_host,
                                                         const gchar *current_path,
                                                         gchar *url);

Build a full URI from the given parameters.

current_host :

The current host.

current_path :

The current path.

url :

The URI.

Returns :

A full and normalized URI. A new allocated string.

uc_url_get_hostname ()

gchar *             uc_url_get_hostname                 (const gchar *current_host,
                                                         const gchar *url);

Get the hostname of a given url. If the url doesn't have host name, then current_host is send.

current_host :

The current host.

url :

The URI.

Returns :

The hostname of a given URI. A new allocated string.

uc_url_get_port ()

gchar *             uc_url_get_port                     (const gchar *url);

Get the port of a given url.

url :

The URI.

Returns :

The port of the given URI. A new allocated string.

uc_url_add_protocol ()

gchar *             uc_url_add_protocol                 (const gchar *proto,
                                                         const gchar *host);

Add the given protocol to the given url.

proto :

The protocol to add.

host :

The host.

Returns :

The host plus the given protocole. A new allocated string.

uc_url_add_slash ()

gchar *             uc_url_add_slash                    (const gchar *url);

Check if the given url url end by a slash. if not, add it.

url :

a URL.

Returns :

a new allocated string ended by a slash.

uc_url_is_valid ()

gboolean            uc_url_is_valid                     (const gchar *url);

Quikly (loosly) check the validity of a given url.

url :

The URI.

Returns :

TRUE if the given URI is valid.

uc_url_get_protocol ()

gchar *             uc_url_get_protocol                 (const gchar *url);

Get the protocol of a given url.

url :

The URI.

Returns :

The protocole of the given URI. If not, a return a default protocol: UC_PROTOCOL_HTTP or UC_PROTOCOL_HTTPS. A new allocated string.

uc_url_parse ()

gboolean            uc_url_parse                        (const gchar *current_host,
                                                         const gchar *current_path,
                                                         gchar *rurl,
                                                         gchar **host,
                                                         gchar **port,
                                                         gchar **path,
                                                         gchar **args);

Parse a given url.

current_host :

The current host.

current_path :

The current_path.

rurl :

The URI to parse.

host :

String to put the host.

port :

String to put the port.

path :

String to put the path.

args :

String to put the arguments.

Returns :

TRUE if it is ok. parameters host, port, path and args are modified.

uc_url_get_ip ()

gchar *             uc_url_get_ip                       (gchar *host);

host :

Returns :