feat(UrlUtils): Resolve more URL formats

Resolves more formats of URLs correctly: absolute, root-relative, relative, parent-relative, and URLs with query strings and fragments.
This commit is contained in:
Joel Goguen
2026-04-19 23:15:54 -04:00
parent cf32498fe5
commit c38013aac3
4 changed files with 460 additions and 15 deletions
+7
View File
@@ -18,6 +18,13 @@ std::string ensureProtocol(const std::string& url);
*/
std::string extractHost(const std::string& url);
/**
* Extract hostname only from a URL (e.g., "example.com" from
* "http://example.com:8080/path"). Returns an empty string if no hostname can
* be determined.
*/
std::string extractHostname(const std::string& url);
/**
* Build full URL from server URL and path.
* If path starts with /, it's an absolute path from the host root.