URL manipulation tools.
More...
◆ gf_url_is_local()
Bool gf_url_is_local |
( |
const char * |
url | ) |
|
Tests whether a URL describes a local file or not
- Parameters
-
- Returns
- 1 if the URL describes a local file, 0 otherwise
◆ gf_url_get_absolute_path()
char* gf_url_get_absolute_path |
( |
const char * |
pathName, |
|
|
const char * |
parentPath |
|
) |
| |
Gets the absolute file path from a relative path and its parent absolute one. This can only be used with file paths.
- Parameters
-
pathName | the relative path name of a file |
parentPath | the absolute parent path name |
- Returns
- absolute path name of the file, or NULL if bad paths are provided.
- Note
- the returned string must be freed by user
◆ gf_url_concatenate()
char* gf_url_concatenate |
( |
const char * |
parentName, |
|
|
const char * |
pathName |
|
) |
| |
Concatenates a relative URL with its parent URL
- Parameters
-
parentName | URL of the parent service |
pathName | URL of the service |
- Returns
- absolute path name of the service, or NULL if bad paths are provided or if the service path is already an absolute one.
- Note
- the returned string must be freed by user
◆ gf_url_concatenate_parent()
char* gf_url_concatenate_parent |
( |
const char * |
parentName, |
|
|
const char * |
pathName |
|
) |
| |
Same as gf_url_concatenate but if both paths are relative, resolved url is relative to parent path.
- Parameters
-
parentName | URL of the parent service |
pathName | URL of the service |
- Returns
- absolute path name of the service, or NULL if bad paths are provided or if the service path is already an absolute one.
- Note
- the returned string must be freed by user
◆ gf_url_percent_encode()
char* gf_url_percent_encode |
( |
const char * |
path | ) |
|
Encodes URL by replacing special characters with their % encodings.
- Parameters
-
- Returns
- encoded path name , or NULL if bad paths are provided.
- Note
- the returned string must be freed by user
◆ gf_url_percent_decode()
char* gf_url_percent_decode |
( |
const char * |
path | ) |
|
Decodes URL by % encodings with the special characters they correspond to
- Parameters
-
path | encoded URL of the service |
- Returns
- decoded path name , or NULL if error
- Note
- the returned string must be freed by user
◆ gf_url_to_fs_path()
void gf_url_to_fs_path |
( |
char * |
url | ) |
|
Converts a local URL to a file system value. Removes all white spaces and similar
- Parameters
-
◆ gf_url_is_relative()
Bool gf_url_is_relative |
( |
const char * |
url | ) |
|
Checks if given URL is absolute or relative
- Parameters
-
- Returns
- GF_TRUE if URL is relative
◆ gf_url_colon_suffix()
char* gf_url_colon_suffix |
( |
const char * |
URL, |
|
|
char |
assign_sep |
|
) |
| |
Returns a pointer to the first colon at the end of a filename or URL, if any.
If assign_sep is specified, for example '=', the function will make sure that the colon is after the file extension if found and that '=' is not present between colon and file ext. This is used to parse 'a:b.mp4:c' (expected result ':c...' and not ':b...') vs 'a:b=c.mp4' ' (expected result ':b')
- Parameters
-
URL | path or URL to inspect |
assign_sep | value of assignment operand character. If 0, only checks for colon, otherwise chec that no assign sep or colon is present before file extension, if present |
- Returns
- position of first colon, or NULL
◆ gf_url_get_resource_name()
const char* gf_url_get_resource_name |
( |
const char * |
url | ) |
|
Extracts the resource name from the URL
- Parameters
-
- Returns
- resource name.
◆ gf_url_get_path()
const char* gf_url_get_path |
( |
const char * |
url | ) |
|
Gets the resource path and name from the URL, stripping scheme, server ID, port...
- Parameters
-
- Returns
- the extracted path, or the original path if no scheme indication, or NULL of no path