mirror of
https://github.com/yhirose/cpp-httplib.git
synced 2026-08-12 05:11:24 +00:00
std::isalnum and std::isdigit consult the global C locale, so a byte like 0xC5 can classify as alphanumeric once an embedder calls setlocale() (observed on macOS). HTTP grammars are defined over ASCII, so raw bytes must be classified without regard to the locale. Add detail::is_ascii_digit/is_ascii_alpha/is_ascii_alnum and use them at every classification site: multipart boundary validation, token checks, URI encoding, range header parsing, is_numeric, is_hex, and IPv4 host detection. Also unify the hand-written digit range checks in from_chars, URL parsing, and parse_ipv4 onto the same helpers. With these in place nothing uses <cctype> anymore, so the include is dropped.