Your IP : 3.142.135.24


Current Path : /opt/alt/python33/lib/python3.3/site-packages/setuptools/__pycache__/
Upload File :
Current File : //opt/alt/python33/lib/python3.3/site-packages/setuptools/__pycache__/ssl_support.cpython-33.pyc

�
�Re�c@scddlZddlZddlZddlZddlZddlmZmZddlmZyddl	Z	Wne
k
r�dZ	YnXdddddgZd	j
�j�ZeZZxpd
ddgfd
ddgffD]J\ZZx;eD]3Zyedeef�Wq�e
k
r(Yq�Xq�Wq�We	dk	oLeeefkZyddl	mZmZWnWe
k
r�y$ddlmZddlmZWne
k
r�dZdZYnXYnXes�Gdd�de�Znesddd�Zdd�ZnGdd�de�ZGdd�de�Zddd�Zda dd �Z!d!d�Z"dS("iN(uResolutionErroruExtractionError(uurllib2uVerifyingHTTPSHandlerufind_ca_bundleuis_availableu
cert_pathsu
opener_foru�
/etc/pki/tls/certs/ca-bundle.crt
/etc/ssl/certs/ca-certificates.crt
/usr/share/ssl/certs/ca-bundle.crt
/usr/local/share/certs/ca-root.crt
/etc/ssl/cert.pem
/System/Library/OpenSSL/certs/cert.pem
uHTTPSHandleruurllib2uurllib.requestuHTTPSConnectionuhttplibuhttp.clientufrom %s import %s(uCertificateErrorumatch_hostname(uCertificateError(umatch_hostnamecBs|EeZdZdS(uCertificateErrorN(u__name__u
__module__u__qualname__(u
__locals__((u//tmp/pip-k8wh6o-build/setuptools/ssl_support.pyuCertificateError8suCertificateErroric
CsXg}|sdS|jd�}|d}|dd�}|jd�}||krmtdt|���n|s�|j�|j�kS|dkr�|jd�nY|jd�s�|jd�r�|jtj	|��n"|jtj	|�j
d	d
��x$|D]}|jtj	|��qWtjddj|�d
tj
�}	|	j|�S(upMatching according to RFC 6125, section 6.4.3

        http://tools.ietf.org/html/rfc6125#section-6.4.3
        u.iiNu*u,too many wildcards in certificate DNS name: u[^.]+uxn--u\*u[^.]*u\Au\.u\ZF(uFalseusplitucountuCertificateErrorurepruloweruappendu
startswithureuescapeureplaceucompileujoinu
IGNORECASEumatch(
udnuhostnameu
max_wildcardsupatsupartsuleftmostu	remainderu	wildcardsufragupat((u//tmp/pip-k8wh6o-build/setuptools/ssl_support.pyu_dnsname_match<s*
"
&u_dnsname_matchcCs[|std��ng}|jdf�}xC|D];\}}|dkr4t||�r_dS|j|�q4q4W|s�xc|jdf�D]L}xC|D];\}}|dkr�t||�r�dS|j|�q�q�Wq�Wnt|�dkrtd|d	jtt|��f��n;t|�dkrKtd
||df��ntd��dS(
u=Verify that *cert* (in decoded format as returned by
        SSLSocket.getpeercert()) matches the *hostname*.  RFC 2818 and RFC 6125
        rules are followed, but IP addresses are not accepted for *hostname*.

        CertificateError is raised on failure. On success, the function
        returns nothing.
        uempty or no certificateusubjectAltNameuDNSNusubjectu
commonNameiu&hostname %r doesn't match either of %su, uhostname %r doesn't match %riu=no appropriate commonName or subjectAltName fields were found(	u
ValueErrorugetu_dnsname_matchuappendulenuCertificateErrorujoinumapurepr(ucertuhostnameudnsnamesusanukeyuvalueusub((u//tmp/pip-k8wh6o-build/setuptools/ssl_support.pyumatch_hostnameps.%umatch_hostnamecBs2|EeZdZdZdd�Zdd�ZdS(uVerifyingHTTPSHandleru=Simple verifying handler: no auth, subclasses, timeouts, etc.cCs||_tj|�dS(N(u	ca_bundleuHTTPSHandleru__init__(uselfu	ca_bundle((u//tmp/pip-k8wh6o-build/setuptools/ssl_support.pyu__init__�s	uVerifyingHTTPSHandler.__init__cs�j�fdd�|�S(Ncst|�j|�S(N(uVerifyingHTTPSConnu	ca_bundle(uhostukw(uself(u//tmp/pip-k8wh6o-build/setuptools/ssl_support.pyu<lambda>�su2VerifyingHTTPSHandler.https_open.<locals>.<lambda>(udo_open(uselfureq((uselfu//tmp/pip-k8wh6o-build/setuptools/ssl_support.pyu
https_open�su VerifyingHTTPSHandler.https_openN(u__name__u
__module__u__qualname__u__doc__u__init__u
https_open(u
__locals__((u//tmp/pip-k8wh6o-build/setuptools/ssl_support.pyuVerifyingHTTPSHandler�scBs2|EeZdZdZdd�Zdd�ZdS(uVerifyingHTTPSConnu@Simple verifying connection: no auth, subclasses, timeouts, etc.cKs tj|||�||_dS(N(uHTTPSConnectionu__init__u	ca_bundle(uselfuhostu	ca_bundleukw((u//tmp/pip-k8wh6o-build/setuptools/ssl_support.pyu__init__�suVerifyingHTTPSConn.__init__cCs�tj|j|jft|dd��}t|d�rat|dd�ra||_|j�nt	j
|dt	jd|j�|_yt
|jj�|j�Wn5tk
r�|jjtj�|jj��YnXdS(Nusource_addressu_tunnelu_tunnel_hostu	cert_reqsuca_certs(usocketucreate_connectionuhostuportugetattruNoneuhasattrusocku_tunnelussluwrap_socketu
CERT_REQUIREDu	ca_bundleumatch_hostnameugetpeercertuCertificateErrorushutdownu	SHUT_RDWRuclose(uselfusock((u//tmp/pip-k8wh6o-build/setuptools/ssl_support.pyuconnect�s$!	


uVerifyingHTTPSConn.connectN(u__name__u
__module__u__qualname__u__doc__u__init__uconnect(u
__locals__((u//tmp/pip-k8wh6o-build/setuptools/ssl_support.pyuVerifyingHTTPSConn�suVerifyingHTTPSConncCstjt|pt���jS(u@Get a urlopen() replacement that uses ca_bundle for verification(uurllib2ubuild_openeruVerifyingHTTPSHandlerufind_ca_bundleuopen(u	ca_bundle((u//tmp/pip-k8wh6o-build/setuptools/ssl_support.pyu
opener_for�scsxtdk	rtjSyddlm�Wntk
r?dSYnXG�fdd�d��}|dddg�atjS(Ni(uCertFilecs,|EeZdZff�fdd�ZdS(u$get_win_certfile.<locals>.MyCertFilecsL�j|�x|D]}|j|�qW|j|�tj|j�dS(N(u__init__uaddstoreuaddcertsuatexituregisteruclose(uselfustoresucertsustore(uCertFile(u//tmp/pip-k8wh6o-build/setuptools/ssl_support.pyu__init__�s



u-get_win_certfile.<locals>.MyCertFile.__init__N(u__name__u
__module__u__qualname__u__init__(u
__locals__(uCertFile(u//tmp/pip-k8wh6o-build/setuptools/ssl_support.pyu
MyCertFile�su
MyCertFileustoresuCAuROOT(u	_wincertsuNoneunameuwincertstoreuCertFileuImportError(u
MyCertFile((uCertFileu//tmp/pip-k8wh6o-build/setuptools/ssl_support.pyuget_win_certfile�s
	uget_win_certfilec
Cswtjdkrt�Sx$tD]}tjj|�r|SqWytjdd�SWntt	t
fk
rrdSYnXdS(u*Return an existing CA bundle path, or Noneuntucertifiu
cacert.pemN(uosunameuget_win_certfileu
cert_pathsupathuisfileu
pkg_resourcesuresource_filenameuImportErroruResolutionErroruExtractionErroruNone(u	cert_path((u//tmp/pip-k8wh6o-build/setuptools/ssl_support.pyufind_ca_bundle�s
(#uosusocketuatexitureu
pkg_resourcesuResolutionErroruExtractionErrorusetuptools.compatuurllib2ussluImportErroruNoneu__all__ustripusplitu
cert_pathsuobjectuHTTPSHandleruHTTPSConnectionuwhatuwhereumoduleuexecuis_availableuCertificateErrorumatch_hostnameubackports.ssl_match_hostnameu
ValueErroru_dnsname_matchuVerifyingHTTPSHandleruVerifyingHTTPSConnu
opener_foru	_wincertsuget_win_certfileufind_ca_bundle(((u//tmp/pip-k8wh6o-build/setuptools/ssl_support.pyu<module>sV
	






4)


?>