support https

I wasn't sure about the coding style I should follow, let me know if there's anything I can change.