Support SNI in the certificate checking

plugin was checking the first vhost rather than the correct vhost's ssl certificate validity.