Use the port specified in the srv record when changing the fetch host
Update the copyright
Rename function to a more consistent name
Only allocate the needed memory
Always initialize finalweight to 0