get_url_schema()
#
Extracts the schema (protocol) from a given URL and stores it in the provided buffer.
Prototype
int get_url_schema(
hgobj gobj,
const char *uri,
char *schema, size_t schema_size
);
Parameters
Key |
Type |
Description |
---|---|---|
|
|
A handle to the GObj instance, used for logging errors. |
|
|
The URL string from which the schema will be extracted. |
|
|
A buffer where the extracted schema will be stored. |
|
|
The size of the schema buffer to prevent overflow. |
Return Value
Returns 0 on success if the schema is extracted successfully, or -1 if no schema is found or an error occurs.
Notes
Uses http_parser_parse_url()
to parse the URL. If no schema is found, an error is logged using gobj_log_error()
.
Prototype
// Not applicable in JS
Prototype
# Not applicable in Python
Examples
// TODO C examples
// TODO JS examples
# TODO Python examples