#pragma once #include #include #include #include namespace Void::Net { /// Parsed components of a URL. `target` is the request-target /// (path + "?" + query) ready for an HTTP request line; `port` is filled /// with the scheme default (80/443) when absent. struct Url { std::string scheme; std::string host; std::string port; std::string path; ///< encoded path (defaults to "/") std::string query; ///< encoded query (no leading '?') std::string target; ///< path + ("?" + query) bool is_tls = false; ///< scheme is https/wss /// Parse `url` (RFC 3986) into components. Returns nullopt on a /// malformed URL. Backed by Boost.URL. [[nodiscard]] static std::optional parse(std::string_view url); }; } // namespace Void::Net