URL represents an immutable Uniform Resource Locator.
A Uniform Resource Locator (URL), is used to uniquely identify a resource on the Internet. The URL is a compact text string with a restricted syntax that consists of four main components:
The protocol part is mandatory, the other components may or may not be present in an URL string. For instance the file protocol only use the path component while a http protocol may use all components.
The following URL components are automatically unescaped according to the escaping mechanism defined in RFC 2396; credentials, path and parameter values. If you use a password with non-URL safe characters, you must URL escape the value.
An IPv6 address can be used for host as defined in RFC2732 by enclosing the address in [brackets]. For instance, mysql://[2010:836B:4179::836B:4179]:3306/test
For more information about the URL syntax and specification, see, RFC2396 - Uniform Resource Identifiers (URI): Generic Syntax
Example:
URL_T url =
URL_new(
"postgresql://user:password@example.com:5432/database?use-ssl=true");
const char * URL_getPassword(T U)
Gets the password from the URL's authority part.
const char * URL_getUser(T U)
Gets the username from the URL's authority part.
T URL_new(const char *url)
Create a new URL object from the url parameter string.
const char * URL_getProtocol(T U)
Gets the protocol of the URL.
const char * URL_getParameter(T U, const char *name)
Returns the value of a URL parameter as a string, or NULL if the parameter does not exist.
int URL_getPort(T U)
Gets the port of the URL.
const char * URL_getHost(T U)
Gets the hostname of the URL.
const char * URL_getPath(T U)
Gets the path of the URL.
#define valueOr(expr, default_value)
Definition zdb.h:107
|
| T | URL_new (const char *url) |
| | Create a new URL object from the url parameter string.
|
| |
| T | URL_create (const char *url,...) |
| | Build a new URL object from the url parameter string.
|
| |
| void | URL_free (T *U) |
| | Destroy a URL object.
|
| |
|
| const char * | URL_getProtocol (T U) |
| | Gets the protocol of the URL.
|
| |
| const char * | URL_getUser (T U) |
| | Gets the username from the URL's authority part.
|
| |
| const char * | URL_getPassword (T U) |
| | Gets the password from the URL's authority part.
|
| |
| const char * | URL_getHost (T U) |
| | Gets the hostname of the URL.
|
| |
| int | URL_getPort (T U) |
| | Gets the port of the URL.
|
| |
| const char * | URL_getPath (T U) |
| | Gets the path of the URL.
|
| |
| const char * | URL_getQueryString (T U) |
| | Gets the query string of the URL.
|
| |
| const char ** | URL_getParameterNames (T U) |
| | Returns an array of string objects with the names of the parameters contained in this URL.
|
| |
| const char * | URL_getParameter (T U, const char *name) |
| | Returns the value of a URL parameter as a string, or NULL if the parameter does not exist.
|
| |
|
| const char * | URL_toString (T U) |
| | Returns a string representation of this URL object.
|
| |
|
| char * | URL_unescape (char *url) |
| | Unescape a URL string.
|
| |
| char * | URL_escape (const char *url) |
| | Escape a URL string.
|
| |