/
singlwolf
/
Radiola-2S3
Обзор
Документация
Войти
/
singlwolf
/
Radiola-2S3
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
lib/url_parser/include/url_parser.h
58 строк
1 KB
SinglWolf
Public access
27 мар 2026, 07:00
27 мар 2026, 07:00
642fcfc
Код
Авторство
О чём код?
/* * url_parser.h * * Updated to support file extensions and nested redirect URLs. */ #ifndef _URL_PARSER_H_ #define _URL_PARSER_H_ #include <stdint.h> typedef struct { /* The host portion of the |uri|, NULL-terminated */ char *host; /* The schema portion of the |uri|, NULL-terminated */ char *scheme; /* The port portion of the |uri|, or the schema's default port */ uint16_t port; /* The authority portion of the |uri|, NULL-terminated (host:port) */ char *authority; /* The path portion of the |uri|, including query, NULL-terminated */ char *path; /* The file extension found in the path (e.g., "m3u", "mp3"), NULL if not found */ char *extension; /* The nested URL found within parameters (redirect target), NULL if not found */ char *redirect_url; } url_t; /** * @brief Parses a URI string into a url_t structure. * * Automatically detects ports, extracts file extensions, and searches * for nested HTTP(S) links in the query parameters. * * @param uri The source string to parse. * @return Pointer to url_t or NULL on failure. */ url_t *url_parse(const char *uri); /** * @brief Safely frees all memory associated with the url_t structure. * * @param url Pointer to the structure to free. */ void url_free(url_t *url); #endif /* _URL_PARSER_H_ */