£Á°èZ¨Ä…–K§‚«“ô4“ÒÙ´dîfUÙÃÅ WKbyÊ¦•êŽ…È®FÒ¿ÊÎóCozá¬S@6{Í:›œêZÌ:Š•_%:¢¾¾~;‘Ã~èŠ©ÊÇí`ÔÑ©úë™µ'5I¿fš×WO%ø9¾«¾DK|€ùÍD”Ýs]nHÕ¶ê×Ó¼ãžªéUWŸÈË%DÒÕ¬ï‘]/Åcx  ‰ï2ß]ä6G[]S£ÔÏ¯rs{úëóµmÒï#UQxo·õÞCe]"±/aÙ&Eã4ú9Jé_ÞåëdãöKë)AÞ                  ¯¹ægƒÛowÐø^d™ý½ßB7áyMä9ÜÖUã
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
<html>
B
    Y                 @   sB   d Z ddlmZ ddlZdZG dd deZddd	Zd
d ZdS )zHThe match_hostname() function from Python 3.2, essential when using SSL.    )absolute_importNz3.2.2c               @   s   e Zd ZdS )CertificateErrorN)__name__
__module____qualname__ r   r   O/opt/alt/python37/lib/python3.7/site-packages/raven/utils/ssl_match_hostname.pyr   
   s   r      c       	      C   s   g }| sdS |  d}|d }|d}||kr@tdt|  |sT|  | kS |dkrh|d n>|ds||dr|t| n|t|	dd	 x$|d
d D ]}|t| qW t
dd| d tj}||S )zhMatching according to RFC 6125, section 6.4.3

    http://tools.ietf.org/html/rfc6125#section-6.4.3
    F.r   *z,too many wildcards in certificate DNS name: z[^.]+zxn--z\*z[^.]*r	   Nz\Az\.z\Z)splitcountr   reprlowerappend
startswithreescapereplacecompilejoin
IGNORECASEmatch)	ZdnhostnameZmax_wildcardsZpatspartsZleftmostZ	wildcardsfragpatr   r   r   _dnsname_match   s(    

r   c             C   s   | st dg }| dd}x0|D ](\}}|dkr"t||r@dS || q"W |sxF| ddD ]6}x0|D ](\}}|dkrjt||rdS || qjW q`W t|dkrtd	|d
tt|f n*t|dkrtd||d f ntddS )a)  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.
    zempty or no certificateZsubjectAltNamer   ZDNSNZsubjectZ
commonNamer	   z&hostname %r doesn't match either of %sz, zhostname %r doesn't match %rr   z=no appropriate commonName or subjectAltName fields were found)	
ValueErrorgetr   r   lenr   r   mapr   )Zcertr   ZdnsnamesZsankeyvaluesubr   r   r   match_hostname@   s2    

r%   )r	   )	__doc__
__future__r   r   __version__r   r   r   r%   r   r   r   r   <module>   s   
2