Refactor HTTP to handle CONNECT requests. Some code cleanup.