Skip to content

Rewrite port from host

Andrej Shadura requested to merge rewrite-port-from-host into master

The naïve implementation of get_port_by_host with a single split works for host names and IPv4 literal addresses, but doesn’t work with IPv6 literals. Instead of trying to work that around, it’s better to write a regex instead and add a doctest.

By the way, this function belongs in utils.py.

Edited by Andrej Shadura

Merge request reports