riot_sys

Function sock_urlsplit

Source
pub unsafe extern "C" fn sock_urlsplit(
    url: *const c_char,
    hostport: *mut c_char,
    urlpath: *mut c_char,
) -> c_int
Expand description

@brief Split url to host:port and url path

Will split e.g., “https://host.name:1234/url/path” into “host.name:1234” and “/url/path”.

@note Caller has to make sure hostport and urlpath can hold the results! Make sure to provide space for @ref CONFIG_SOCK_HOSTPORT_MAXLEN respectively @ref CONFIG_SOCK_URLPATH_MAXLEN bytes, if pointers are not NULL. Scheme part of the URL is limited to @ref CONFIG_SOCK_SCHEME_MAXLEN length.

@pre url != NULL

@param[in] url URL to split. Must not be NULL. @param[out] hostport where to write host:port. Can be NULL. @param[out] urlpath where to write url path. Can be NULL.

@returns 0 on success @returns <0 otherwise