Accept an uppercase URL scheme

parse_url rejected any scheme containing an uppercase letter, so
Client("HTTPS://..."), WebSocketClient("WSS://...") and a redirect to
"Location: HTTPS://..." failed, although the scheme is case-insensitive
(RFC 3986 3.1). Lowercase the scheme in parse_url so that every caller
compares one canonical form and selects TLS for it.
This commit is contained in:
yhirose committed 2026-11-20 17:47:57 -05:00
1 parent a6ab971a3f
commit 726e4583ef
2 files changed
+59 -2

No files matched your search

+2 -1
View File
@@ -914,7 +914,8 @@ inline bool parse_url(const std::string &url, UrlComponents &uc) {
auto sep = url.find("://");
if (sep != std::string::npos) {
uc.scheme = url.substr(0, sep);
// Schemes are case-insensitive (RFC 3986 3.1)
uc.scheme = case_ignore::to_lower(url.substr(0, sep));
// Scheme must be [a-z]+ only
if (uc.scheme.empty()) { return false; }