fix thread safety issue with fetching host:port string.

We cannot use a static in the function since multiple threads could
race for that allocation. Therefore, we store that value in the
host_port structure. Additionally, fix a potential overflow from
parsing host:port strings.

This includes a test to verify the new field is set correctly.