Should DNS cache include port?

net.c (wget_tcp_resolve)

if (tcp->caching) {
	if ((addrinfo = _wget_dns_cache_get(host, port)))
		return addrinfo;

It seems we store and access DNS cache based on host and port. This makes foo.com:443 to fire fresh DNS query even if foo.com:80 has been resolved before and is in the cache.

Should port be included in the DNS cache? What part does port play in DNS resolution? Does it matter? I went through man getaddrinfo but couldn't figure it out.

If port doesn't play a role in DNS resolution we should remove/avoid port from storing in DNS cache.

Edited by Avinash Sonawane