fix when $_SERVER['HTTPS'] is "ON"

when $_SERVER['HTTPS'] is "ON" it doesn't work well
Merge pull request #1800 from ginus/patch-1

fix when $_SERVER['HTTPS'] is "ON"
Fixed code style and comparison