Added HTTPS protocol support

Hi! I needed HTTPS protocol support, so I forked your code and changed it a bit. Fell free to re-use it :)