title: Adding server certificate validation to httplib.HTTPSConnection
body: <p>I've found that <code>httplib.HTTPSConnection</code> doesn't perform an automatic server certificate check. As far as I've understood the problem, I need to add that functionality manually, e.g. by subclassing this class as described <a href="http://www.muchtooscrawled.com/2010/03/https-certificate-verification-in-python-with-urllib2/" rel="nofollow noreferrer">here</a>.</p>
  
  <p>As I'm using Python2.4.5 and an upgrade is not possible under the given circumstances, I cannot use the workaround given in this blog post, because the <code>ssl</code> module has not been introduced until Py2.6.</p>
  
  <p>I've been trying to avoid the usage of the <code>ssl</code> module by using <code>M2Crypto</code>. A promising approach for doing so is contained in <a href="http://www.heikkitoivonen.net/blog/2008/10/14/ssl-in-python-26/" rel="nofollow noreferrer">this blog post</a> (in the "Clients" section). But I haven't yet managed to override <code>httplib.HTTPSConnection.connect</code> appropriately by using that approach.</p>
  
  <p>Any ideas or hints?</p>