Correction to the http/https detection code. Previously it wasn't working consistently with https.