35 while (*str !=
'\0') {
36 if ((*str >=
'0' && *str <=
'9') || *str ==
'.')
45 const char *chr = strchr(query,
'=');
54 chr = strchr(query,
'&');
59 chr = strchr(query,
'=');
77 if (str != NULL && str[0] !=
'\0') {
79 pch = strchr(str,
':');
80 if (pch != NULL && pch[1] ==
'/' && pch[2] ==
'/') {
86 pch = strchr(str,
'@');
88 pch = strchr(str,
':');
92 pch = strchr(str,
'@');
105 pch = strchr(str,
']');
111 pch = strchr(str,
'/');
127 const char *pch_slash;
128 pch = strchr(str,
':');
129 pch_slash = strchr(str,
'/');
130 if (pch != NULL && ((pch_slash == NULL) || (pch < pch_slash))) {
133 pch = strchr(str,
'/');
144 pch = strchr(str,
'/');
156 if (str[0] !=
'\0') {
157 pch = strchr(str,
'?');
161 pch = strchr(str,
'#');
175 pch = strchr(str,
'#');
209 if (url->
query != NULL) {
210 for (uint32_t i = 0; i < url->
query_num; ++i) {
void * c_calloc(size_t nmemb, size_t size)
static void parse_query(c_url_field_t *url, const char *query)
void c_url_free(c_url_field_t *url)
Generic wrappers to platform-dependent functions.
#define INIT_C_LOGGER(fname, mname)
Utilities to parse a standard URL.
#define c_use_decl_annotations
c_url_field_t * c_url_parse(const char *str)
char * c_strndup(const char *str, size_t size)
Wrapper to strndup(str, size), with check for NULL arguments. To be freed with c_free().
void * c_realloc(void *ptr, size_t size)
char * c_strdup(const char *str)
Wrapper to strdup(str), with check for NULL arguments. To be freed with c_free(). ...
static bool host_is_ipv4(const char *str)
struct c_url_field_t::@0 * query