HTTPS + better library support

Sorry for the pull request notification mess. I didn't realize future commits would pop up as part of the pull request.

Anyway, this allows downloads over SSL. I also fixed a minor problem with a library function.