Fix for installation fails when behind a firewall

https://github.com/balderdashy/sails/issues/1085

Sorry it contains content from your master, but those changes seem to be benefical anyway ;)