?L;F L d Z ddlmZ ddlZdZ G d de Zd dZd ZdS )zHThe match_hostname() function from Python 3.2, essential when using SSL. )absolute_importNz3.2.2c e Zd ZdS )CertificateErrorN)__name__ __module____qualname__ p/builddir/build/BUILD/cloudlinux-venv-1.0.10/venv/lib/python3.11/site-packages/raven/utils/ssl_match_hostname.pyr r s Dr r c h g }| sdS | d }|d }| d }||k rt dt | z |s*| | k S |dk r| d n| d s| d r(| t j | n;| t j | dd |d d D ])}| t j | *t j dd | z dz 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[^.]+zxn--z\*z[^.]*r Nz\Az\.z\Z)splitcountr reprlowerappend startswithreescapereplacecompilejoin IGNORECASEmatch) dnhostname max_wildcardspatspartsleftmost wildcardsfragpats r _dnsname_matchr&