21 #include <curl/curl.h>
23 namespace kvikio::detail {
33 CURLU* _handle{
nullptr};
100 std::optional<std::string>
host;
107 std::optional<std::string>
port;
113 std::optional<std::string>
path;
162 std::optional<unsigned int> bitmask_url_flags = std::nullopt,
163 std::optional<unsigned int> bitmask_component_flags = std::nullopt);
178 std::optional<unsigned int> bitmask_component_flags = std::nullopt,
179 std::optional<CURLUcode> allowed_err_code = std::nullopt);
193 std::string
const& url,
195 std::optional<unsigned int> bitmask_url_flags = std::nullopt,
196 std::optional<unsigned int> bitmask_component_flags = std::nullopt,
197 std::optional<CURLUcode> allowed_err_code = std::nullopt);
RAII wrapper for libcurl's URL handle (CURLU)
~CurlUrlHandle() noexcept
Clean up the underlying URL handle.
CURLU * get() const
Get the underlying libcurl URL handle.
CurlUrlHandle()
Create a new libcurl URL handle.
URL parsing utility using libcurl's URL API.
static std::optional< std::string > extract_component(std::string const &url, CURLUPart part, std::optional< unsigned int > bitmask_url_flags=std::nullopt, std::optional< unsigned int > bitmask_component_flags=std::nullopt, std::optional< CURLUcode > allowed_err_code=std::nullopt)
Extract a specific component from a URL string.
static UrlComponents parse(std::string const &url, std::optional< unsigned int > bitmask_url_flags=std::nullopt, std::optional< unsigned int > bitmask_component_flags=std::nullopt)
Parses the given URL according to RFC 3986 plus and extracts its components.
static std::optional< std::string > extract_component(CurlUrlHandle const &handle, CURLUPart part, std::optional< unsigned int > bitmask_component_flags=std::nullopt, std::optional< CURLUcode > allowed_err_code=std::nullopt)
Extract a specific component from a CurlUrlHandle.
Container for parsed URL components.
std::optional< std::string > host
The hostname or IP address. May be empty for URLs without an authority component (e....
std::optional< std::string > path
The path component of the URL. Libcurl ensures that the path component is always present,...
std::optional< std::string > scheme
The URL scheme (e.g., "http", "https", "ftp"). May be empty for scheme-relative URLs or paths.
std::optional< std::string > query
The query string (without the leading "?"). Empty if no query parameters are present.
std::optional< std::string > port
The port number as a string. Will be empty if no explicit port is specified in the URL.
std::optional< std::string > fragment
The fragment identifier (without the leading "#"). Empty if no fragment is present.