Added support for https.
Updated to accept self-signed certs.