More robust protocol detection for http 1.1, better compatibility with older clients, manual TLS settings checks
Fix memory leak on upgrade