7yc z d Z ddlZddlZ ddlZn # e$ r dZY nw xY wdZ G d de ZddZd Z d Z d ZdS )zJThe match_hostname() function from Python 3.3.3, essential when using SSL. Nz3.5.0.1c e Zd ZdS )CertificateErrorN)__name__ __module____qualname__ }/builddir/build/BUILD/cloudlinux-venv-1.0.10/venv/lib/python3.11/site-packages/pip/_vendor/urllib3/util/ssl_match_hostname.pyr r s Dr r c l g }| sdS | d }|d }|dd }| d }||k rt dt | z |s*| | k S |dk r| d n| d s| d r(| t j | n;| t j | 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 r N*z,too many wildcards in certificate DNS name: z[^.]+zxn--z\*z[^.]*z\Az\.z\Z)splitcountr reprlowerappend startswithreescapereplacecompilejoin IGNORECASEmatch) dnhostname max_wildcardspatspartsleftmost remainder wildcardsfragpats r _dnsname_matchr&