You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Treat empty ports consistently in _uric_escape, as_iri and URI.pm bracket fix-up #211
The fix for empty ports in host() (s/:\d+$// → s/:\d*$// in URI::_server::host) left the old pattern in three other places that split a port off the authority:
lib/URI/_server.pm:17, in _uric_escape: $host =~ s/(:\d+)\z//
lib/URI/_server.pm:44, in as_iri: $host =~ s/(:\d+)\z//
lib/URI.pm:134, in the %5B/%5D fix-up: $host =~ s/(:\d+)$//
With an empty port (http://münchen.de:/), none of these matches, so the bare : stays attached to $host. It then goes into IDNA encode/decode or the bracket un-escaping with the colon on the end.
Nothing visibly breaks today.http://münchen.de:/ still becomes http://xn--mnchen-bma9c.de:/, as_iri round-trips it, and host returns xn--mnchen-bma9c.de. The IDNA code happens to tolerate the trailing colon, and the bracket fix-up only touches %5B/%5D.
Suggested change: switch these to :\d* so every place that splits off a port treats an empty port the same way as host(), _port and host_port. Add a test with an IDN host and an empty port (http://münchen.de:/) to cover _uric_escape and as_iri.
Low priority: this is about keeping the code consistent, not a bug anyone can hit.
Activity