libfetch: merge TLS SNI support from NetBSD with some other random changes.

Close GH #41