Support old versions of curl and better hostname support

@francoisl @tonyzakula 

Whattdya think?