hackney
hackney copied to clipboard
remove sort of dns responses
This PR stops sorting the resolver’s address list in hackney_happy:getbyname/2 by replacing lists:usort(AddrList) with AddrList. The current sorting removes duplicates and reorders IPs, which unintentionally breaks DNS randomness and can cause uneven connection distribution.
Rationale DNS randomness is a common, simple load-spreading mechanism. Reordering results undermines it. Duplicate handling is typically the resolver’s responsibility. If duplicates occur, they are rare and harmless; removing them here is not worth the cost of losing order.