Support https

I merged my other "add missing error_message" branch into this one, so the change is in both pull requests. Sorry about that.