Verify hostname according to rfc2818

Without this check HTTPS connection is vulnerable to MITM attack when the attacker would return a valid certificate but from wrong host.
Can you please not add a space between the ampersand (&) and the variable? Please keep the code consistent in style.