mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2025-12-25 06:23:53 +01:00
sys/net/sock_util: add sock_urlpath()
This commit is contained in:
parent
0e5900d597
commit
f6be7d6ffe
@ -102,6 +102,16 @@ static inline int sock_udp_ep_fmt(const sock_udp_ep_t *endpoint,
|
||||
*/
|
||||
int sock_urlsplit(const char *url, char *hostport, char *urlpath);
|
||||
|
||||
/**
|
||||
* @brief Returns a pointer to the path component in @p url
|
||||
*
|
||||
* @param[in] url URL to examine. Must not be NULL.
|
||||
*
|
||||
* @returns pointer to the start of the path component in @p url
|
||||
* @returns NULL if @p url is invalid
|
||||
*/
|
||||
const char *sock_urlpath(const char *url);
|
||||
|
||||
/**
|
||||
* @brief Convert string to common IP-based transport layer endpoint
|
||||
*
|
||||
|
||||
@ -149,6 +149,17 @@ int sock_urlsplit(const char *url, char *hostport, char *urlpath)
|
||||
return 0;
|
||||
}
|
||||
|
||||
const char *sock_urlpath(const char *url)
|
||||
{
|
||||
assert(url);
|
||||
char *hoststart = _find_hoststart(url);
|
||||
if (!hoststart) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return _find_pathstart(hoststart);
|
||||
}
|
||||
|
||||
int _parse_port(sock_udp_ep_t *ep_out, const char *portstart)
|
||||
{
|
||||
int port_len = strlen(portstart);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user