Accept bracketed IPv6 and skip unparseable entries in `NO_PROXY`

Merged
KL
1mo ago
+13-0

A bracketed IPv6 entry in NO_PROXY (e.g. [::1]) made Client() raise InvalidURL at construction, and so did any other entry that can't be parsed (e.g. foo:bar).

  • Bracketed entries are already in URL host form, so [::1] and [::1]:8080 are used as-is. Bracketed entries with a prefix length (e.g. [::1]/128) are ignored, like curl, Go and urllib do.
  • Entries that still can't be parsed are ignored, like curl, Go and hyper do, instead of breaking client construction.

AI Disclaimer

This PR was developed with the assistance of either Claude or Codex. I've reviewed and verified the changes.