Made http/https check more DRY using a regex.