added HTTPS support / protocol detection to IP API call