Blame docs/reference/glib/html/glib-URI-Functions.html

Packit ae235b
Packit ae235b
<html>
Packit ae235b
<head>
Packit ae235b
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
Packit ae235b
<title>URI Functions: GLib Reference Manual</title>
Packit ae235b
<meta name="generator" content="DocBook XSL Stylesheets Vsnapshot">
Packit ae235b
<link rel="home" href="index.html" title="GLib Reference Manual">
Packit ae235b
<link rel="up" href="glib-utilities.html" title="GLib Utilities">
Packit ae235b
<link rel="prev" href="glib-File-Utilities.html" title="File Utilities">
Packit ae235b
<link rel="next" href="glib-Hostname-Utilities.html" title="Hostname Utilities">
Packit ae235b
<meta name="generator" content="GTK-Doc V1.27 (XML mode)">
Packit ae235b
<link rel="stylesheet" href="style.css" type="text/css">
Packit ae235b
</head>
Packit ae235b
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
Packit ae235b
Packit ae235b
Packit ae235b
Top  | 
Packit ae235b
                  Description
Packit ae235b
Packit ae235b
Home
Packit ae235b
Up
Packit ae235b
Prev
Packit ae235b
Next
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b

URI Functions

Packit ae235b

URI Functions — manipulating URIs

Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b

Functions

Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
char *
Packit ae235b
Packit ae235b
Packit ae235b
g_uri_parse_scheme ()
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
char *
Packit ae235b
Packit ae235b
Packit ae235b
g_uri_escape_string ()
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
char *
Packit ae235b
Packit ae235b
Packit ae235b
g_uri_unescape_string ()
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
char *
Packit ae235b
Packit ae235b
Packit ae235b
g_uri_unescape_segment ()
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
gchar **
Packit ae235b
Packit ae235b
Packit ae235b
g_uri_list_extract_uris ()
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
gchar *
Packit ae235b
Packit ae235b
Packit ae235b
g_filename_from_uri ()
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
gchar *
Packit ae235b
Packit ae235b
Packit ae235b
g_filename_to_uri ()
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b

Types and Values

Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
#define
Packit ae235b
G_URI_RESERVED_CHARS_ALLOWED_IN_PATH
Packit ae235b
Packit ae235b
Packit ae235b
#define
Packit ae235b
G_URI_RESERVED_CHARS_ALLOWED_IN_PATH_ELEMENT
Packit ae235b
Packit ae235b
Packit ae235b
#define
Packit ae235b
G_URI_RESERVED_CHARS_ALLOWED_IN_USERINFO
Packit ae235b
Packit ae235b
Packit ae235b
#define
Packit ae235b
G_URI_RESERVED_CHARS_GENERIC_DELIMITERS
Packit ae235b
Packit ae235b
Packit ae235b
#define
Packit ae235b
G_URI_RESERVED_CHARS_SUBCOMPONENT_DELIMITERS
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b

Includes

Packit ae235b
#include <glib.h>
Packit ae235b
#include <glib/gi18n.h>
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b

Description

Packit ae235b

Functions for manipulating Universal Resource Identifiers (URIs) as

Packit ae235b
defined by
Packit ae235b
RFC 3986.
Packit ae235b
It is highly recommended that you have read and
Packit ae235b
understand RFC 3986 for understanding this API.

Packit ae235b
Packit ae235b
Packit ae235b

Functions

Packit ae235b
Packit ae235b

g_uri_parse_scheme ()

Packit ae235b
char *
Packit ae235b
g_uri_parse_scheme (const char *uri);
Packit ae235b

Gets the scheme portion of a URI string. RFC 3986 decodes the scheme as:

Packit ae235b
Packit ae235b
  
Packit ae235b
    
Packit ae235b
      
Packit ae235b
        
1
Packit ae235b
        
URI = scheme ":" hier-part [ "?" query ] [ "#" fragment ]
Packit ae235b
      
Packit ae235b
    
Packit ae235b
  
Packit ae235b
Packit ae235b
Packit ae235b

Packit ae235b
Common schemes include "file", "http", "svn+ssh", etc.

Packit ae235b
Packit ae235b

Parameters

Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b

uri

Packit ae235b

a valid URI.

Packit ae235b
 
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b

Returns

Packit ae235b

The "Scheme" component of the URI, or NULL on error.

Packit ae235b
The returned string should be freed when no longer needed.

Packit ae235b
Packit ae235b

Since: 2.16

Packit ae235b
Packit ae235b

Packit ae235b
Packit ae235b

g_uri_escape_string ()

Packit ae235b
char *
Packit ae235b
g_uri_escape_string (const char *unescaped,
Packit ae235b
                     const char *reserved_chars_allowed,
Packit ae235b
                     gboolean allow_utf8);
Packit ae235b

Escapes a string for use in a URI.

Packit ae235b

Normally all characters that are not "unreserved" (i.e. ASCII alphanumerical

Packit ae235b
characters plus dash, dot, underscore and tilde) are escaped.
Packit ae235b
But if you specify characters in reserved_chars_allowed
Packit ae235b
 they are not
Packit ae235b
escaped. This is useful for the "reserved" characters in the URI
Packit ae235b
specification, since those are allowed unescaped in some portions of
Packit ae235b
a URI.

Packit ae235b
Packit ae235b

Parameters

Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b

unescaped

Packit ae235b

the unescaped input string.

Packit ae235b
 
Packit ae235b
Packit ae235b
Packit ae235b

reserved_chars_allowed

Packit ae235b

a string of reserved characters that

Packit ae235b
are allowed to be used, or NULL. 

Packit ae235b
[nullable]
Packit ae235b
Packit ae235b
Packit ae235b

allow_utf8

Packit ae235b

TRUE if the result can include UTF-8 characters.

Packit ae235b
 
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b

Returns

Packit ae235b

an escaped version of unescaped

Packit ae235b
. The returned string should be
Packit ae235b
freed when no longer needed.

Packit ae235b
Packit ae235b

Since: 2.16

Packit ae235b
Packit ae235b

Packit ae235b
Packit ae235b

g_uri_unescape_string ()

Packit ae235b
char *
Packit ae235b
g_uri_unescape_string (const char *escaped_string,
Packit ae235b
                       const char *illegal_characters);
Packit ae235b

Unescapes a whole escaped string.

Packit ae235b

If any of the characters in illegal_characters

Packit ae235b
 or the character zero appears
Packit ae235b
as an escaped character in escaped_string
Packit ae235b
 then that is an error and NULL
Packit ae235b
will be returned. This is useful it you want to avoid for instance having a
Packit ae235b
slash being expanded in an escaped path element, which might confuse pathname
Packit ae235b
handling.

Packit ae235b
Packit ae235b

Parameters

Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b

escaped_string

Packit ae235b

an escaped string to be unescaped.

Packit ae235b
 
Packit ae235b
Packit ae235b
Packit ae235b

illegal_characters

Packit ae235b

a string of illegal characters not to be

Packit ae235b
allowed, or NULL. 

Packit ae235b
[nullable]
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b

Returns

Packit ae235b

an unescaped version of escaped_string

Packit ae235b
. The returned string
Packit ae235b
should be freed when no longer needed.

Packit ae235b
Packit ae235b

Since: 2.16

Packit ae235b
Packit ae235b

Packit ae235b
Packit ae235b

g_uri_unescape_segment ()

Packit ae235b
char *
Packit ae235b
g_uri_unescape_segment (const char *escaped_string,
Packit ae235b
                        const char *escaped_string_end,
Packit ae235b
                        const char *illegal_characters);
Packit ae235b

Unescapes a segment of an escaped string.

Packit ae235b

If any of the characters in illegal_characters

Packit ae235b
 or the character zero appears
Packit ae235b
as an escaped character in escaped_string
Packit ae235b
 then that is an error and NULL
Packit ae235b
will be returned. This is useful it you want to avoid for instance having a
Packit ae235b
slash being expanded in an escaped path element, which might confuse pathname
Packit ae235b
handling.

Packit ae235b
Packit ae235b

Parameters

Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b

escaped_string

Packit ae235b

A string, may be NULL.

Packit ae235b
[nullable]
Packit ae235b
Packit ae235b
Packit ae235b

escaped_string_end

Packit ae235b

Pointer to end of escaped_string

Packit ae235b
, may be NULL. 

Packit ae235b
[nullable]
Packit ae235b
Packit ae235b
Packit ae235b

illegal_characters

Packit ae235b

An optional string of illegal characters not to be allowed, may be NULL.

Packit ae235b
[nullable]
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b

Returns

Packit ae235b

an unescaped version of escaped_string

Packit ae235b
or NULL on error.
Packit ae235b
The returned string should be freed when no longer needed.  As a
Packit ae235b
special case if NULL is given for escaped_string
Packit ae235b
, this function
Packit ae235b
will return NULL.

Packit ae235b
Packit ae235b

Since: 2.16

Packit ae235b
Packit ae235b

Packit ae235b
Packit ae235b

g_uri_list_extract_uris ()

Packit ae235b
gchar **
Packit ae235b
g_uri_list_extract_uris (const gchar *uri_list);
Packit ae235b

Splits an URI list conforming to the text/uri-list

Packit ae235b
mime type defined in RFC 2483 into individual URIs,
Packit ae235b
discarding any comments. The URIs are not validated.

Packit ae235b
Packit ae235b

Parameters

Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b

uri_list

Packit ae235b

an URI list

Packit ae235b
 
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b

Returns

Packit ae235b

a newly allocated NULL-terminated list

Packit ae235b
of strings holding the individual URIs. The array should be freed
Packit ae235b
with g_strfreev(). 

Packit ae235b

[transfer full]

Packit ae235b
Packit ae235b

Since: 2.6

Packit ae235b
Packit ae235b

Packit ae235b
Packit ae235b

g_filename_from_uri ()

Packit ae235b
gchar *
Packit ae235b
g_filename_from_uri (const gchar *uri,
Packit ae235b
                     gchar **hostname,
Packit ae235b
                     GError **error);
Packit ae235b

Converts an escaped ASCII-encoded URI to a local filename in the

Packit ae235b
encoding used for filenames.

Packit ae235b
Packit ae235b

Parameters

Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b

uri

Packit ae235b

a uri describing a filename (escaped, encoded in ASCII).

Packit ae235b
 
Packit ae235b
Packit ae235b
Packit ae235b

hostname

Packit ae235b

Location to store hostname for the URI.

Packit ae235b
If there is no hostname in the URI, NULL will be
Packit ae235b
stored in this location. 

Packit ae235b
[out][optional][nullable]
Packit ae235b
Packit ae235b
Packit ae235b

error

Packit ae235b

location to store the error occurring, or NULL to ignore

Packit ae235b
errors. Any of the errors in GConvertError may occur.

Packit ae235b
 
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b

Returns

Packit ae235b

a newly-allocated string holding

Packit ae235b
the resulting filename, or NULL on an error. 

Packit ae235b

[type filename]

Packit ae235b
Packit ae235b
Packit ae235b

Packit ae235b
Packit ae235b

g_filename_to_uri ()

Packit ae235b
gchar *
Packit ae235b
g_filename_to_uri (const gchar *filename,
Packit ae235b
                   const gchar *hostname,
Packit ae235b
                   GError **error);
Packit ae235b

Converts an absolute filename to an escaped ASCII-encoded URI, with the path

Packit ae235b
component following Section 3.3. of RFC 2396.

Packit ae235b
Packit ae235b

Parameters

Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b

filename

Packit ae235b

an absolute filename specified in the GLib file

Packit ae235b
name encoding, which is the on-disk file name bytes on Unix, and UTF-8
Packit ae235b
on Windows. 

Packit ae235b
[type filename]
Packit ae235b
Packit ae235b
Packit ae235b

hostname

Packit ae235b

A UTF-8 encoded hostname, or NULL for none.

Packit ae235b
[nullable]
Packit ae235b
Packit ae235b
Packit ae235b

error

Packit ae235b

location to store the error occurring, or NULL to ignore

Packit ae235b
errors. Any of the errors in GConvertError may occur.

Packit ae235b
 
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b

Returns

Packit ae235b

a newly-allocated string holding the resulting

Packit ae235b
URI, or NULL on an error.

Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b

Types and Values

Packit ae235b
Packit ae235b

G_URI_RESERVED_CHARS_ALLOWED_IN_PATH

Packit ae235b
#define G_URI_RESERVED_CHARS_ALLOWED_IN_PATH G_URI_RESERVED_CHARS_ALLOWED_IN_PATH_ELEMENT "/"
Packit ae235b
Packit ae235b

Allowed characters in a path. Includes "!$&'()*+,;=:@/".

Packit ae235b
Packit ae235b

Packit ae235b
Packit ae235b

G_URI_RESERVED_CHARS_ALLOWED_IN_PATH_ELEMENT

Packit ae235b
#define G_URI_RESERVED_CHARS_ALLOWED_IN_PATH_ELEMENT G_URI_RESERVED_CHARS_SUBCOMPONENT_DELIMITERS ":@"
Packit ae235b
Packit ae235b

Allowed characters in path elements. Includes "!$&'()*+,;=:@".

Packit ae235b
Packit ae235b

Packit ae235b
Packit ae235b

G_URI_RESERVED_CHARS_ALLOWED_IN_USERINFO

Packit ae235b
#define G_URI_RESERVED_CHARS_ALLOWED_IN_USERINFO G_URI_RESERVED_CHARS_SUBCOMPONENT_DELIMITERS ":"
Packit ae235b
Packit ae235b

Allowed characters in userinfo as defined in RFC 3986. Includes "!$&'()*+,;=:".

Packit ae235b
Packit ae235b

Packit ae235b
Packit ae235b

G_URI_RESERVED_CHARS_GENERIC_DELIMITERS

Packit ae235b
#define G_URI_RESERVED_CHARS_GENERIC_DELIMITERS ":/?#[]@"
Packit ae235b
Packit ae235b

Generic delimiters characters as defined in RFC 3986. Includes ":/?#[]@".

Packit ae235b
Packit ae235b

Packit ae235b
Packit ae235b

G_URI_RESERVED_CHARS_SUBCOMPONENT_DELIMITERS

Packit ae235b
#define G_URI_RESERVED_CHARS_SUBCOMPONENT_DELIMITERS "!$&'()*+,;="
Packit ae235b
Packit ae235b

Subcomponent delimiter characters as defined in RFC 3986. Includes "!$&'()*+,;=".

Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b

Generated by GTK-Doc V1.27
Packit ae235b
</body>
Packit ae235b
</html>