strip trailing dot from FQDN hostnames for TLS SNI

MB
6d ago
+189-14

A request to an FQDN with a trailing dot, such as https://myhost.internal./, is valid DNS. But the dot was passed through to TLS SNI and certificate verification, which fail with CERTIFICATE_VERIFY_FAILED: Host name mismatch because certificates never carry the dot. The raw Origin.host bytes are kept as-is, so connection pooling and equality are unchanged; only the hostname handed to the network layer is normalized.

Fixes encode/httpcore#1063. Follows the approach of encode/httpcore#1068 (naarob, also the author of the httpcorexyz commit this is ported from). Alternatives were proposed in encode/httpcore#1067, encode/httpcore#1074 and encode/httpcore#1086.

Note: this change was prepared with AI assistance (Claude Code).