Refactor HTTPS request detection to own class for reuse.