Bug 5520: ERR_INVALID_URL for CONNECT host with leading digit (#2283)
Squid 7.2 commit
b8337359 added validation of host names
following RFC 1035 requirements. But those requirements were
outdated by RFC 1123:
One aspect of host name syntax is hereby changed: the
restriction on the first character is relaxed to allow either a
letter or a digit. Host software MUST support this more liberal
syntax.
The commit treated CONNECT host names that start with a decimal digit
as invalid IPv4 addresses and rejected the corresponding requests,
resulting in HTTP 404 errors. Undo that change.
We have considered preserving code that detects valid IPv4 addresses (as
opposed to treating all non-IPv6 input as an "IPv4 address or reg-name"
without disambiguating the two cases) because its pieces may be reused,
but that essentially unused code has non-trivial performance penalty and
final code may look quite different after we complete our "non-CONNECT
uri-host parsing code" migration TODO. Polished source code comments
aside, this change reverts 2025 commit
b8337359 and restores 2023
AnyP::Uri::parseHost() implementation (commit
963ff143).