Merge pull request #1006 from duggan/patch-1

HTTPS detection fix