z\Vc@sdZddlZddlTddlZddlZddlZdejfdYZdefdYZ ddZ dS( s M2Crypto enhancement to Python's urllib2 for handling 'https' url's. Code from urllib2 is Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007 Python Software Foundation; All Rights Reserved Summary of changes: - Use an HTTPSProxyConnection if the request is going through a proxy. - Add the SSL context to the https connection when performing https_open. - Add the M2Crypto HTTPSHandler when building a default opener. iN(t*t_closing_fileobjectcBs eZdZdZdZRS(ssocket._fileobject that propagates self.close() to the socket. Python 2.5 provides this as socket._fileobject(sock, close=True). cCstjj||dS(N(tsockett _fileobjectt__init__(tselftsock((s8/usr/lib64/python2.7/site-packages/M2Crypto/m2urllib2.pyRscCs'|j}tjj||jdS(N(t_sockRRtclose(RR((s8/usr/lib64/python2.7/site-packages/M2Crypto/m2urllib2.pyRs (t__name__t __module__t__doc__RR(((s8/usr/lib64/python2.7/site-packages/M2Crypto/m2urllib2.pyRs t HTTPSHandlercBs&eZddZdZejZRS(cCsVtj||dk rCt|tjs7t|||_ntj|_dS(N(tAbstractHTTPHandlerRtNonet isinstancetSSLtContexttAssertionErrortctx(Rt ssl_context((s8/usr/lib64/python2.7/site-packages/M2Crypto/m2urllib2.pyR%s    c Cs|j}|s!tdn|j}tj|d}||kr}tj|d}tjd|d|j}n'|j}tj d|d|j}|j |j t |j }|j|jd|d s     N